comparison mcabber/mcabber/xmpp.c @ 1800:d2747442918a

When displaying a server error, show the sender JID
author Mikael Berthe <mikael@lilotux.net>
date Sat, 20 Mar 2010 15:27:26 +0100
parents e4378fbab5d7
children 8c2651fc217a
comparison
equal deleted inserted replaced
1799:e73cd9377a4e 1800:d2747442918a
1256 // Timestamp? 1256 // Timestamp?
1257 timestamp = lm_message_node_get_timestamp(m->node); 1257 timestamp = lm_message_node_get_timestamp(m->node);
1258 1258
1259 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { 1259 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) {
1260 x = lm_message_node_get_child(m->node, "error"); 1260 x = lm_message_node_get_child(m->node, "error");
1261 display_server_error(x); 1261 display_server_error(x, from);
1262 #if defined XEP0022 || defined XEP0085 1262 #if defined XEP0022 || defined XEP0085
1263 // If the XEP85/22 support is probed, set it back to unknown so that 1263 // If the XEP85/22 support is probed, set it back to unknown so that
1264 // we probe it again. 1264 // we probe it again.
1265 chatstates_reset_probed(from); 1265 chatstates_reset_probed(from);
1266 #endif 1266 #endif
1297 char *ver = user_data; 1297 char *ver = user_data;
1298 LmMessageSubType mstype = lm_message_get_sub_type(m); 1298 LmMessageSubType mstype = lm_message_get_sub_type(m);
1299 1299
1300 caps_add(ver); 1300 caps_add(ver);
1301 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { 1301 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) {
1302 display_server_error(lm_message_node_get_child(m->node, "error")); 1302 display_server_error(lm_message_node_get_child(m->node, "error"),
1303 lm_message_get_from(m));
1303 } else if (mstype == LM_MESSAGE_SUB_TYPE_RESULT) { 1304 } else if (mstype == LM_MESSAGE_SUB_TYPE_RESULT) {
1304 LmMessageNode *info; 1305 LmMessageNode *info;
1305 LmMessageNode *query = lm_message_node_get_child(m->node, "query"); 1306 LmMessageNode *query = lm_message_node_get_child(m->node, "query");
1306 1307
1307 info = lm_message_node_get_child(query, "identity"); 1308 info = lm_message_node_get_child(query, "identity");
1353 1354
1354 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { 1355 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) {
1355 LmMessageNode *x; 1356 LmMessageNode *x;
1356 scr_LogPrint(LPRINT_LOGNORM, "Error presence packet from <%s>", bjid); 1357 scr_LogPrint(LPRINT_LOGNORM, "Error presence packet from <%s>", bjid);
1357 x = lm_message_node_find_child(m->node, "error"); 1358 x = lm_message_node_find_child(m->node, "error");
1358 display_server_error(x); 1359 display_server_error(x, from);
1359 // Let's check it isn't a nickname conflict. 1360 // Let's check it isn't a nickname conflict.
1360 // XXX Note: We should handle the <conflict/> string condition. 1361 // XXX Note: We should handle the <conflict/> string condition.
1361 if ((p = lm_message_node_get_attribute(x, "code")) != NULL) { 1362 if ((p = lm_message_node_get_attribute(x, "code")) != NULL) {
1362 if (atoi(p) == 409) { 1363 if (atoi(p) == 409) {
1363 // 409 = conflict (nickname is in use or registered by another user) 1364 // 409 = conflict (nickname is in use or registered by another user)
1462 const char *xmlns = NULL; 1463 const char *xmlns = NULL;
1463 LmMessageNode *x; 1464 LmMessageNode *x;
1464 LmMessageSubType mstype = lm_message_get_sub_type(m); 1465 LmMessageSubType mstype = lm_message_get_sub_type(m);
1465 1466
1466 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { 1467 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) {
1467 display_server_error(lm_message_node_get_child(m->node, "error")); 1468 display_server_error(lm_message_node_get_child(m->node, "error"),
1469 lm_message_get_from(m));
1468 return LM_HANDLER_RESULT_REMOVE_MESSAGE; 1470 return LM_HANDLER_RESULT_REMOVE_MESSAGE;
1469 } 1471 }
1470 1472
1471 for (x = m->node->children; x; x=x->next) { 1473 for (x = m->node->children; x; x=x->next) {
1472 xmlns = lm_message_node_get_attribute(x, "xmlns"); 1474 xmlns = lm_message_node_get_attribute(x, "xmlns");