Index: ChangeLog =================================================================== RCS file: /cvsroot/otr/gaim-otr/ChangeLog,v retrieving revision 1.13 retrieving revision 1.15 diff -u -r1.13 -r1.15 --- ChangeLog 2 Nov 2005 22:04:47 -0000 1.13 +++ ChangeLog 20 Jan 2006 15:22:06 -0000 1.15 @@ -1,3 +1,13 @@ +2006-01-20 + + * otr-plugin.c: Track the gaim-2 API changes. + +2005-12-18 + + * gtk-dialog.c: + * otr-plugin.c: Compile against either gaim-1.x or gaim-2.x, + based on a patch from Dustin Howett . + 2005-11-02 * INSTALL: Add instruction for doing autoreconf from CVS Index: gtk-dialog.c =================================================================== RCS file: /cvsroot/otr/gaim-otr/gtk-dialog.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- gtk-dialog.c 28 Oct 2005 03:38:21 -0000 1.9 +++ gtk-dialog.c 18 Dec 2005 18:33:48 -0000 1.10 @@ -26,7 +26,12 @@ #include /* gaim headers */ +#include "version.h" +#if GAIM_MAJOR_VERSION < 2 #include "stock.h" +#else +#include "gtkstock.h" +#endif #include "plugin.h" #include "notify.h" #include "gtkconv.h" @@ -779,7 +784,11 @@ account = gaim_accounts_find(accountname, protocol); if (!account) return -1; +#if GAIM_MAJOR_VERSION < 2 conv = gaim_find_conversation_with_account(username, account); +#else + conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); +#endif if (!conv) return -1; gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); @@ -908,7 +917,11 @@ GtkWidget *menuquerylabel; GtkWidget *menuview; GtkWidget *menuverf; +#if GAIM_MAJOR_VERSION < 2 + /* gaim-2.0.0 no longer has the row of buttons, so it doesn't have + * the button_type pref */ GaimButtonStyle buttonstyle; +#endif GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); label = gaim_conversation_get_data(conv, "otr-label"); icon = gaim_conversation_get_data(conv, "otr-icon"); @@ -919,7 +932,9 @@ menuend = gaim_conversation_get_data(conv, "otr-menuend"); menuview = gaim_conversation_get_data(conv, "otr-menuview"); menuverf = gaim_conversation_get_data(conv, "otr-menuverf"); +#if GAIM_MAJOR_VERSION < 2 buttonstyle = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); +#endif /* Set the button's icon, label and tooltip. */ otr_icon(icon, level); @@ -948,6 +963,7 @@ /* Set the appropriate visibility */ gtk_widget_show_all(button); +#if GAIM_MAJOR_VERSION < 2 if (buttonstyle == GAIM_BUTTON_IMAGE) { /* Hide the text */ gtk_widget_hide(icontext); @@ -958,6 +974,7 @@ gtk_widget_hide(icontext); gtk_widget_hide(icon); } +#endif } static void dialog_update_label(ConnContext *context) @@ -968,7 +985,11 @@ account = gaim_accounts_find(context->accountname, context->protocol); if (!account) return; +#if GAIM_MAJOR_VERSION < 2 conv = gaim_find_conversation_with_account(context->username, account); +#else + conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account); +#endif if (!conv) return; dialog_update_label_conv(conv, level); } @@ -1252,7 +1273,11 @@ account = gaim_accounts_find(accountname, protocol); if (!account) return; +#if GAIM_MAJOR_VERSION < 2 conv = gaim_find_conversation_with_account(username, account); +#else + conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); +#endif if (!conv) return; buf = g_strdup_printf("%s has ended his private conversation with you; " @@ -1406,9 +1431,13 @@ GtkWidget *whatsthis; /* Do nothing if this isn't an IM conversation */ +#if GAIM_MAJOR_VERSION < 2 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return; - bbox = gtkconv->bbox; +#else + if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; + bbox = gtkconv->lower_hbox; +#endif context = otrg_plugin_conv_to_context(conv); @@ -1515,7 +1544,11 @@ GtkWidget *button; /* Do nothing if this isn't an IM conversation */ +#if GAIM_MAJOR_VERSION < 2 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return; +#else + if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; +#endif button = gaim_conversation_get_data(conv, "otr-button"); if (button) gtk_object_destroy(GTK_OBJECT(button)); @@ -1531,7 +1564,11 @@ OtrlPolicy policy; /* Do nothing if this isn't an IM conversation */ +#if GAIM_MAJOR_VERSION < 2 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return; +#else + if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; +#endif account = gaim_conversation_get_account(conv); name = gaim_conversation_get_name(conv); Index: otr-plugin.c =================================================================== RCS file: /cvsroot/otr/gaim-otr/otr-plugin.c,v retrieving revision 1.10 retrieving revision 1.12 diff -u -r1.10 -r1.12 --- otr-plugin.c 27 Oct 2005 16:01:59 -0000 1.10 +++ otr-plugin.c 20 Jan 2006 15:22:06 -0000 1.12 @@ -32,11 +32,11 @@ /* gaim headers */ #include "gaim.h" -#include "core.h" #include "notify.h" #include "version.h" #include "util.h" #include "debug.h" +#include "core.h" #ifdef USING_GTK /* gaim GTK headers */ @@ -156,7 +156,11 @@ buddy = gaim_find_buddy(account, recipient); if (!buddy) return -1; +#if GAIM_MAJOR_VERSION < 2 return (buddy->present == GAIM_BUDDY_ONLINE); +#else + return (GAIM_BUDDY_IS_ONLINE(buddy)); +#endif } static void inject_message_cb(void *opdata, const char *accountname, @@ -395,6 +399,8 @@ otrg_dialog_resensitize_all(); } +#if GAIM_MAJOR_VERSION < 2 +/* gaim-2.0.0 no longer has the row of buttons in question */ static void process_button_type_change(const char *name, GaimPrefType type, gpointer value, gpointer data) { @@ -404,6 +410,7 @@ * buttons as well. */ otrg_dialog_resensitize_all(); } +#endif static void otr_options_cb(GaimBlistNode *node, gpointer user_data) { @@ -416,7 +423,11 @@ static void supply_extended_menu(GaimBlistNode *node, GList **menu) { +#if GAIM_MAJOR_VERSION < 2 GaimBlistNodeAction *act; +#else + GaimMenuAction *act; +#endif GaimBuddy *buddy; GaimAccount *acct; const char *proto; @@ -430,7 +441,12 @@ proto = gaim_account_get_protocol_id(acct); if (!otrg_plugin_proto_supports_otr(proto)) return; +#if GAIM_MAJOR_VERSION < 2 act = gaim_blist_node_action_new("OTR Settings", otr_options_cb, NULL); +#else + act = gaim_menu_action_new("OTR Settings", (GaimCallback)otr_options_cb, + NULL, NULL); +#endif *menu = g_list_append(*menu, act); } @@ -482,9 +498,17 @@ account = gaim_accounts_find(context->accountname, context->protocol); if (account == NULL) return NULL; +#if GAIM_MAJOR_VERSION < 2 conv = gaim_find_conversation_with_account(context->username, account); +#else + conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account); +#endif if (conv == NULL && force_create) { +#if GAIM_MAJOR_VERSION < 2 conv = gaim_conversation_new(GAIM_CONV_IM, account, context->username); +#else + conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, context->username); +#endif } return conv; @@ -523,7 +547,10 @@ } } +#if GAIM_MAJOR_VERSION < 2 +/* gaim-2.0.0 no longer has the row of buttons in question */ static guint button_type_cbid; +#endif static gboolean otr_plugin_load(GaimPlugin *handle) { @@ -567,9 +594,11 @@ GAIM_CALLBACK(process_connection_change), NULL); gaim_signal_connect(blist_handle, "blist-node-extended-menu", otrg_plugin_handle, GAIM_CALLBACK(supply_extended_menu), NULL); +#if GAIM_MAJOR_VERSION < 2 button_type_cbid = gaim_prefs_connect_callback( "/gaim/gtk/conversations/button_type", process_button_type_change, NULL); +#endif gaim_conversation_foreach(otrg_dialog_new_conv); @@ -601,7 +630,9 @@ GAIM_CALLBACK(process_connection_change)); gaim_signal_disconnect(blist_handle, "blist-node-extended-menu", otrg_plugin_handle, GAIM_CALLBACK(supply_extended_menu)); +#if GAIM_MAJOR_VERSION < 2 gaim_prefs_disconnect_callback(button_type_cbid); +#endif gaim_conversation_foreach(otrg_dialog_remove_conv); @@ -640,10 +671,16 @@ { GAIM_PLUGIN_MAGIC, +#if GAIM_MAJOR_VERSION < 2 /* We stick with the functions in the gaim 1.0.x API for * compatibility. */ - 1, /* major version */ + 1, /* major version */ 0, /* minor version */ +#else + /* Use the 2.0.x API */ + 2, /* major version */ + 0, /* minor version */ +#endif GAIM_PLUGIN_STANDARD, /* type */ PLUGIN_TYPE, /* ui_requirement */