Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp.c @ 2023:26edaf6ea10b
xmpp_setstatus: send presence to MUC rooms before the global presence
It only matters (AFAICS) when going offline. We want the presence
to be sent by mcabber and not by the server, especially if we're
using PGP.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 30 Jul 2012 22:39:17 +0200 |
parents | 87049d55e34f |
children | 107d39cd968b |
comparison
equal
deleted
inserted
replaced
2022:d58fb8d7a09a | 2023:26edaf6ea10b |
---|---|
2027 #else | 2027 #else |
2028 // XXX Could be removed if/when we get rid of status invisible | 2028 // XXX Could be removed if/when we get rid of status invisible |
2029 // completely. | 2029 // completely. |
2030 const char *s_msg = msg; | 2030 const char *s_msg = msg; |
2031 #endif | 2031 #endif |
2032 | |
2033 if (!recipient) { | |
2034 // This is a global status, send presence to chatrooms | |
2035 #ifdef WITH_DEPRECATED_STATUS_INVISIBLE | |
2036 if (st != invisible) | |
2037 #endif | |
2038 { | |
2039 struct T_presence room_presence; | |
2040 room_presence.st = st; | |
2041 room_presence.msg = msg; | |
2042 foreach_buddy(ROSTER_TYPE_ROOM, &roompresence, &room_presence); | |
2043 } | |
2044 } | |
2045 | |
2032 m = lm_message_new_presence(st, recipient, s_msg); | 2046 m = lm_message_new_presence(st, recipient, s_msg); |
2033 xmpp_insert_entity_capabilities(m->node, st); // Entity Caps (XEP-0115) | 2047 xmpp_insert_entity_capabilities(m->node, st); // Entity Caps (XEP-0115) |
2034 #ifdef HAVE_GPGME | 2048 #ifdef HAVE_GPGME |
2035 if (!do_not_sign && gpg_enabled()) { | 2049 if (!do_not_sign && gpg_enabled()) { |
2036 char *signature; | 2050 char *signature; |
2047 lm_message_unref(m); | 2061 lm_message_unref(m); |
2048 } | 2062 } |
2049 | 2063 |
2050 // If we didn't change our _global_ status, we are done | 2064 // If we didn't change our _global_ status, we are done |
2051 if (recipient) return; | 2065 if (recipient) return; |
2052 | |
2053 if (isonline) { | |
2054 // Send presence to chatrooms | |
2055 #ifdef WITH_DEPRECATED_STATUS_INVISIBLE | |
2056 if (st != invisible) | |
2057 #endif | |
2058 { | |
2059 struct T_presence room_presence; | |
2060 room_presence.st = st; | |
2061 room_presence.msg = msg; | |
2062 foreach_buddy(ROSTER_TYPE_ROOM, &roompresence, &room_presence); | |
2063 } | |
2064 } | |
2065 | 2066 |
2066 if (isonline || !st) { | 2067 if (isonline || !st) { |
2067 // We'll have to update the roster if we switch to/from offline because | 2068 // We'll have to update the roster if we switch to/from offline because |
2068 // we don't know the presences of buddies when offline... | 2069 // we don't know the presences of buddies when offline... |
2069 if (mystatus == offline || st == offline) | 2070 if (mystatus == offline || st == offline) |