| 598 _("Create New Room"), |
598 _("Create New Room"), |
| 599 _("You are creating a new room. Would" |
599 _("You are creating a new room. Would" |
| 600 " you like to configure it, or" |
600 " you like to configure it, or" |
| 601 " accept the default settings?"), |
601 " accept the default settings?"), |
| 602 /* Default Action */ 1, |
602 /* Default Action */ 1, |
| 603 purple_connection_get_account(js->gc), NULL, chat->conv, |
603 purple_connection_get_account(js->gc), NULL, PURPLE_CONVERSATION(chat->conv), |
| 604 chat, 2, |
604 chat, 2, |
| 605 _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure), |
605 _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure), |
| 606 _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room)); |
606 _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room)); |
| 607 } |
607 } |
| 608 |
608 |
| 623 |
623 |
| 624 if(!chat->conv) { |
624 if(!chat->conv) { |
| 625 char *room_jid = g_strdup_printf("%s@%s", presence->jid_from->node, presence->jid_from->domain); |
625 char *room_jid = g_strdup_printf("%s@%s", presence->jid_from->node, presence->jid_from->domain); |
| 626 chat->id = i++; |
626 chat->id = i++; |
| 627 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); |
627 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); |
| 628 purple_chat_conversation_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle); |
628 purple_chat_conversation_set_nick(chat->conv, chat->handle); |
| 629 |
629 |
| 630 jabber_chat_disco_traffic(chat); |
630 jabber_chat_disco_traffic(chat); |
| 631 g_free(room_jid); |
631 g_free(room_jid); |
| 632 } |
632 } |
| 633 |
633 |
| 635 jbr->commands_fetched = TRUE; |
635 jbr->commands_fetched = TRUE; |
| 636 |
636 |
| 637 jabber_chat_track_handle(chat, presence->jid_from->resource, jid, affiliation, role); |
637 jabber_chat_track_handle(chat, presence->jid_from->resource, jid, affiliation, role); |
| 638 |
638 |
| 639 if(!jabber_chat_find_buddy(chat->conv, presence->jid_from->resource)) |
639 if(!jabber_chat_find_buddy(chat->conv, presence->jid_from->resource)) |
| 640 purple_chat_conversation_add_user(PURPLE_CONV_CHAT(chat->conv), presence->jid_from->resource, |
640 purple_chat_conversation_add_user(chat->conv, presence->jid_from->resource, |
| 641 jid, flags, chat->joined > 0 && ((!presence->delayed) || (presence->sent > chat->joined))); |
641 jid, flags, chat->joined > 0 && ((!presence->delayed) || (presence->sent > chat->joined))); |
| 642 else |
642 else |
| 643 purple_chat_conversation_user_set_flags(PURPLE_CONV_CHAT(chat->conv), presence->jid_from->resource, |
643 purple_chat_conversation_user_set_flags(chat->conv, presence->jid_from->resource, |
| 644 flags); |
644 flags); |
| 645 |
645 |
| 646 if (is_our_resource && chat->joined == 0) |
646 if (is_our_resource && chat->joined == 0) |
| 647 chat->joined = time(NULL); |
647 chat->joined = time(NULL); |
| 648 |
648 |
| 698 g_free(chat->handle); |
698 g_free(chat->handle); |
| 699 /* TODO: This should be resourceprep'd */ |
699 /* TODO: This should be resourceprep'd */ |
| 700 chat->handle = g_strdup(nick); |
700 chat->handle = g_strdup(nick); |
| 701 } |
701 } |
| 702 |
702 |
| 703 purple_chat_conversation_rename_user(PURPLE_CONV_CHAT(chat->conv), |
703 purple_chat_conversation_rename_user(chat->conv, |
| 704 presence->jid_from->resource, |
704 presence->jid_from->resource, |
| 705 nick); |
705 nick); |
| 706 jabber_chat_remove_handle(chat, |
706 jabber_chat_remove_handle(chat, |
| 707 presence->jid_from->resource); |
707 presence->jid_from->resource); |
| 708 } |
708 } |
| 781 } |
781 } |
| 782 |
782 |
| 783 if(!nick_change) { |
783 if(!nick_change) { |
| 784 if (is_our_resource) { |
784 if (is_our_resource) { |
| 785 if (kick) |
785 if (kick) |
| 786 purple_chat_conversation_write_message(PURPLE_CONV_CHAT(chat->conv), presence->jid_from->resource, |
786 purple_conversation_write_message(PURPLE_CONVERSATION(chat->conv), presence->jid_from->resource, |
| 787 presence->status, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
787 presence->status, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 788 |
788 |
| 789 serv_got_chat_left(js->gc, chat->id); |
789 serv_got_chat_left(js->gc, chat->id); |
| 790 jabber_chat_destroy(chat); |
790 jabber_chat_destroy(chat); |
| 791 } else { |
791 } else { |
| 792 purple_chat_conversation_remove_user(PURPLE_CONV_CHAT(chat->conv), presence->jid_from->resource, |
792 purple_chat_conversation_remove_user(chat->conv, presence->jid_from->resource, |
| 793 presence->status); |
793 presence->status); |
| 794 jabber_chat_remove_handle(chat, presence->jid_from->resource); |
794 jabber_chat_remove_handle(chat, presence->jid_from->resource); |
| 795 } |
795 } |
| 796 } |
796 } |
| 797 } |
797 } |
| 804 { |
804 { |
| 805 JabberBuddyResource *jbr; |
805 JabberBuddyResource *jbr; |
| 806 PurpleAccount *account; |
806 PurpleAccount *account; |
| 807 PurpleBuddy *b; |
807 PurpleBuddy *b; |
| 808 char *buddy_name; |
808 char *buddy_name; |
| 809 PurpleConversation *conv; |
809 PurpleIMConversation *im; |
| 810 |
810 |
| 811 buddy_name = jabber_id_get_bare_jid(presence->jid_from); |
811 buddy_name = jabber_id_get_bare_jid(presence->jid_from); |
| 812 |
812 |
| 813 account = purple_connection_get_account(js->gc); |
813 account = purple_connection_get_account(js->gc); |
| 814 b = purple_find_buddy(account, buddy_name); |
814 b = purple_find_buddy(account, buddy_name); |
| 816 /* |
816 /* |
| 817 * Unbind/unlock from sending messages to a specific resource on |
817 * Unbind/unlock from sending messages to a specific resource on |
| 818 * presence changes. This is locked to a specific resource when |
818 * presence changes. This is locked to a specific resource when |
| 819 * receiving a message (in message.c). |
819 * receiving a message (in message.c). |
| 820 */ |
820 */ |
| 821 conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, |
821 im = purple_conversations_find_im_with_account(buddy_name, account); |
| 822 buddy_name, account); |
822 if (im) { |
| 823 if (conv) { |
|
| 824 purple_debug_info("jabber", "Changed conversation binding from %s to %s\n", |
823 purple_debug_info("jabber", "Changed conversation binding from %s to %s\n", |
| 825 purple_conversation_get_name(conv), buddy_name); |
824 purple_conversation_get_name(PURPLE_CONVERSATION(im)), buddy_name); |
| 826 purple_conversation_set_name(conv, buddy_name); |
825 purple_conversation_set_name(PURPLE_CONVERSATION(im), buddy_name); |
| 827 } |
826 } |
| 828 |
827 |
| 829 if (b == NULL) { |
828 if (b == NULL) { |
| 830 if (presence->jb != js->user_jb) { |
829 if (presence->jb != js->user_jb) { |
| 831 purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n", |
830 purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n", |