pidgin/gtkconv.c

changeset 39688
2b1c2b6e9993
parent 39687
8358d4cc1480
child 39689
ce7c988b024c
equal deleted inserted replaced
39687:8358d4cc1480 39688:2b1c2b6e9993
293 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width); 293 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width);
294 294
295 return FALSE; 295 return FALSE;
296 } 296 }
297 297
298 static void
299 default_formatize(PidginConversation *c)
300 {
301 PurpleConversation *conv = c->active_conv;
302 pidgin_webview_setup_entry(PIDGIN_WEBVIEW(c->entry), purple_conversation_get_features(conv));
303 }
304
305 static const char * 298 static const char *
306 pidgin_get_cmd_prefix(void) 299 pidgin_get_cmd_prefix(void)
307 { 300 {
308 return "/"; 301 return "/";
309 } 302 }
503 496
504 if (cmd && purple_str_has_prefix(cmd, prefix)) { 497 if (cmd && purple_str_has_prefix(cmd, prefix)) {
505 PurpleCmdStatus status; 498 PurpleCmdStatus status;
506 char *error, *cmdline, *markup, *send_history; 499 char *error, *cmdline, *markup, *send_history;
507 500
508 send_history = pidgin_webview_get_body_html(PIDGIN_WEBVIEW(gtkconv->entry)); 501 send_history = talkatu_markup_get_html(buffer, NULL);
509 send_history_add(gtkconv, send_history); 502 send_history_add(gtkconv, send_history);
510 g_free(send_history); 503 g_free(send_history);
511 504
512 cmdline = cmd + strlen(prefix); 505 cmdline = cmd + strlen(prefix);
513 506
662 if (c != NULL) 655 if (c != NULL)
663 pidgin_dialogs_remove_chat(c); 656 pidgin_dialogs_remove_chat(c);
664 else if (account != NULL && purple_account_is_connected(account)) 657 else if (account != NULL && purple_account_is_connected(account))
665 purple_blist_request_add_chat(account, NULL, NULL, name); 658 purple_blist_request_add_chat(account, NULL, NULL, name);
666 } 659 }
667
668 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
669 } 660 }
670 661
671 static void chat_do_info(PidginConversation *gtkconv, const char *who) 662 static void chat_do_info(PidginConversation *gtkconv, const char *who)
672 { 663 {
673 PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(gtkconv->active_conv); 664 PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(gtkconv->active_conv);
685 PurpleConversation *conv = gtkconv->active_conv; 676 PurpleConversation *conv = gtkconv->active_conv;
686 677
687 if (PURPLE_IS_IM_CONVERSATION(conv)) { 678 if (PURPLE_IS_IM_CONVERSATION(conv)) {
688 pidgin_retrieve_user_info(purple_conversation_get_connection(conv), 679 pidgin_retrieve_user_info(purple_conversation_get_connection(conv),
689 purple_conversation_get_name(conv)); 680 purple_conversation_get_name(conv));
690 gtk_widget_grab_focus(gtkconv->entry);
691 } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) { 681 } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
692 /* Get info of the person currently selected in the GtkTreeView */ 682 /* Get info of the person currently selected in the GtkTreeView */
693 PidginChatPane *gtkchat; 683 PidginChatPane *gtkchat;
694 GtkTreeIter iter; 684 GtkTreeIter iter;
695 GtkTreeModel *model; 685 GtkTreeModel *model;
719 709
720 account = purple_conversation_get_account(conv); 710 account = purple_conversation_get_account(conv);
721 711
722 if (account != NULL && purple_account_is_connected(account)) 712 if (account != NULL && purple_account_is_connected(account))
723 pidgin_request_add_block(account, purple_conversation_get_name(conv)); 713 pidgin_request_add_block(account, purple_conversation_get_name(conv));
724
725 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
726 } 714 }
727 715
728 static void 716 static void
729 unblock_cb(GtkWidget *widget, PidginConversation *gtkconv) 717 unblock_cb(GtkWidget *widget, PidginConversation *gtkconv)
730 { 718 {
733 721
734 account = purple_conversation_get_account(conv); 722 account = purple_conversation_get_account(conv);
735 723
736 if (account != NULL && purple_account_is_connected(account)) 724 if (account != NULL && purple_account_is_connected(account))
737 pidgin_request_add_permit(account, purple_conversation_get_name(conv)); 725 pidgin_request_add_permit(account, purple_conversation_get_name(conv));
738
739 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
740 } 726 }
741 727
742 static void 728 static void
743 do_invite(GtkWidget *w, int resp, gpointer data) 729 do_invite(GtkWidget *w, int resp, gpointer data)
744 { 730 {
1939 #if 0 1925 #if 0
1940 /* TODO WebKit: maybe not necessary? */ 1926 /* TODO WebKit: maybe not necessary? */
1941 gtk_text_buffer_get_end_iter(buffer, &iter); 1927 gtk_text_buffer_get_end_iter(buffer, &iter);
1942 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); 1928 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter);
1943 #endif 1929 #endif
1944 } else {
1945 /* Restore the default formatting */
1946 default_formatize(gtkconv);
1947 } 1930 }
1948 } 1931 }
1949 1932
1950 return TRUE; 1933 return TRUE;
1951 break; 1934 break;
2912 { "Alias", NULL, N_("Al_ias..."), NULL, NULL, G_CALLBACK(menu_alias_cb) }, 2895 { "Alias", NULL, N_("Al_ias..."), NULL, NULL, G_CALLBACK(menu_alias_cb) },
2913 { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, G_CALLBACK(menu_block_cb) }, 2896 { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, G_CALLBACK(menu_block_cb) },
2914 { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, G_CALLBACK(menu_unblock_cb) }, 2897 { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, G_CALLBACK(menu_unblock_cb) },
2915 { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, 2898 { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) },
2916 { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, 2899 { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) },
2917 { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, G_CALLBACK(menu_insert_link_cb) }, 2900 { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, NULL },
2918 { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, G_CALLBACK(menu_insert_image_cb) }, 2901 { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, NULL },
2919 { "Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W", NULL, G_CALLBACK(menu_close_conv_cb) }, 2902 { "Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W", NULL, G_CALLBACK(menu_close_conv_cb) },
2920 2903
2921 /* Options */ 2904 /* Options */
2922 { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL }, 2905 { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL },
2923 }; 2906 };

mercurial