Changeset 3c23681 for protocols/jabber
- Timestamp:
- 2015-08-26T05:58:54Z (9 years ago)
- Branches:
- master
- Children:
- b6a3fbf
- Parents:
- 0605498
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/conference.c
r0605498 r3c23681 332 332 if ((bud->flags & JBFLAG_IS_CHATROOM) && bud->ext_jid) { 333 333 char *reason = NULL; 334 char *status = NULL; 335 char *status_text = NULL; 334 336 335 337 if ((c = xt_find_node_by_attr(node->children, "x", "xmlns", XMLNS_MUC_USER))) { 336 struct xt_node *c2; 337 char *status = NULL; 338 339 if ((c2 = xt_find_node(c->children, "status"))) { 340 status = xt_find_attr(c2, "code"); 341 if (g_strcmp0(status, "301") == 0) { 338 struct xt_node *c2 = c->children; 339 340 while ((c2 = xt_find_node(c2, "status"))) { 341 char *code = xt_find_attr(c2, "code"); 342 if (g_strcmp0(code, "301") == 0) { 342 343 status = "Banned"; 343 } else if (g_strcmp0(status, "303") == 0) { 344 break; 345 } else if (g_strcmp0(code, "303") == 0) { 344 346 /* This could be handled in a cleverer way, 345 347 * but let's just show a literal part/join for now */ 346 348 status = "Changing nicks"; 347 } else if (g_strcmp0(status, "307") == 0) { 349 break; 350 } else if (g_strcmp0(code, "307") == 0) { 348 351 status = "Kicked"; 352 break; 349 353 } 354 c2 = c2->next; 350 355 } 351 356 357 /* Sometimes the status message is in presence/x/item/reason */ 352 358 if ((c2 = xt_find_path(c, "item/reason")) && c2->text && c2->text_len) { 353 if (status) { 354 reason = g_strdup_printf("%s: %s", status, c2->text); 355 } else { 356 reason = g_strdup(c2->text); 357 } 358 } else { 359 reason = g_strdup(status); 359 status_text = c2->text; 360 360 } 361 } 362 363 /* Sometimes the status message is right inside <presence> */ 364 if ((c = xt_find_node(node->children, "status")) && c->text && c->text_len) { 365 status_text = c->text; 366 } 367 368 if (status_text && status) { 369 reason = g_strdup_printf("%s: %s", status, status_text); 370 } else { 371 reason = g_strdup(status_text ? : status); 361 372 } 362 373
Note: See TracChangeset
for help on using the changeset viewer.