Mercurial > pidgin
diff src/gtkconv.c @ 5205:fefad67de2c7
[gaim-migrate @ 5573]
I had a damn good commit message, but it was eaten. Let's try it again.
Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short.
There are lots'a cool thingies here.
Okay now, this isn't as cool as the previous message, but:
1) There's now a single entry function for all plugin types. It returns a
detailed information structure on the plugin. This removes a lot of the
ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so
if you use it, well, you shouldn't have used it anyway, but now you
can't! bwahahaha. Use AIM/ICQ.
2) There are now 3 types of plugins: Standard, Loader, and Protocol
plugins.
Standard plugins are, well, standard, compiled plugins.
Loader plugins load other plugins. For example, the perl support is now
a loader plugin. It loads perl scripts. In the future, we'll have
Ruby and Python loader plugins.
Protocol plugins are, well, protocol plugins... yeah...
3) Plugins have unique IDs, so they can be referred to or automatically
updated from a plugin database in the future. Neat, huh?
4) Plugins will have dependency support in the future, and can be hidden,
so if you have, say, a logging core plugin, it won't have to show up,
but then you load the GTK+ logging plugin and it'll auto-load the core
plugin. Core/UI split plugins!
5) There will eventually be custom plugin signals and RPC of some sort, for
the core/ui split plugins.
So, okay, back up .gaimrc.
I'd like to thank my parents for their support, javabsp for helping convert
a bunch of protocol plugins, and Etan for helping convert a bunch of
standard plugins.
Have fun. If you have any problems, please let me know, but you probably
won't have anything major happen. You will have to convert your plugins,
though, and I'm not guaranteeing that all perl scripts will still work.
I'll end up changing the perl script API eventually, so I know they won't
down the road. Don't worry, though. It'll be mass cool.
faceprint wants me to just commit the damn code already. So, here we go!!!
..
..
I need a massage. From a young, cute girl. Are there any young, cute girls
in the audience? IM me plz k thx.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Fri, 25 Apr 2003 06:47:33 +0000 |
| parents | 44de70702205 |
| children | 0241d6b6702d |
line wrap: on
line diff
--- a/src/gtkconv.c Thu Apr 24 03:52:25 2003 +0000 +++ b/src/gtkconv.c Fri Apr 25 06:47:33 2003 +0000 @@ -635,6 +635,7 @@ static void menu_info_cb(GtkWidget *w, struct gaim_conversation *conv) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_connection *gc; char *who; @@ -642,20 +643,23 @@ who = g_object_get_data(G_OBJECT(w), "user_data"); if (gc != NULL) { + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + /* * If there are special needs for getting info on users in * buddy chat "rooms"... */ - if (gc->prpl->get_cb_info != NULL) - gc->prpl->get_cb_info(gc, gaim_chat_get_id(GAIM_CHAT(conv)), who); + if (prpl_info->get_cb_info != NULL) + prpl_info->get_cb_info(gc, gaim_chat_get_id(GAIM_CHAT(conv)), who); else - gc->prpl->get_info(gc, who); + prpl_info->get_info(gc, who); } } static void menu_away_cb(GtkWidget *w, struct gaim_conversation *conv) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_connection *gc; char *who; @@ -663,12 +667,14 @@ who = g_object_get_data(G_OBJECT(w), "user_data"); if (gc != NULL) { + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + /* * May want to expand this to work similarly to menu_info_cb? */ - if (gc->prpl->get_cb_away != NULL) - gc->prpl->get_cb_away(gc, gaim_chat_get_id(GAIM_CHAT(conv)), who); + if (prpl_info->get_cb_away != NULL) + prpl_info->get_cb_away(gc, gaim_chat_get_id(GAIM_CHAT(conv)), who); } } @@ -695,6 +701,7 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, struct gaim_conversation *conv) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_gtk_conversation *gtkconv; struct gaim_gtk_chat_pane *gtkchat; struct gaim_connection *gc; @@ -719,6 +726,9 @@ if (path == NULL) return FALSE; + if (gc != NULL) + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + gtk_tree_selection_select_path(GTK_TREE_SELECTION( gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); @@ -769,7 +779,7 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); gtk_widget_show(button); - if (gc && gc->prpl->get_info) { + if (gc && prpl_info->get_info) { button = gtk_menu_item_new_with_label(_("Info")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(menu_info_cb), conv); @@ -778,7 +788,7 @@ gtk_widget_show(button); } - if (gc && gc->prpl->get_cb_away) { + if (gc && prpl_info->get_cb_away) { button = gtk_menu_item_new_with_label(_("Get Away Msg")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(menu_away_cb), conv); @@ -1715,6 +1725,7 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer user_data) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_window *win; struct gaim_conversation *conv; struct gaim_gtk_conversation *gtkconv; @@ -1736,13 +1747,14 @@ if (gc != NULL) { gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); } /* Update the menubar */ if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); gtk_widget_set_sensitive(gtkwin->menu.insert_image, - (gc && gc->prpl->options & OPT_PROTO_IM_IMAGE)); + (gc && prpl_info->options & OPT_PROTO_IM_IMAGE)); if (gtkwin->menu.send_as != NULL) g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); @@ -2922,6 +2934,7 @@ static GtkWidget * setup_chat_pane(struct gaim_conversation *conv) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_gtk_conversation *gtkconv; struct gaim_gtk_chat_pane *gtkchat; struct gaim_connection *gc; @@ -2950,7 +2963,10 @@ gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); gtk_widget_show(vbox); - if (gc->prpl->options & OPT_PROTO_CHAT_TOPIC) + if (gc != NULL) + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + + if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) { hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); @@ -3746,6 +3762,7 @@ static void update_convo_add_button(struct gaim_conversation *conv) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_gtk_conversation *gtkconv; struct gaim_connection *gc; GaimConversationType type; @@ -3756,6 +3773,8 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); parent = gtk_widget_get_parent(gtkconv->u.im->add); + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + if (gaim_find_buddy(gc->account, gaim_conversation_get_name(conv))) { gtkconv->u.im->add = gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, @@ -3764,7 +3783,7 @@ _("Remove the user from your buddy list"), NULL); gtk_widget_set_sensitive(gtkconv->u.im->add, - (gc != NULL && gc->prpl->remove_buddy != NULL)); + (gc != NULL && prpl_info->remove_buddy != NULL)); } else { gtkconv->u.im->add = gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, @@ -3773,7 +3792,7 @@ _("Add the user to your buddy list"), NULL); gtk_widget_set_sensitive(gtkconv->u.im->add, - (gc != NULL && gc->prpl->add_buddy != NULL)); + (gc != NULL && prpl_info->add_buddy != NULL)); } g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", @@ -3927,7 +3946,7 @@ strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); if(gc) - sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->name); + sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; @@ -5039,6 +5058,7 @@ void gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv) { + GaimPluginProtocolInfo *prpl_info = NULL; struct gaim_window *win; struct gaim_gtk_window *gtkwin = NULL; struct gaim_gtk_conversation *gtkconv; @@ -5062,6 +5082,8 @@ } } else { + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + gtk_widget_set_sensitive(gtkconv->send, TRUE); if (win != NULL) { gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); @@ -5085,21 +5107,21 @@ } gtk_widget_set_sensitive(gtkconv->info, - (gc->prpl->get_info != NULL)); + (prpl_info->get_info != NULL)); gtk_widget_set_sensitive(gtkconv->toolbar.image, - (gc->prpl->options & OPT_PROTO_IM_IMAGE)); + (prpl_info->options & OPT_PROTO_IM_IMAGE)); if (win != NULL && gaim_window_get_active_conversation(win) == conv) { gtk_widget_set_sensitive(gtkwin->menu.insert_image, - (gc->prpl->options & OPT_PROTO_IM_IMAGE)); + (prpl_info->options & OPT_PROTO_IM_IMAGE)); } gtk_widget_set_sensitive(gtkconv->u.im->warn, - (gc->prpl->warn != NULL)); + (prpl_info->warn != NULL)); gtk_widget_set_sensitive(gtkconv->u.im->block, - (gc->prpl->add_permit != NULL)); + (prpl_info->add_permit != NULL)); update_convo_add_button(conv); } @@ -5111,16 +5133,16 @@ return; } - gtk_widget_set_sensitive(gtkconv->send, (gc->prpl->chat_send != NULL)); + gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); /* gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); */ gtk_widget_set_sensitive(gtkconv->u.chat->whisper, - (gc->prpl->chat_whisper != NULL)); + (prpl_info->chat_whisper != NULL)); gtk_widget_set_sensitive(gtkconv->u.chat->invite, - (gc->prpl->chat_invite != NULL)); + (prpl_info->chat_invite != NULL)); } }
