Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp.c @ 2292:f181418db215
Replace global variable update_roster with scr_update_roster()
author | franky |
---|---|
date | Tue, 01 Nov 2016 18:00:39 +0100 |
parents | 0d350e979bde |
children | 2a9569fd7644 |
comparison
equal
deleted
inserted
replaced
2291:0d350e979bde | 2292:f181418db215 |
---|---|
141 xmpp_send_s10n(cleanjid, LM_MESSAGE_SUB_TYPE_SUBSCRIBE); | 141 xmpp_send_s10n(cleanjid, LM_MESSAGE_SUB_TYPE_SUBSCRIBE); |
142 | 142 |
143 roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER, sub_pending, -1); | 143 roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER, sub_pending, -1); |
144 g_free(cleanjid); | 144 g_free(cleanjid); |
145 buddylist_defer_build(); | 145 buddylist_defer_build(); |
146 | 146 scr_update_roster(); |
147 update_roster = TRUE; | |
148 } | 147 } |
149 | 148 |
150 void xmpp_updatebuddy(const char *bjid, const char *name, const char *group) | 149 void xmpp_updatebuddy(const char *bjid, const char *name, const char *group) |
151 { | 150 { |
152 LmMessage *iq; | 151 LmMessage *iq; |
229 | 228 |
230 roster_del_user(cleanjid); | 229 roster_del_user(cleanjid); |
231 g_free(cleanjid); | 230 g_free(cleanjid); |
232 buddylist_defer_build(); | 231 buddylist_defer_build(); |
233 | 232 |
234 update_roster = TRUE; | 233 scr_update_roster(); |
235 } | 234 } |
236 | 235 |
237 void xmpp_request(const char *fjid, enum iqreq_type reqtype) | 236 void xmpp_request(const char *fjid, enum iqreq_type reqtype) |
238 { | 237 { |
239 GSList *resources, *p_res; | 238 GSList *resources, *p_res; |
875 lm_message_node_unref(rosternotes); | 874 lm_message_node_unref(rosternotes); |
876 rosternotes = NULL; | 875 rosternotes = NULL; |
877 // Reset carbons | 876 // Reset carbons |
878 carbons_reset(); | 877 carbons_reset(); |
879 // Update display | 878 // Update display |
880 update_roster = TRUE; | 879 scr_update_roster(); |
881 scr_update_buddy_window(); | 880 scr_update_buddy_window(); |
882 | 881 |
883 if (!reason) | 882 if (!reason) |
884 scr_LogPrint(LPRINT_LOGNORM, "Disconnected."); | 883 scr_LogPrint(LPRINT_LOGNORM, "Disconnected."); |
885 else | 884 else |
925 } else if (!strcmp(state_ns->name, "gone")) { | 924 } else if (!strcmp(state_ns->name, "gone")) { |
926 xep85->last_state_rcvd = ROSTER_EVENT_GONE; | 925 xep85->last_state_rcvd = ROSTER_EVENT_GONE; |
927 } | 926 } |
928 | 927 |
929 buddy_resource_setevents(sl_buddy->data, resource, xep85->last_state_rcvd); | 928 buddy_resource_setevents(sl_buddy->data, resource, xep85->last_state_rcvd); |
930 update_roster = TRUE; | 929 scr_update_roster(); |
931 #endif | 930 #endif |
932 } | 931 } |
933 | 932 |
934 static void gotmessage(LmMessageSubType type, const char *from, | 933 static void gotmessage(LmMessageSubType type, const char *from, |
935 const char *body, const char *enc, | 934 const char *body, const char *enc, |
985 } else { | 984 } else { |
986 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM); | 985 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM); |
987 } | 986 } |
988 | 987 |
989 buddylist_defer_build(); | 988 buddylist_defer_build(); |
990 scr_draw_roster(); | 989 scr_update_roster(); |
991 goto gotmessage_return; | 990 goto gotmessage_return; |
992 } | 991 } |
993 | 992 |
994 // We don't call the message_in hook if 'block_unsubscribed' is true and | 993 // We don't call the message_in hook if 'block_unsubscribed' is true and |
995 // this is a regular message from an unsubscribed user. | 994 // this is a regular message from an unsubscribed user. |
1692 g_free(buf); | 1691 g_free(buf); |
1693 } else if (mstype == LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED) { | 1692 } else if (mstype == LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED) { |
1694 /* The subscription request has been denied or a previously-granted | 1693 /* The subscription request has been denied or a previously-granted |
1695 subscription has been cancelled */ | 1694 subscription has been cancelled */ |
1696 roster_unsubscribed(from); | 1695 roster_unsubscribed(from); |
1697 update_roster = TRUE; | 1696 scr_update_roster(); |
1698 buf = g_strdup_printf("<%s> has cancelled your subscription to " | 1697 buf = g_strdup_printf("<%s> has cancelled your subscription to " |
1699 "their presence updates", from); | 1698 "their presence updates", from); |
1700 scr_WriteIncomingMessage(r, buf, 0, HBB_PREFIX_INFO, 0); | 1699 scr_WriteIncomingMessage(r, buf, 0, HBB_PREFIX_INFO, 0); |
1701 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); | 1700 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); |
1702 g_free(buf); | 1701 g_free(buf); |
1704 g_free(r); | 1703 g_free(r); |
1705 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 1704 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
1706 } | 1705 } |
1707 | 1706 |
1708 if (newbuddy) | 1707 if (newbuddy) |
1709 update_roster = TRUE; | 1708 scr_update_roster(); |
1710 g_free(r); | 1709 g_free(r); |
1711 return LM_HANDLER_RESULT_REMOVE_MESSAGE; | 1710 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
1712 } | 1711 } |
1713 | 1712 |
1714 // TODO: Use the enum of loudmouth, when it's included in the header... | 1713 // TODO: Use the enum of loudmouth, when it's included in the header... |
2065 | 2064 |
2066 if (isonline || !st) { | 2065 if (isonline || !st) { |
2067 // We'll have to update the roster if we switch to/from offline because | 2066 // 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... | 2067 // we don't know the presences of buddies when offline... |
2069 if (mystatus == offline || st == offline) | 2068 if (mystatus == offline || st == offline) |
2070 update_roster = TRUE; | 2069 scr_update_roster(); |
2071 | 2070 |
2072 if (isonline || mystatus || st) | 2071 if (isonline || mystatus || st) |
2073 #ifdef WITH_DEPRECATED_STATUS_INVISIBLE | 2072 #ifdef WITH_DEPRECATED_STATUS_INVISIBLE |
2074 hk_mystatuschange(0, mystatus, st, (st != invisible ? msg : "")); | 2073 hk_mystatuschange(0, mystatus, st, (st != invisible ? msg : "")); |
2075 #else | 2074 #else |