Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 32790:3e7a7e14af62
Our API really shouldn't have a 'gc' in it anymore.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 24 Oct 2011 05:37:19 +0000 |
parents | fb2458f2326b |
children | b6276b10cb10 |
comparison
equal
deleted
inserted
replaced
32789:fb2458f2326b | 32790:3e7a7e14af62 |
---|---|
561 case PURPLE_CMD_STATUS_NOT_FOUND: | 561 case PURPLE_CMD_STATUS_NOT_FOUND: |
562 { | 562 { |
563 PurplePluginProtocolInfo *prpl_info = NULL; | 563 PurplePluginProtocolInfo *prpl_info = NULL; |
564 PurpleConnection *gc; | 564 PurpleConnection *gc; |
565 | 565 |
566 if ((gc = purple_conversation_get_gc(conv))) | 566 if ((gc = purple_conversation_get_connection(conv))) |
567 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 567 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
568 | 568 |
569 if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) { | 569 if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) { |
570 char *spaceslash; | 570 char *spaceslash; |
571 | 571 |
720 static void chat_do_info(PidginConversation *gtkconv, const char *who) | 720 static void chat_do_info(PidginConversation *gtkconv, const char *who) |
721 { | 721 { |
722 PurpleConversation *conv = gtkconv->active_conv; | 722 PurpleConversation *conv = gtkconv->active_conv; |
723 PurpleConnection *gc; | 723 PurpleConnection *gc; |
724 | 724 |
725 if ((gc = purple_conversation_get_gc(conv))) { | 725 if ((gc = purple_conversation_get_connection(conv))) { |
726 pidgin_retrieve_user_info_in_chat(gc, who, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); | 726 pidgin_retrieve_user_info_in_chat(gc, who, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 | 730 |
732 info_cb(GtkWidget *widget, PidginConversation *gtkconv) | 732 info_cb(GtkWidget *widget, PidginConversation *gtkconv) |
733 { | 733 { |
734 PurpleConversation *conv = gtkconv->active_conv; | 734 PurpleConversation *conv = gtkconv->active_conv; |
735 | 735 |
736 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | 736 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
737 pidgin_retrieve_user_info(purple_conversation_get_gc(conv), | 737 pidgin_retrieve_user_info(purple_conversation_get_connection(conv), |
738 purple_conversation_get_name(conv)); | 738 purple_conversation_get_name(conv)); |
739 gtk_widget_grab_focus(gtkconv->entry); | 739 gtk_widget_grab_focus(gtkconv->entry); |
740 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | 740 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
741 /* Get info of the person currently selected in the GtkTreeView */ | 741 /* Get info of the person currently selected in the GtkTreeView */ |
742 PidginChatPane *gtkchat; | 742 PidginChatPane *gtkchat; |
820 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | 820 message = gtk_entry_get_text(GTK_ENTRY(info->message)); |
821 | 821 |
822 if (!g_ascii_strcasecmp(buddy, "")) | 822 if (!g_ascii_strcasecmp(buddy, "")) |
823 return; | 823 return; |
824 | 824 |
825 serv_chat_invite(purple_conversation_get_gc(conv), | 825 serv_chat_invite(purple_conversation_get_connection(conv), |
826 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), | 826 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), |
827 message, buddy); | 827 message, buddy); |
828 } | 828 } |
829 | 829 |
830 gtk_widget_destroy(invite_dialog); | 830 gtk_widget_destroy(invite_dialog); |
1214 { | 1214 { |
1215 PidginWindow *win = data; | 1215 PidginWindow *win = data; |
1216 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); | 1216 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
1217 | 1217 |
1218 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | 1218 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
1219 serv_send_file(purple_conversation_get_gc(conv), purple_conversation_get_name(conv), NULL); | 1219 serv_send_file(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), NULL); |
1220 } | 1220 } |
1221 | 1221 |
1222 } | 1222 } |
1223 | 1223 |
1224 static void | 1224 static void |
1231 int index; | 1231 int index; |
1232 if (widget == win->menu.get_attention) | 1232 if (widget == win->menu.get_attention) |
1233 index = 0; | 1233 index = 0; |
1234 else | 1234 else |
1235 index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "index")); | 1235 index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "index")); |
1236 purple_prpl_send_attention(purple_conversation_get_gc(conv), | 1236 purple_prpl_send_attention(purple_conversation_get_connection(conv), |
1237 purple_conversation_get_name(conv), index); | 1237 purple_conversation_get_name(conv), index); |
1238 } | 1238 } |
1239 } | 1239 } |
1240 | 1240 |
1241 static void | 1241 static void |
1566 menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) | 1566 menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) |
1567 { | 1567 { |
1568 PurplePluginProtocolInfo *prpl_info; | 1568 PurplePluginProtocolInfo *prpl_info; |
1569 PurpleConversation *conv = gtkconv->active_conv; | 1569 PurpleConversation *conv = gtkconv->active_conv; |
1570 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | 1570 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); |
1571 PurpleConnection *gc = purple_conversation_get_gc(conv); | 1571 PurpleConnection *gc = purple_conversation_get_connection(conv); |
1572 gchar *real_who = NULL; | 1572 gchar *real_who = NULL; |
1573 | 1573 |
1574 g_return_if_fail(gc != NULL); | 1574 g_return_if_fail(gc != NULL); |
1575 | 1575 |
1576 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 1576 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
2441 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | 2441 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { |
2442 | 2442 |
2443 /* We deleted all the text, so turn off typing. */ | 2443 /* We deleted all the text, so turn off typing. */ |
2444 purple_conv_im_stop_send_typed_timeout(im); | 2444 purple_conv_im_stop_send_typed_timeout(im); |
2445 | 2445 |
2446 serv_send_typing(purple_conversation_get_gc(conv), | 2446 serv_send_typing(purple_conversation_get_connection(conv), |
2447 purple_conversation_get_name(conv), | 2447 purple_conversation_get_name(conv), |
2448 PURPLE_NOT_TYPING); | 2448 PURPLE_NOT_TYPING); |
2449 } | 2449 } |
2450 else { | 2450 else { |
2451 /* We're deleting, but not all of it, so it counts as typing. */ | 2451 /* We're deleting, but not all of it, so it counts as typing. */ |
3394 return; | 3394 return; |
3395 | 3395 |
3396 /* Remove the previous entries */ | 3396 /* Remove the previous entries */ |
3397 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), NULL); | 3397 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), NULL); |
3398 | 3398 |
3399 pc = purple_conversation_get_gc(conv); | 3399 pc = purple_conversation_get_connection(conv); |
3400 if (pc != NULL) | 3400 if (pc != NULL) |
3401 prpl = purple_connection_get_prpl(pc); | 3401 prpl = purple_connection_get_prpl(pc); |
3402 if (prpl != NULL) | 3402 if (prpl != NULL) |
3403 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 3403 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
3404 | 3404 |
3704 /* Check if we need to send another PURPLE_TYPING message */ | 3704 /* Check if we need to send another PURPLE_TYPING message */ |
3705 if (first || (purple_conv_im_get_type_again(im) != 0 && | 3705 if (first || (purple_conv_im_get_type_again(im) != 0 && |
3706 time(NULL) > purple_conv_im_get_type_again(im))) | 3706 time(NULL) > purple_conv_im_get_type_again(im))) |
3707 { | 3707 { |
3708 unsigned int timeout; | 3708 unsigned int timeout; |
3709 timeout = serv_send_typing(purple_conversation_get_gc(conv), | 3709 timeout = serv_send_typing(purple_conversation_get_connection(conv), |
3710 purple_conversation_get_name(conv), | 3710 purple_conversation_get_name(conv), |
3711 PURPLE_TYPING); | 3711 PURPLE_TYPING); |
3712 purple_conv_im_set_type_again(im, timeout); | 3712 purple_conv_im_set_type_again(im, timeout); |
3713 } | 3713 } |
3714 } | 3714 } |
4126 flags = purple_conv_chat_cb_get_flags(cb); | 4126 flags = purple_conv_chat_cb_get_flags(cb); |
4127 | 4127 |
4128 chat = PURPLE_CONV_CHAT(conv); | 4128 chat = PURPLE_CONV_CHAT(conv); |
4129 gtkconv = PIDGIN_CONVERSATION(conv); | 4129 gtkconv = PIDGIN_CONVERSATION(conv); |
4130 gtkchat = gtkconv->u.chat; | 4130 gtkchat = gtkconv->u.chat; |
4131 gc = purple_conversation_get_gc(conv); | 4131 gc = purple_conversation_get_connection(conv); |
4132 | 4132 |
4133 if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) | 4133 if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) |
4134 return; | 4134 return; |
4135 | 4135 |
4136 tm = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 4136 tm = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4436 PurpleConversation *conv = gtkconv->active_conv; | 4436 PurpleConversation *conv = gtkconv->active_conv; |
4437 PidginChatPane *gtkchat; | 4437 PidginChatPane *gtkchat; |
4438 char *new_topic; | 4438 char *new_topic; |
4439 const char *current_topic; | 4439 const char *current_topic; |
4440 | 4440 |
4441 gc = purple_conversation_get_gc(conv); | 4441 gc = purple_conversation_get_connection(conv); |
4442 | 4442 |
4443 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) | 4443 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) |
4444 return; | 4444 return; |
4445 | 4445 |
4446 if(prpl_info->set_chat_topic == NULL) | 4446 if(prpl_info->set_chat_topic == NULL) |
4579 PurplePluginProtocolInfo *prpl_info; | 4579 PurplePluginProtocolInfo *prpl_info; |
4580 | 4580 |
4581 g_return_if_fail(node != NULL); | 4581 g_return_if_fail(node != NULL); |
4582 g_return_if_fail(conv != NULL); | 4582 g_return_if_fail(conv != NULL); |
4583 | 4583 |
4584 gc = purple_conversation_get_gc(conv); | 4584 gc = purple_conversation_get_connection(conv); |
4585 g_return_if_fail(gc != NULL); | 4585 g_return_if_fail(gc != NULL); |
4586 g_return_if_fail(purple_connection_get_prpl(gc) != NULL); | 4586 g_return_if_fail(purple_connection_get_prpl(gc) != NULL); |
4587 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 4587 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
4588 | 4588 |
4589 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) | 4589 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) |
4789 | 4789 |
4790 static void | 4790 static void |
4791 setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) | 4791 setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) |
4792 { | 4792 { |
4793 PurpleConversation *conv = gtkconv->active_conv; | 4793 PurpleConversation *conv = gtkconv->active_conv; |
4794 PurpleConnection *gc = purple_conversation_get_gc(conv); | 4794 PurpleConnection *gc = purple_conversation_get_connection(conv); |
4795 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 4795 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
4796 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) | 4796 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4797 { | 4797 { |
4798 GtkWidget *hbox, *label; | 4798 GtkWidget *hbox, *label; |
4799 PidginChatPane *gtkchat = gtkconv->u.chat; | 4799 PidginChatPane *gtkchat = gtkconv->u.chat; |
5977 if (!gtk_text_buffer_get_selection_bounds( | 5977 if (!gtk_text_buffer_get_selection_bounds( |
5978 gtk_text_iter_get_buffer(arg2), | 5978 gtk_text_iter_get_buffer(arg2), |
5979 &start, &end)) { | 5979 &start, &end)) { |
5980 GtkWidget *menu = NULL; | 5980 GtkWidget *menu = NULL; |
5981 PurpleConnection *gc = | 5981 PurpleConnection *gc = |
5982 purple_conversation_get_gc(conv); | 5982 purple_conversation_get_connection(conv); |
5983 | 5983 |
5984 | 5984 |
5985 menu = create_chat_menu(conv, buddyname, gc); | 5985 menu = create_chat_menu(conv, buddyname, gc); |
5986 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, | 5986 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
5987 NULL, GTK_WIDGET(imhtml), | 5987 NULL, GTK_WIDGET(imhtml), |
6920 GdkPixbuf *window_icon = NULL; | 6920 GdkPixbuf *window_icon = NULL; |
6921 GtkIMHtmlButtons buttons; | 6921 GtkIMHtmlButtons buttons; |
6922 PurpleAccount *account; | 6922 PurpleAccount *account; |
6923 | 6923 |
6924 win = pidgin_conv_get_window(gtkconv); | 6924 win = pidgin_conv_get_window(gtkconv); |
6925 gc = purple_conversation_get_gc(conv); | 6925 gc = purple_conversation_get_connection(conv); |
6926 account = purple_conversation_get_account(conv); | 6926 account = purple_conversation_get_account(conv); |
6927 | 6927 |
6928 if (gc != NULL) | 6928 if (gc != NULL) |
6929 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 6929 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
6930 | 6930 |
7455 gtkconv->u.im->iter = NULL; | 7455 gtkconv->u.im->iter = NULL; |
7456 | 7456 |
7457 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons")) | 7457 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons")) |
7458 return; | 7458 return; |
7459 | 7459 |
7460 if (purple_conversation_get_gc(conv) == NULL) | 7460 if (purple_conversation_get_connection(conv) == NULL) |
7461 return; | 7461 return; |
7462 | 7462 |
7463 buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); | 7463 buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); |
7464 if (buddy) | 7464 if (buddy) |
7465 { | 7465 { |
9500 text = purple_buddy_get_contact_alias(buddy); | 9500 text = purple_buddy_get_contact_alias(buddy); |
9501 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | 9501 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
9502 PurpleConnection *gc; | 9502 PurpleConnection *gc; |
9503 PurplePluginProtocolInfo *prpl_info = NULL; | 9503 PurplePluginProtocolInfo *prpl_info = NULL; |
9504 | 9504 |
9505 gc = purple_conversation_get_gc(conv); | 9505 gc = purple_conversation_get_connection(conv); |
9506 if (gc != NULL) | 9506 if (gc != NULL) |
9507 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 9507 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
9508 if (prpl_info && prpl_info->set_chat_topic == NULL) | 9508 if (prpl_info && prpl_info->set_chat_topic == NULL) |
9509 /* This protocol doesn't support setting the chat room topic */ | 9509 /* This protocol doesn't support setting the chat room topic */ |
9510 return FALSE; | 9510 return FALSE; |