Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp_iqrequest.c @ 1698:e67bdd863638
Handle IQ responses with no "from"
(No from means our own JID -- thanks waqas)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 07 Feb 2010 17:10:29 +0100 |
parents | b09f82f61745 |
children | 527c965b45c5 |
comparison
equal
deleted
inserted
replaced
1697:d080e7cda46c | 1698:e67bdd863638 |
---|---|
133 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result!"); | 133 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result!"); |
134 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 134 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
135 } | 135 } |
136 | 136 |
137 // Display IQ result sender... | 137 // Display IQ result sender... |
138 p = lm_message_get_from(m); | 138 bjid = lm_message_get_from(m); |
139 if (!p) { | 139 if (!bjid) |
140 bjid = lm_connection_get_jid(lconnection); | |
141 if (!bjid) { | |
140 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result (no sender name)."); | 142 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result (no sender name)."); |
141 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 143 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
142 } | 144 } |
143 bjid = p; | |
144 | 145 |
145 buf = g_strdup_printf("Received IQ:version result from <%s>", bjid); | 146 buf = g_strdup_printf("Received IQ:version result from <%s>", bjid); |
146 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); | 147 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); |
147 | 148 |
148 // bjid should now really be the "bare JID", let's strip the resource | 149 // bjid should now really be the "bare JID", let's strip the resource |
189 if (!ansqry) { | 190 if (!ansqry) { |
190 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:time result!"); | 191 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:time result!"); |
191 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 192 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
192 } | 193 } |
193 // Display IQ result sender... | 194 // Display IQ result sender... |
194 p = lm_message_get_from(m); | 195 bjid = lm_message_get_from(m); |
195 if (!p) { | 196 if (!bjid) |
196 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:time result (no sender name)."); | 197 bjid = lm_connection_get_jid(lconnection); |
197 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 198 if (!bjid) { |
198 } | 199 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result (no sender name)."); |
199 bjid = p; | 200 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
201 } | |
200 | 202 |
201 buf = g_strdup_printf("Received IQ:time result from <%s>", bjid); | 203 buf = g_strdup_printf("Received IQ:time result from <%s>", bjid); |
202 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); | 204 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); |
203 | 205 |
204 // bjid should now really be the "bare JID", let's strip the resource | 206 // bjid should now really be the "bare JID", let's strip the resource |
244 if (!ansqry) { | 246 if (!ansqry) { |
245 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:last result!"); | 247 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:last result!"); |
246 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 248 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
247 } | 249 } |
248 // Display IQ result sender... | 250 // Display IQ result sender... |
249 p = lm_message_get_from(m); | 251 bjid = lm_message_get_from(m); |
250 if (!p) { | 252 if (!bjid) |
251 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:last result (no sender name)."); | 253 bjid = lm_connection_get_jid(lconnection); |
252 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 254 if (!bjid) { |
253 } | 255 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result (no sender name)."); |
254 bjid = p; | 256 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
257 } | |
255 | 258 |
256 buf = g_strdup_printf("Received IQ:last result from <%s>", bjid); | 259 buf = g_strdup_printf("Received IQ:last result from <%s>", bjid); |
257 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); | 260 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); |
258 | 261 |
259 // bjid should now really be the "bare JID", let's strip the resource | 262 // bjid should now really be the "bare JID", let's strip the resource |
407 | 410 |
408 static LmHandlerResult cb_vcard(LmMessageHandler *h, LmConnection *c, | 411 static LmHandlerResult cb_vcard(LmMessageHandler *h, LmConnection *c, |
409 LmMessage *m, gpointer user_data) | 412 LmMessage *m, gpointer user_data) |
410 { | 413 { |
411 LmMessageNode *ansqry; | 414 LmMessageNode *ansqry; |
412 const char *p, *bjid; | 415 const char *bjid; |
413 char *buf, *tmp; | 416 char *buf, *tmp; |
414 | 417 |
415 // Display IQ result sender... | 418 // Display IQ result sender... |
416 p = lm_message_get_from(m); | 419 bjid = lm_message_get_from(m); |
417 if (!p) { | 420 if (!bjid) |
418 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:vCard result (no sender name)."); | 421 bjid = lm_connection_get_jid(lconnection); |
419 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; | 422 if (!bjid) { |
420 } | 423 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result (no sender name)."); |
421 bjid = p; | 424 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
425 } | |
422 | 426 |
423 buf = g_strdup_printf("Received IQ:vCard result from <%s>", bjid); | 427 buf = g_strdup_printf("Received IQ:vCard result from <%s>", bjid); |
424 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); | 428 scr_LogPrint(LPRINT_LOGNORM, "%s", buf); |
425 | 429 |
426 // Get the vCard node | 430 // Get the vCard node |