comparison libpurple/protocols/jabber/presence.c @ 27594:b448b259e3cf

The item JID will match the 'to' JID, not the from. Also, only try to be clever when the item JID is set.
author Paul Aurich <paul@darkrain42.org>
date Thu, 16 Jul 2009 22:56:37 +0000
parents f44eda839ea4
children f95bcb5eb047
comparison
equal deleted inserted replaced
27593:caed9d0b1e67 27594:b448b259e3cf
803 "http://jabber.org/protocol/muc#user"); 803 "http://jabber.org/protocol/muc#user");
804 if (chat->muc && x) { 804 if (chat->muc && x) {
805 const char *nick; 805 const char *nick;
806 const char *code = NULL; 806 const char *code = NULL;
807 const char *item_jid = NULL; 807 const char *item_jid = NULL;
808 const char *to;
808 xmlnode *stat; 809 xmlnode *stat;
809 xmlnode *item; 810 xmlnode *item;
810 811
811 item = xmlnode_get_child(x, "item"); 812 item = xmlnode_get_child(x, "item");
812 if (item) 813 if (item)
813 item_jid = xmlnode_get_attrib(item, "jid"); 814 item_jid = xmlnode_get_attrib(item, "jid");
814
815 815
816 stat = xmlnode_get_child(x, "status"); 816 stat = xmlnode_get_child(x, "status");
817 817
818 if (stat) 818 if (stat)
819 code = xmlnode_get_attrib(stat, "code"); 819 code = xmlnode_get_attrib(stat, "code");
887 * v1.24 section 7.1.10) being disconnected. Should be 887 * v1.24 section 7.1.10) being disconnected. Should be
888 * distinguished by the item_jid. 888 * distinguished by the item_jid.
889 * Also possibly works around bits of an Openfire bug. See 889 * Also possibly works around bits of an Openfire bug. See
890 * #8319. 890 * #8319.
891 */ 891 */
892 if (is_our_resource && !purple_strequal(from, item_jid)) { 892 to = xmlnode_get_attrib(packet, "to");
893 if (is_our_resource && item_jid && !purple_strequal(to, item_jid)) {
893 /* TODO: When the above is a loop, this needs to still act 894 /* TODO: When the above is a loop, this needs to still act
894 * sanely for all cases (this code is a little fragile). */ 895 * sanely for all cases (this code is a little fragile). */
895 if (!kick && !nick_change) 896 if (!kick && !nick_change)
896 /* Presumably, kicks and nick changes also affect us. */ 897 /* Presumably, kicks and nick changes also affect us. */
897 is_our_resource = FALSE; 898 is_our_resource = FALSE;