comparison libpurple/protocols/jabber/presence.c @ 23262:5793bcea224c

Fix the chat-room rejoining bug where the list appears empty. Closes #5541.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 01 Jun 2008 18:08:14 +0000
parents 591ef3693345
children 146d16459cda 26eabe8e739b 3da0957e7821
comparison
equal deleted inserted replaced
23260:babaa9794e1b 23262:5793bcea224c
47 { 47 {
48 JabberChat *chat = val; 48 JabberChat *chat = val;
49 xmlnode *presence = user_data; 49 xmlnode *presence = user_data;
50 char *chat_full_jid; 50 char *chat_full_jid;
51 51
52 if(!chat->conv) 52 if(!chat->conv || chat->left)
53 return; 53 return;
54 54
55 chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, 55 chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server,
56 chat->handle); 56 chat->handle);
57 57
579 char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain); 579 char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain);
580 580
581 if(state == JABBER_BUDDY_STATE_ERROR) { 581 if(state == JABBER_BUDDY_STATE_ERROR) {
582 char *title, *msg = jabber_parse_error(js, packet, NULL); 582 char *title, *msg = jabber_parse_error(js, packet, NULL);
583 583
584 if(chat->conv) { 584 if (!chat->conv) {
585 title = g_strdup_printf(_("Error joining chat %s"), from);
586 purple_serv_got_join_chat_failed(js->gc, chat->components);
587 } else {
585 title = g_strdup_printf(_("Error in chat %s"), from); 588 title = g_strdup_printf(_("Error in chat %s"), from);
586 if (g_hash_table_size(chat->members) == 0) 589 if (g_hash_table_size(chat->members) == 0)
587 serv_got_chat_left(js->gc, chat->id); 590 serv_got_chat_left(js->gc, chat->id);
588 } else {
589 title = g_strdup_printf(_("Error joining chat %s"), from);
590 purple_serv_got_join_chat_failed(js->gc, chat->components);
591 } 591 }
592 purple_notify_error(js->gc, title, title, msg); 592 purple_notify_error(js->gc, title, title, msg);
593 g_free(title); 593 g_free(title);
594 g_free(msg); 594 g_free(msg);
595 595
607 if(type && !strcmp(type, "unavailable")) { 607 if(type && !strcmp(type, "unavailable")) {
608 gboolean nick_change = FALSE; 608 gboolean nick_change = FALSE;
609 609
610 /* If we haven't joined the chat yet, we don't care that someone 610 /* If we haven't joined the chat yet, we don't care that someone
611 * left, or it was us leaving after we closed the chat */ 611 * left, or it was us leaving after we closed the chat */
612 if(!chat->conv) { 612 if (!chat->conv || chat->left) {
613 if(jid->resource && chat->handle && !strcmp(jid->resource, chat->handle)) 613 if (chat->left &&
614 jid->resource && chat->handle && !strcmp(jid->resource, chat->handle))
614 jabber_chat_destroy(chat); 615 jabber_chat_destroy(chat);
615 jabber_id_free(jid); 616 jabber_id_free(jid);
616 g_free(status); 617 g_free(status);
617 g_free(room_jid); 618 g_free(room_jid);
618 g_free(avatar_hash); 619 g_free(avatar_hash);