MCPcopy Create free account
hub / github.com/Segs/Segs / cmdHandler_Unfriend

Function cmdHandler_Unfriend

Projects/CoX/Servers/MapServer/SlashCommand.cpp:1796–1823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1794}
1795
1796void cmdHandler_Unfriend(const QStringList &params, MapClientSession &sess)
1797{
1798 // Cannot use getEntityFromCommand as we need to be able to unfriend logged out characters.
1799 QString name = params.join(" ");
1800 if(name.isEmpty())
1801 {
1802 const Entity* const tgt = getTargetEntity(sess);
1803 if(tgt == nullptr)
1804 return;
1805
1806 name = tgt->name();
1807 }
1808
1809 FriendListChangeStatus status = removeFriend(*sess.m_ent, name);
1810 if(status==FriendListChangeStatus::FRIEND_REMOVED)
1811 {
1812 QString msg = "Removing " + name + " from your friends list.";
1813 sendInfoMessage(MessageChannel::FRIENDS, msg, sess);
1814
1815 // Send FriendsListUpdate
1816 sendFriendsListUpdate(sess, sess.m_ent->m_char->m_char_data.m_friendlist);
1817 }
1818 else
1819 {
1820 QString msg = name + " is not on your friends list.";
1821 sendInfoMessage(MessageChannel::USER_ERROR, msg, sess);
1822 }
1823}
1824
1825void cmdHandler_FriendList(const QStringList &/*params*/, MapClientSession &sess)
1826{

Callers

nothing calls this directly

Calls 6

getTargetEntityFunction · 0.85
removeFriendFunction · 0.85
sendInfoMessageFunction · 0.85
sendFriendsListUpdateFunction · 0.85
isEmptyMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected