Mercurial > hg
comparison mcabber/src/jabglue.c @ 999:9687ecc59303
Redo chat states detection if we receive a message error packet from a contact
If we've sent a JEP85 discovery notification and we receive an error
packet, make sure we'll send another notification with the next message.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 04 Nov 2006 22:06:37 +0100 |
parents | f984baa9a789 |
children | dff25377c11f |
comparison
equal
deleted
inserted
replaced
998:f984baa9a789 | 999:9687ecc59303 |
---|---|
684 jep22 = buddy_resource_jep22(buddy, NULL); | 684 jep22 = buddy_resource_jep22(buddy, NULL); |
685 if (jep22 && jep22->support == CHATSTATES_SUPPORT_OK) { | 685 if (jep22 && jep22->support == CHATSTATES_SUPPORT_OK) { |
686 jb_send_jep22_event(jid, chatstate); | 686 jb_send_jep22_event(jid, chatstate); |
687 } | 687 } |
688 #endif | 688 #endif |
689 } | |
690 #endif | |
691 | |
692 // chatstates_reset_probed(fulljid) | |
693 // If the JEP has been probed for this contact, set it back to unknown so | |
694 // that we probe it again. The parameter must be a full jid (w/ resource). | |
695 #if defined JEP0022 || defined JEP0085 | |
696 static void chatstates_reset_probed(const char *fulljid) | |
697 { | |
698 char *rname, *barejid; | |
699 GSList *sl_buddy; | |
700 struct jep0085 *jep85; | |
701 struct jep0022 *jep22; | |
702 | |
703 rname = strchr(fulljid, JID_RESOURCE_SEPARATOR); | |
704 if (!rname++) | |
705 return; | |
706 | |
707 barejid = jidtodisp(fulljid); | |
708 sl_buddy = roster_find(barejid, jidsearch, ROSTER_TYPE_USER); | |
709 g_free(barejid); | |
710 | |
711 if (!sl_buddy) | |
712 return; | |
713 | |
714 jep85 = buddy_resource_jep85(sl_buddy->data, rname); | |
715 jep22 = buddy_resource_jep22(sl_buddy->data, rname); | |
716 | |
717 if (jep85 && jep85->support == CHATSTATES_SUPPORT_PROBED) | |
718 jep85->support = CHATSTATES_SUPPORT_UNKNOWN; | |
719 if (jep22 && jep22->support == CHATSTATES_SUPPORT_PROBED) | |
720 jep22->support = CHATSTATES_SUPPORT_UNKNOWN; | |
689 } | 721 } |
690 #endif | 722 #endif |
691 | 723 |
692 // jb_subscr_send_auth(jid) | 724 // jb_subscr_send_auth(jid) |
693 // Allow jid to receive our presence updates | 725 // Allow jid to receive our presence updates |
1686 timestamp = xml_get_timestamp(xmldata); | 1718 timestamp = xml_get_timestamp(xmldata); |
1687 | 1719 |
1688 if (type && !strcmp(type, TMSG_ERROR)) { | 1720 if (type && !strcmp(type, TMSG_ERROR)) { |
1689 if ((x = xmlnode_get_tag(xmldata, TMSG_ERROR)) != NULL) | 1721 if ((x = xmlnode_get_tag(xmldata, TMSG_ERROR)) != NULL) |
1690 display_server_error(x); | 1722 display_server_error(x); |
1723 #if defined JEP0022 || defined JEP0085 | |
1724 // If the JEP85/22 support is probed, set it back to unknown so that | |
1725 // we probe it again. | |
1726 chatstates_reset_probed(from); | |
1727 #endif | |
1691 } | 1728 } |
1692 if (from && body) | 1729 if (from && body) |
1693 gotmessage(type, from, body, enc, timestamp); | 1730 gotmessage(type, from, body, enc, timestamp); |
1694 g_free(tmp); | 1731 g_free(tmp); |
1695 } | 1732 } |