| 1794 | } |
| 1795 | |
| 1796 | void cmdHandler_Unfriend(const QStringList ¶ms, 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 | |
| 1825 | void cmdHandler_FriendList(const QStringList &/*params*/, MapClientSession &sess) |
| 1826 | { |
nothing calls this directly
no test coverage detected