comparison src/protocols/jabber/presence.c @ 7972:ac01b7d67ff9

[gaim-migrate @ 8649] yay, /nick for jabber i'll be really happy if marv finishes /command support for the core soon ;-) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 02 Jan 2004 07:34:26 +0000
parents b02b30247e7a
children aa99b8390092
comparison
equal deleted inserted replaced
7971:6fca0d9cc98b 7972:ac01b7d67ff9
306 chat->muc = muc; 306 chat->muc = muc;
307 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); 307 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
308 } 308 }
309 309
310 if(type && !strcmp(type, "unavailable")) { 310 if(type && !strcmp(type, "unavailable")) {
311 if(!strcmp(jid->resource, chat->nick)) { 311 gboolean nick_change = FALSE;
312 serv_got_chat_left(js->gc, chat->id); 312 if(chat->muc) {
313 jabber_chat_destroy(chat); 313 xmlnode *x;
314 } else { 314 for(x = packet->child; x; x = x->next) {
315 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(chat->conv), jid->resource, 315 const char *xmlns, *nick, *code;
316 NULL); 316 xmlnode *stat, *item;
317 if(strcmp(x->name, "x"))
318 continue;
319 if(!(xmlns = xmlnode_get_attrib(x, "xmlns")) ||
320 strcmp(xmlns, "http://jabber.org/protocol/muc#user"))
321 continue;
322 if(!(stat = xmlnode_get_child(x, "status")))
323 continue;
324 if(!(code = xmlnode_get_attrib(stat, "code")) || strcmp(code, "303"))
325 continue;
326 if(!(item = xmlnode_get_child(x, "item")))
327 continue;
328 if(!(nick = xmlnode_get_attrib(item, "nick")))
329 continue;
330 nick_change = TRUE;
331 gaim_conv_chat_rename_user(GAIM_CONV_CHAT(chat->conv), jid->resource, nick);
332 if(!g_utf8_collate(jid->resource, chat->nick)) {
333 g_free(chat->nick);
334 chat->nick = g_strdup(nick);
335 }
336 break;
337 }
338 }
339 if(!nick_change) {
340 if(!strcmp(jid->resource, chat->nick)) {
341 serv_got_chat_left(js->gc, chat->id);
342 jabber_chat_destroy(chat);
343 } else {
344 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(chat->conv), jid->resource,
345 NULL);
346 }
317 } 347 }
318 } else { 348 } else {
319 if(!jabber_chat_find_buddy(chat->conv, jid->resource)) 349 if(!jabber_chat_find_buddy(chat->conv, jid->resource))
320 gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat->conv), jid->resource, 350 gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat->conv), jid->resource,
321 real_jid); 351 real_jid);