Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp.c @ 1701:44e023ad99ed
Add dummy handler for roster manipulation IQ responses
This clears up the "Unhandled IQ" messages, only errors should displayed now.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 07 Feb 2010 19:13:33 +0100 |
parents | 32c6d81bd1ef |
children | ac881b5f9248 |
comparison
equal
deleted
inserted
replaced
1700:87dd0a8f1a9c | 1701:44e023ad99ed |
---|---|
104 // Note: the caller should check the jid is correct | 104 // Note: the caller should check the jid is correct |
105 void xmpp_addbuddy(const char *bjid, const char *name, const char *group) | 105 void xmpp_addbuddy(const char *bjid, const char *name, const char *group) |
106 { | 106 { |
107 LmMessageNode *query, *y; | 107 LmMessageNode *query, *y; |
108 LmMessage *iq; | 108 LmMessage *iq; |
109 LmMessageHandler *handler; | |
109 char *cleanjid; | 110 char *cleanjid; |
110 | 111 |
111 if (!xmpp_is_online()) | 112 if (!xmpp_is_online()) |
112 return; | 113 return; |
113 | 114 |
127 lm_message_node_set_attribute(y, "name", name); | 128 lm_message_node_set_attribute(y, "name", name); |
128 | 129 |
129 if (group) | 130 if (group) |
130 lm_message_node_add_child(y, "group", group); | 131 lm_message_node_add_child(y, "group", group); |
131 | 132 |
132 lm_connection_send(lconnection, iq, NULL); | 133 handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE); |
134 lm_connection_send_with_reply(lconnection, iq, handler, NULL); | |
135 lm_message_handler_unref(handler); | |
133 lm_message_unref(iq); | 136 lm_message_unref(iq); |
134 | 137 |
135 xmpp_send_s10n(cleanjid, LM_MESSAGE_SUB_TYPE_SUBSCRIBE); | 138 xmpp_send_s10n(cleanjid, LM_MESSAGE_SUB_TYPE_SUBSCRIBE); |
136 | 139 |
137 roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER, sub_pending, -1); | 140 roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER, sub_pending, -1); |
142 } | 145 } |
143 | 146 |
144 void xmpp_updatebuddy(const char *bjid, const char *name, const char *group) | 147 void xmpp_updatebuddy(const char *bjid, const char *name, const char *group) |
145 { | 148 { |
146 LmMessage *iq; | 149 LmMessage *iq; |
150 LmMessageHandler *handler; | |
147 LmMessageNode *x; | 151 LmMessageNode *x; |
148 char *cleanjid; | 152 char *cleanjid; |
149 | 153 |
150 if (!xmpp_is_online()) | 154 if (!xmpp_is_online()) |
151 return; | 155 return; |
165 NULL); | 169 NULL); |
166 | 170 |
167 if (group) | 171 if (group) |
168 lm_message_node_add_child(x, "group", group); | 172 lm_message_node_add_child(x, "group", group); |
169 | 173 |
170 lm_connection_send(lconnection, iq, NULL); | 174 handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE); |
175 lm_connection_send_with_reply(lconnection, iq, handler, NULL); | |
176 lm_message_handler_unref(handler); | |
171 lm_message_unref(iq); | 177 lm_message_unref(iq); |
172 g_free(cleanjid); | 178 g_free(cleanjid); |
173 } | 179 } |
174 | 180 |
175 void xmpp_delbuddy(const char *bjid) | 181 void xmpp_delbuddy(const char *bjid) |
176 { | 182 { |
177 LmMessageNode *y, *z; | 183 LmMessageNode *y, *z; |
178 LmMessage *iq; | 184 LmMessage *iq; |
185 LmMessageHandler *handler; | |
179 char *cleanjid; | 186 char *cleanjid; |
180 | 187 |
181 if (!xmpp_is_online()) | 188 if (!xmpp_is_online()) |
182 return; | 189 return; |
183 | 190 |
209 z = lm_message_node_add_child(y, "item", NULL); | 216 z = lm_message_node_add_child(y, "item", NULL); |
210 lm_message_node_set_attributes(z, | 217 lm_message_node_set_attributes(z, |
211 "jid", cleanjid, | 218 "jid", cleanjid, |
212 "subscription", "remove", | 219 "subscription", "remove", |
213 NULL); | 220 NULL); |
214 lm_connection_send(lconnection, iq, NULL); | 221 handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE); |
222 lm_connection_send_with_reply(lconnection, iq, handler, NULL); | |
223 lm_message_handler_unref(handler); | |
215 lm_message_unref(iq); | 224 lm_message_unref(iq); |
216 | 225 |
217 roster_del_user(cleanjid); | 226 roster_del_user(cleanjid); |
218 g_free(cleanjid); | 227 g_free(cleanjid); |
219 buddylist_build(); | 228 buddylist_build(); |