diff -ur gaim-otr.gaim/configure.ac gaim-otr.pidgin/configure.ac --- gaim-otr.gaim/configure.ac 2005-11-02 22:04:47.000000000 +0000 +++ gaim-otr.pidgin/configure.ac 2007-05-11 18:32:08.000000000 +0100 @@ -19,6 +19,6 @@ AM_PATH_LIBOTR(3.0.0,,AC_MSG_ERROR(libotr 3.0.0 or newer is required.)) -PKG_CHECK_MODULES(EXTRA, glib-2.0 >= 2.4 gtk+-2.0 >= 2.4 gaim >= 1.0, , AC_MSG_ERROR(glib, gtk and gaim required)) +PKG_CHECK_MODULES(EXTRA, glib-2.0 >= 2.4 gtk+-2.0 >= 2.4 pidgin >= 2.0, , AC_MSG_ERROR(glib, gtk and pidgin required)) AC_OUTPUT([Makefile]) diff -ur gaim-otr.gaim/dialogs.c gaim-otr.pidgin/dialogs.c --- gaim-otr.gaim/dialogs.c 2005-10-19 18:26:53.000000000 +0100 +++ gaim-otr.pidgin/dialogs.c 2007-05-11 18:32:08.000000000 +0100 @@ -49,10 +49,10 @@ return ui_ops; } -/* This is just like gaim_notify_message, except: (a) it doesn't grab +/* This is just like purple_notify_message, except: (a) it doesn't grab * keyboard focus, (b) the button is "OK" instead of "Close", and (c) * the labels aren't limited to 2K. */ -void otrg_dialog_notify_message(GaimNotifyMsgType type, +void otrg_dialog_notify_message(PurpleNotifyMsgType type, const char *accountname, const char *protocol, const char *username, const char *title, const char *primary, const char *secondary) { @@ -65,7 +65,7 @@ const char *username, const char *title, const char *primary, const char *secondary) { - otrg_dialog_notify_message(GAIM_NOTIFY_MSG_ERROR, accountname, + otrg_dialog_notify_message(PURPLE_NOTIFY_MSG_ERROR, accountname, protocol, username, title, primary, secondary); } @@ -74,7 +74,7 @@ const char *username, const char *title, const char *primary, const char *secondary) { - otrg_dialog_notify_message(GAIM_NOTIFY_MSG_WARNING, accountname, + otrg_dialog_notify_message(PURPLE_NOTIFY_MSG_WARNING, accountname, protocol, username, title, primary, secondary); } @@ -83,7 +83,7 @@ const char *username, const char *title, const char *primary, const char *secondary) { - otrg_dialog_notify_message(GAIM_NOTIFY_MSG_INFO, accountname, + otrg_dialog_notify_message(PURPLE_NOTIFY_MSG_INFO, accountname, protocol, username, title, primary, secondary); } @@ -160,13 +160,13 @@ } /* Set up the per-conversation information display */ -void otrg_dialog_new_conv(GaimConversation *conv) +void otrg_dialog_new_conv(PurpleConversation *conv) { ui_ops->new_conv(conv); } /* Remove the per-conversation information display */ -void otrg_dialog_remove_conv(GaimConversation *conv) +void otrg_dialog_remove_conv(PurpleConversation *conv) { ui_ops->remove_conv(conv); } diff -ur gaim-otr.gaim/dialogs.h gaim-otr.pidgin/dialogs.h --- gaim-otr.gaim/dialogs.h 2005-10-19 18:26:53.000000000 +0100 +++ gaim-otr.pidgin/dialogs.h 2007-05-11 18:32:08.000000000 +0100 @@ -37,7 +37,7 @@ typedef struct s_OtrgDialogWait *OtrgDialogWaitHandle; typedef struct { - void (*notify_message)(GaimNotifyMsgType type, + void (*notify_message)(PurpleNotifyMsgType type, const char *accountname, const char *protocol, const char *username, const char *title, const char *primary, const char *secondary); @@ -65,9 +65,9 @@ void (*resensitize_all)(void); - void (*new_conv)(GaimConversation *conv); + void (*new_conv)(PurpleConversation *conv); - void (*remove_conv)(GaimConversation *conv); + void (*remove_conv)(PurpleConversation *conv); } OtrgDialogUiOps; /* Set the UI ops */ @@ -76,10 +76,10 @@ /* Get the UI ops */ const OtrgDialogUiOps *otrg_dialog_get_ui_ops(void); -/* This is just like gaim_notify_message, except: (a) it doesn't grab +/* This is just like purple_notify_message, except: (a) it doesn't grab * keyboard focus, (b) the button is "OK" instead of "Close", and (c) * the labels aren't limited to 2K. */ -void otrg_dialog_notify_message(GaimNotifyMsgType type, +void otrg_dialog_notify_message(PurpleNotifyMsgType type, const char *accountname, const char *protocol, const char *username, const char *title, const char *primary, const char *secondary); @@ -141,9 +141,9 @@ void otrg_dialog_resensitize_all(void); /* Set up the per-conversation information display */ -void otrg_dialog_new_conv(GaimConversation *conv); +void otrg_dialog_new_conv(PurpleConversation *conv); /* Remove the per-conversation information display */ -void otrg_dialog_remove_conv(GaimConversation *conv); +void otrg_dialog_remove_conv(PurpleConversation *conv); #endif diff -ur gaim-otr.gaim/gtk-dialog.c gaim-otr.pidgin/gtk-dialog.c --- gaim-otr.gaim/gtk-dialog.c 2005-12-18 18:33:48.000000000 +0000 +++ gaim-otr.pidgin/gtk-dialog.c 2007-05-11 18:40:03.000000000 +0100 @@ -27,10 +27,10 @@ /* gaim headers */ #include "version.h" -#if GAIM_MAJOR_VERSION < 2 +#if PURPLE_MAJOR_VERSION < 2 #include "stock.h" #else -#include "gtkstock.h" +#include "pidginstock.h" #endif #include "plugin.h" #include "notify.h" @@ -633,7 +633,7 @@ gtk_widget_destroy(GTK_WIDGET(widget)); } -static GtkWidget *create_dialog(GaimNotifyMsgType type, const char *title, +static GtkWidget *create_dialog(PurpleNotifyMsgType type, const char *title, const char *primary, const char *secondary, int sensitive, GtkWidget **labelp, void (*add_custom)(GtkWidget *vbox, void *data), void *add_custom_data) @@ -647,16 +647,16 @@ const char *icon_name = NULL; switch (type) { - case GAIM_NOTIFY_MSG_ERROR: - icon_name = GAIM_STOCK_DIALOG_ERROR; + case PURPLE_NOTIFY_MSG_ERROR: + icon_name = PIDGIN_STOCK_DIALOG_ERROR; break; - case GAIM_NOTIFY_MSG_WARNING: - icon_name = GAIM_STOCK_DIALOG_WARNING; + case PURPLE_NOTIFY_MSG_WARNING: + icon_name = PIDGIN_STOCK_DIALOG_WARNING; break; - case GAIM_NOTIFY_MSG_INFO: - icon_name = GAIM_STOCK_DIALOG_INFO; + case PURPLE_NOTIFY_MSG_INFO: + icon_name = PIDGIN_STOCK_DIALOG_INFO; break; default: @@ -669,7 +669,7 @@ gtk_misc_set_alignment(GTK_MISC(img), 0, 0); } - dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE, + dialog = gtk_dialog_new_with_buttons(title ? title : "Pidgin", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT, @@ -720,10 +720,10 @@ return dialog; } -/* This is just like gaim_notify_message, except: (a) it doesn't grab +/* This is just like purple_notify_message, except: (a) it doesn't grab * keyboard focus, (b) the button is "OK" instead of "Close", and (c) * the labels aren't limited to 2K. */ -static void otrg_gtk_dialog_notify_message(GaimNotifyMsgType type, +static void otrg_gtk_dialog_notify_message(PurpleNotifyMsgType type, const char *accountname, const char *protocol, const char *username, const char *title, const char *primary, const char *secondary) { @@ -741,7 +741,7 @@ static OtrgDialogWaitHandle otrg_gtk_dialog_private_key_wait_start( const char *account, const char *protocol) { - GaimPlugin *p; + PurplePlugin *p; const char *title = "Generating private key"; const char *primary = "Please wait"; char *secondary; @@ -750,14 +750,14 @@ GtkWidget *dialog; OtrgDialogWaitHandle handle; - p = gaim_find_prpl(protocol); + p = purple_find_prpl(protocol); protocol_print = (p ? p->info->name : "Unknown"); /* Create the Please Wait... dialog */ secondary = g_strdup_printf("Generating private key for %s (%s)...", account, protocol_print); - dialog = create_dialog(GAIM_NOTIFY_MSG_INFO, title, primary, secondary, + dialog = create_dialog(PURPLE_NOTIFY_MSG_INFO, title, primary, secondary, 0, &label, NULL, NULL); handle = malloc(sizeof(struct s_OtrgDialogWait)); handle->dialog = dialog; @@ -778,20 +778,20 @@ const char *protocol, const char *username, const char *msg) { /* See if there's a conversation window we can put this in. */ - GaimAccount *account; - GaimConversation *conv; + PurpleAccount *account; + PurpleConversation *conv; - account = gaim_accounts_find(accountname, protocol); + account = purple_accounts_find(accountname, protocol); if (!account) return -1; -#if GAIM_MAJOR_VERSION < 2 - conv = gaim_find_conversation_with_account(username, account); +#if PURPLE_MAJOR_VERSION < 2 + conv = purple_find_conversation_with_account(username, account); #else - conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account); #endif if (!conv) return -1; - gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); + purple_conversation_write(conv, NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); return 0; } @@ -846,7 +846,7 @@ gtk_container_add(GTK_CONTAINER(more), scrl); imh = gtk_imhtml_new(NULL, NULL); - gaim_setup_imhtml(imh); + pidgin_setup_imhtml(imh); gtk_imhtml_append_text(GTK_IMHTML(imh), moremarkup, GTK_IMHTML_NO_SCROLL); gtk_container_add(GTK_CONTAINER(scrl), imh); @@ -889,7 +889,7 @@ { char hash[45]; char *primary, *secondary; - GaimPlugin *p = gaim_find_prpl(protocol); + PurplePlugin *p = purple_find_prpl(protocol); otrl_privkey_hash_to_human(hash, fingerprint); primary = g_strdup_printf("%s (%s) has received an unknown fingerprint " @@ -897,7 +897,7 @@ (p && p->info->name) ? p->info->name : "Unknown", who); secondary = g_strdup_printf("%s\n", hash); - create_dialog(GAIM_NOTIFY_MSG_WARNING, "Unknown fingerprint", + create_dialog(PURPLE_NOTIFY_MSG_WARNING, "Unknown fingerprint", primary, secondary, 1, NULL, add_unk_fingerprint_expander, NULL); g_free(primary); @@ -906,7 +906,7 @@ static void otrg_gtk_dialog_clicked_connect(GtkWidget *widget, gpointer data); -static void dialog_update_label_conv(GaimConversation *conv, TrustLevel level) +static void dialog_update_label_conv(PurpleConversation *conv, TrustLevel level) { GtkWidget *label; GtkWidget *icon; @@ -917,23 +917,23 @@ GtkWidget *menuquerylabel; GtkWidget *menuview; GtkWidget *menuverf; -#if GAIM_MAJOR_VERSION < 2 +#if PURPLE_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; + PurpleButtonStyle buttonstyle; #endif - GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); - label = gaim_conversation_get_data(conv, "otr-label"); - icon = gaim_conversation_get_data(conv, "otr-icon"); - icontext = gaim_conversation_get_data(conv, "otr-icontext"); - button = gaim_conversation_get_data(conv, "otr-button"); - menuquery = gaim_conversation_get_data(conv, "otr-menuquery"); + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + label = purple_conversation_get_data(conv, "otr-label"); + icon = purple_conversation_get_data(conv, "otr-icon"); + icontext = purple_conversation_get_data(conv, "otr-icontext"); + button = purple_conversation_get_data(conv, "otr-button"); + menuquery = purple_conversation_get_data(conv, "otr-menuquery"); menuquerylabel = gtk_bin_get_child(GTK_BIN(menuquery)); - 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"); + menuend = purple_conversation_get_data(conv, "otr-menuend"); + menuview = purple_conversation_get_data(conv, "otr-menuview"); + menuverf = purple_conversation_get_data(conv, "otr-menuverf"); +#if PURPLE_MAJOR_VERSION < 2 + buttonstyle = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/button_type"); #endif /* Set the button's icon, label and tooltip. */ @@ -958,18 +958,18 @@ gtk_widget_set_sensitive(GTK_WIDGET(menuverf), level != TRUST_NOT_PRIVATE); /* Use any non-NULL value for "private", NULL for "not private" */ - gaim_conversation_set_data(conv, "otr-private", + purple_conversation_set_data(conv, "otr-private", level == TRUST_NOT_PRIVATE ? NULL : conv); /* Set the appropriate visibility */ gtk_widget_show_all(button); -#if GAIM_MAJOR_VERSION < 2 - if (buttonstyle == GAIM_BUTTON_IMAGE) { +#if PURPLE_MAJOR_VERSION < 2 + if (buttonstyle == PIDGIN_BUTTON_IMAGE) { /* Hide the text */ gtk_widget_hide(icontext); gtk_widget_hide(label); } - if (buttonstyle == GAIM_BUTTON_TEXT) { + if (buttonstyle == PIDGIN_BUTTON_TEXT) { /* Hide the icon */ gtk_widget_hide(icontext); gtk_widget_hide(icon); @@ -979,16 +979,16 @@ static void dialog_update_label(ConnContext *context) { - GaimAccount *account; - GaimConversation *conv; + PurpleAccount *account; + PurpleConversation *conv; TrustLevel level = otrg_plugin_context_to_trust(context); - account = gaim_accounts_find(context->accountname, context->protocol); + account = purple_accounts_find(context->accountname, context->protocol); if (!account) return; -#if GAIM_MAJOR_VERSION < 2 - conv = gaim_find_conversation_with_account(context->username, account); +#if PURPLE_MAJOR_VERSION < 2 + conv = purple_find_conversation_with_account(context->username, account); #else - conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, context->username, account); #endif if (!conv) return; dialog_update_label_conv(conv, level); @@ -1042,7 +1042,7 @@ whichhalf == OTRL_SESSIONID_SECOND_HALF_BOLD ? "weight=\"bold\"" : "", sess2); - dialog = create_dialog(GAIM_NOTIFY_MSG_INFO, "Private connection " + dialog = create_dialog(PURPLE_NOTIFY_MSG_INFO, "Private connection " "established", primary, secondary, 1, NULL, add_sessid_expander, NULL); @@ -1185,7 +1185,7 @@ char *secondary; struct vrfy_fingerprint_data *vfd; ConnContext *context; - GaimPlugin *p; + PurplePlugin *p; char *proto_name; if (fprint == NULL) return; @@ -1202,13 +1202,13 @@ otrl_privkey_hash_to_human(their_hash, fprint->fingerprint); - p = gaim_find_prpl(context->protocol); + p = purple_find_prpl(context->protocol); proto_name = (p && p->info->name) ? p->info->name : "Unknown"; secondary = g_strdup_printf("Fingerprint for you, %s (%s):\n%s\n\n" "Purported fingerprint for %s:\n%s\n", context->accountname, proto_name, our_hash, context->username, their_hash); - dialog = create_dialog(GAIM_NOTIFY_MSG_INFO, "Verify fingerprint", + dialog = create_dialog(PURPLE_NOTIFY_MSG_INFO, "Verify fingerprint", primary, secondary, 1, NULL, add_vrfy_fingerprint, vfd); g_signal_connect(G_OBJECT(dialog), "destroy", G_CALLBACK(vrfy_fingerprint_destroyed), vfd); @@ -1220,7 +1220,7 @@ /* Call this when a context transitions to ENCRYPTED. */ static void otrg_gtk_dialog_connected(ConnContext *context) { - GaimConversation *conv; + PurpleConversation *conv; char *buf; TrustLevel level; @@ -1234,11 +1234,11 @@ /* This last case should never happen, since we know * we're in ENCRYPTED. */ "Not private", - gaim_conversation_get_name(conv), + purple_conversation_get_name(conv), context->protocol_version == 1 ? " Warning: using old " "protocol version 1." : ""); - gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(buf); dialog_update_label(context); @@ -1247,14 +1247,14 @@ /* Call this when a context transitions to PLAINTEXT. */ static void otrg_gtk_dialog_disconnected(ConnContext *context) { - GaimConversation *conv; + PurpleConversation *conv; char *buf; conv = otrg_plugin_context_to_conv(context, 1); buf = g_strdup_printf("Private conversation with %s lost.", - gaim_conversation_get_name(conv)); - gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + purple_conversation_get_name(conv)); + purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(buf); dialog_update_label(context); @@ -1266,23 +1266,23 @@ const char *protocol, const char *username) { /* See if there's a conversation window we can put this in. */ - GaimAccount *account; - GaimConversation *conv; + PurpleAccount *account; + PurpleConversation *conv; char *buf; - account = gaim_accounts_find(accountname, protocol); + account = purple_accounts_find(accountname, protocol); if (!account) return; -#if GAIM_MAJOR_VERSION < 2 - conv = gaim_find_conversation_with_account(username, account); +#if PURPLE_MAJOR_VERSION < 2 + conv = purple_find_conversation_with_account(username, account); #else - conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account); #endif if (!conv) return; buf = g_strdup_printf("%s has ended his private conversation with you; " - "you should do the same.", gaim_conversation_get_name(conv)); - gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + "you should do the same.", purple_conversation_get_name(conv)); + purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(buf); dialog_update_label_conv(conv, TRUST_FINISHED); @@ -1292,7 +1292,7 @@ * our state to change (because it was just the keys we knew already). */ static void otrg_gtk_dialog_stillconnected(ConnContext *context) { - GaimConversation *conv; + PurpleConversation *conv; char *buf; TrustLevel level; @@ -1307,11 +1307,11 @@ /* This last case should never happen, since we know * we're in ENCRYPTED. */ "not private", - gaim_conversation_get_name(conv), + purple_conversation_get_name(conv), context->protocol_version == 1 ? " Warning: using old " "protocol version 1." : ""); - gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(buf); dialog_update_label(context); @@ -1323,15 +1323,15 @@ { const char *format; char *buf; - GaimConversation *conv = data; + PurpleConversation *conv = data; - if (gaim_conversation_get_data(conv, "otr-private")) { + if (purple_conversation_get_data(conv, "otr-private")) { format = "Attempting to refresh the private conversation with %s..."; } else { format = "Attempting to start a private conversation with %s..."; } - buf = g_strdup_printf(format, gaim_conversation_get_name(conv)); - gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + buf = g_strdup_printf(format, purple_conversation_get_name(conv)); + purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(buf); otrg_plugin_send_default_query_conv(conv); @@ -1339,7 +1339,7 @@ static void view_sessionid(GtkWidget *widget, gpointer data) { - GaimConversation *conv = data; + PurpleConversation *conv = data; ConnContext *context = otrg_plugin_conv_to_context(conv); if (context == NULL || context->msgstate != OTRL_MSGSTATE_ENCRYPTED) @@ -1350,7 +1350,7 @@ static void verify_fingerprint(GtkWidget *widget, gpointer data) { - GaimConversation *conv = data; + PurpleConversation *conv = data; ConnContext *context = otrg_plugin_conv_to_context(conv); if (context == NULL || context->msgstate != OTRL_MSGSTATE_ENCRYPTED) @@ -1361,27 +1361,27 @@ static void menu_whatsthis(GtkWidget *widget, gpointer data) { - gaim_notify_uri(otrg_plugin_handle, BUTTON_HELPURL); + purple_notify_uri(otrg_plugin_handle, BUTTON_HELPURL); } static void menu_end_private_conversation(GtkWidget *widget, gpointer data) { - GaimConversation *conv = data; + PurpleConversation *conv = data; ConnContext *context = otrg_plugin_conv_to_context(conv); otrg_ui_disconnect_connection(context); } -static void dialog_resensitize(GaimConversation *conv); +static void dialog_resensitize(PurpleConversation *conv); /* If the OTR button is right-clicked, show the context menu. */ static gboolean button_pressed(GtkWidget *w, GdkEventButton *event, gpointer data) { - GaimConversation *conv = data; + PurpleConversation *conv = data; if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) { - GtkWidget *menu = gaim_conversation_get_data(conv, "otr-menu"); + GtkWidget *menu = purple_conversation_get_data(conv, "otr-menu"); if (menu) { gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time); @@ -1393,9 +1393,9 @@ /* If the OTR button gets destroyed on us, clean up the data we stored * pointing to it. */ -static void button_destroyed(GtkWidget *w, GaimConversation *conv) +static void button_destroyed(GtkWidget *w, PurpleConversation *conv) { - GtkWidget *menu = gaim_conversation_get_data(conv, "otr-menu"); + GtkWidget *menu = purple_conversation_get_data(conv, "otr-menu"); if (menu) gtk_object_destroy(GTK_OBJECT(menu)); g_hash_table_remove(conv->data, "otr-label"); g_hash_table_remove(conv->data, "otr-button"); @@ -1410,9 +1410,9 @@ } /* Set up the per-conversation information display */ -static void otrg_gtk_dialog_new_conv(GaimConversation *conv) +static void otrg_gtk_dialog_new_conv(PurpleConversation *conv) { - GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); ConnContext *context; GtkWidget *bbox; GtkWidget *button; @@ -1431,18 +1431,18 @@ 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; +#if PURPLE_MAJOR_VERSION < 2 + if (purple_conversation_get_type(conv) != PURPLE_CONV_IM) return; bbox = gtkconv->bbox; #else - if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; + if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) return; bbox = gtkconv->lower_hbox; #endif context = otrg_plugin_conv_to_context(conv); /* See if we're already set up */ - button = gaim_conversation_get_data(conv, "otr-button"); + button = purple_conversation_get_data(conv, "otr-button"); if (button) { /* Check if we've been removed from the bbox; gaim does this * when the user changes her prefs for the style of buttons to @@ -1508,15 +1508,15 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), whatsthis); gtk_widget_show(whatsthis); - gaim_conversation_set_data(conv, "otr-label", label); - gaim_conversation_set_data(conv, "otr-button", button); - gaim_conversation_set_data(conv, "otr-icon", icon); - gaim_conversation_set_data(conv, "otr-icontext", icontext); - gaim_conversation_set_data(conv, "otr-menu", menu); - gaim_conversation_set_data(conv, "otr-menuquery", menuquery); - gaim_conversation_set_data(conv, "otr-menuend", menuend); - gaim_conversation_set_data(conv, "otr-menuview", menuview); - gaim_conversation_set_data(conv, "otr-menuverf", menuverf); + purple_conversation_set_data(conv, "otr-label", label); + purple_conversation_set_data(conv, "otr-button", button); + purple_conversation_set_data(conv, "otr-icon", icon); + purple_conversation_set_data(conv, "otr-icontext", icontext); + purple_conversation_set_data(conv, "otr-menu", menu); + purple_conversation_set_data(conv, "otr-menuquery", menuquery); + purple_conversation_set_data(conv, "otr-menuend", menuend); + purple_conversation_set_data(conv, "otr-menuview", menuview); + purple_conversation_set_data(conv, "otr-menuverf", menuverf); gtk_signal_connect(GTK_OBJECT(menuquery), "activate", GTK_SIGNAL_FUNC(otrg_gtk_dialog_clicked_connect), conv); gtk_signal_connect(GTK_OBJECT(menuend), "activate", @@ -1539,39 +1539,39 @@ } /* Remove the per-conversation information display */ -static void otrg_gtk_dialog_remove_conv(GaimConversation *conv) +static void otrg_gtk_dialog_remove_conv(PurpleConversation *conv) { 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; +#if PURPLE_MAJOR_VERSION < 2 + if (purple_conversation_get_type(conv) != PURPLE_CONV_IM) return; #else - if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; + if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) return; #endif - button = gaim_conversation_get_data(conv, "otr-button"); + button = purple_conversation_get_data(conv, "otr-button"); if (button) gtk_object_destroy(GTK_OBJECT(button)); } /* Set the OTR button to "sensitive" or "insensitive" as appropriate. */ -static void dialog_resensitize(GaimConversation *conv) +static void dialog_resensitize(PurpleConversation *conv) { - GaimAccount *account; - GaimConnection *connection; + PurpleAccount *account; + PurpleConnection *connection; GtkWidget *button; const char *name; 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; +#if PURPLE_MAJOR_VERSION < 2 + if (purple_conversation_get_type(conv) != PURPLE_CONV_IM) return; #else - if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; + if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) return; #endif - account = gaim_conversation_get_account(conv); - name = gaim_conversation_get_name(conv); + account = purple_conversation_get_account(conv); + name = purple_conversation_get_name(conv); policy = otrg_ui_find_policy(account, name); if (policy == OTRL_POLICY_NEVER) { @@ -1579,10 +1579,10 @@ } else { otrg_gtk_dialog_new_conv(conv); } - button = gaim_conversation_get_data(conv, "otr-button"); + button = purple_conversation_get_data(conv, "otr-button"); if (!button) return; if (account) { - connection = gaim_account_get_connection(account); + connection = purple_account_get_connection(account); if (connection) { /* Set the button to "sensitive" */ gtk_widget_set_sensitive(button, 1); @@ -1597,7 +1597,7 @@ * Call this when accounts are logged in or out. */ static void otrg_gtk_dialog_resensitize_all(void) { - gaim_conversation_foreach(dialog_resensitize); + purple_conversation_foreach(dialog_resensitize); } static const OtrgDialogUiOps gtk_dialog_ui_ops = { diff -ur gaim-otr.gaim/gtk-ui.c gaim-otr.pidgin/gtk-ui.c --- gaim-otr.gaim/gtk-ui.c 2005-10-16 16:59:34.000000000 +0100 +++ gaim-otr.pidgin/gtk-ui.c 2007-05-11 18:32:08.000000000 +0100 @@ -65,7 +65,7 @@ "Finished" }; -static void account_menu_changed_cb(GtkWidget *item, GaimAccount *account, +static void account_menu_changed_cb(GtkWidget *item, PurpleAccount *account, void *data) { const char *accountname; @@ -76,8 +76,8 @@ if (account) { char fingerprint_buf[45]; - accountname = gaim_account_get_username(account); - protocol = gaim_account_get_protocol_id(account); + accountname = purple_account_get_username(account); + protocol = purple_account_get_protocol_id(account); fingerprint = otrl_privkey_fingerprint(otrg_plugin_userstate, fingerprint_buf, accountname, protocol); @@ -111,7 +111,7 @@ return gtk_menu_get_active(GTK_MENU(menu)); } -static GaimAccount *item_get_account(GtkWidget *item) +static PurpleAccount *item_get_account(GtkWidget *item) { if (!item) return NULL; return g_object_get_data(G_OBJECT(item), "account"); @@ -122,7 +122,7 @@ static void otrg_gtk_ui_update_fingerprint(void) { GtkWidget *item; - GaimAccount *account; + PurpleAccount *account; gpointer user_data; item = accountmenu_get_selected_item(); @@ -136,7 +136,7 @@ account_menu_changed_cb(item, account, user_data); } -static void account_menu_added_removed_cb(GaimAccount *account, void *data) +static void account_menu_added_removed_cb(PurpleAccount *account, void *data) { otrg_gtk_ui_update_fingerprint(); } @@ -170,7 +170,7 @@ for (context = otrg_plugin_userstate->context_root; context != NULL; context = context->next) { int i; - GaimPlugin *p; + PurplePlugin *p; char *proto_name; fingerprint = context->fingerprint_root.next; /* If there's no fingerprint, don't add it to the known @@ -188,7 +188,7 @@ "Yes" : "No"; otrl_privkey_hash_to_human(hash, fingerprint->fingerprint); titles[3] = hash; - p = gaim_find_prpl(context->protocol); + p = purple_find_prpl(context->protocol); proto_name = (p && p->info->name) ? p->info->name : "Unknown"; titles[4] = g_strdup_printf("%s (%s)", context->accountname, proto_name); @@ -216,13 +216,13 @@ static void generate(GtkWidget *widget, gpointer data) { - GaimAccount *account; + PurpleAccount *account; account = item_get_account(accountmenu_get_selected_item()); if (account == NULL) return; - otrg_plugin_create_privkey(gaim_account_get_username(account), - gaim_account_get_protocol_id(account)); + otrg_plugin_create_privkey(purple_account_get_username(account), + purple_account_get_protocol_id(account)); } static void ui_destroyed(GtkObject *object) @@ -445,10 +445,10 @@ static void otrg_gtk_ui_global_prefs_load(gboolean *enabledp, gboolean *automaticp, gboolean *onlyprivatep) { - if (gaim_prefs_exists("/OTR/enabled")) { - *enabledp = gaim_prefs_get_bool("/OTR/enabled"); - *automaticp = gaim_prefs_get_bool("/OTR/automatic"); - *onlyprivatep = gaim_prefs_get_bool("/OTR/onlyprivate"); + if (purple_prefs_exists("/OTR/enabled")) { + *enabledp = purple_prefs_get_bool("/OTR/enabled"); + *automaticp = purple_prefs_get_bool("/OTR/automatic"); + *onlyprivatep = purple_prefs_get_bool("/OTR/onlyprivate"); } else { *enabledp = TRUE; *automaticp = TRUE; @@ -460,43 +460,43 @@ static void otrg_gtk_ui_global_prefs_save(gboolean enabled, gboolean automatic, gboolean onlyprivate) { - if (! gaim_prefs_exists("/OTR")) { - gaim_prefs_add_none("/OTR"); + if (! purple_prefs_exists("/OTR")) { + purple_prefs_add_none("/OTR"); } - gaim_prefs_set_bool("/OTR/enabled", enabled); - gaim_prefs_set_bool("/OTR/automatic", automatic); - gaim_prefs_set_bool("/OTR/onlyprivate", onlyprivate); + purple_prefs_set_bool("/OTR/enabled", enabled); + purple_prefs_set_bool("/OTR/automatic", automatic); + purple_prefs_set_bool("/OTR/onlyprivate", onlyprivate); } /* Load the OTR prefs for a particular buddy */ -static void otrg_gtk_ui_buddy_prefs_load(GaimBuddy *buddy, +static void otrg_gtk_ui_buddy_prefs_load(PurpleBuddy *buddy, gboolean *usedefaultp, gboolean *enabledp, gboolean *automaticp, gboolean *onlyprivatep) { - GaimBlistNode *node = &(buddy->node); + PurpleBlistNode *node = &(buddy->node); - *usedefaultp = ! gaim_blist_node_get_bool(node, "OTR/overridedefault"); + *usedefaultp = ! purple_blist_node_get_bool(node, "OTR/overridedefault"); if (*usedefaultp) { otrg_gtk_ui_global_prefs_load(enabledp, automaticp, onlyprivatep); } else { - *enabledp = gaim_blist_node_get_bool(node, "OTR/enabled"); - *automaticp = gaim_blist_node_get_bool(node, "OTR/automatic"); - *onlyprivatep = gaim_blist_node_get_bool(node, "OTR/onlyprivate"); + *enabledp = purple_blist_node_get_bool(node, "OTR/enabled"); + *automaticp = purple_blist_node_get_bool(node, "OTR/automatic"); + *onlyprivatep = purple_blist_node_get_bool(node, "OTR/onlyprivate"); } } /* Save the OTR prefs for a particular buddy */ -static void otrg_gtk_ui_buddy_prefs_save(GaimBuddy *buddy, +static void otrg_gtk_ui_buddy_prefs_save(PurpleBuddy *buddy, gboolean usedefault, gboolean enabled, gboolean automatic, gboolean onlyprivate) { - GaimBlistNode *node = &(buddy->node); + PurpleBlistNode *node = &(buddy->node); - gaim_blist_node_set_bool(node, "OTR/overridedefault", !usedefault); - gaim_blist_node_set_bool(node, "OTR/enabled", enabled); - gaim_blist_node_set_bool(node, "OTR/automatic", automatic); - gaim_blist_node_set_bool(node, "OTR/onlyprivate", onlyprivate); + purple_blist_node_set_bool(node, "OTR/overridedefault", !usedefault); + purple_blist_node_set_bool(node, "OTR/enabled", enabled); + purple_blist_node_set_bool(node, "OTR/automatic", automatic); + purple_blist_node_set_bool(node, "OTR/onlyprivate", onlyprivate); } static void load_otroptions(struct otroptionsdata *oo) @@ -537,18 +537,18 @@ label = gtk_label_new("Key for account:"); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - ui_layout.accountmenu = gaim_gtk_account_option_menu_new(NULL, 1, + ui_layout.accountmenu = pidgin_account_option_menu_new(NULL, 1, G_CALLBACK(account_menu_changed_cb), NULL, NULL); gtk_box_pack_start(GTK_BOX(hbox), ui_layout.accountmenu, TRUE, TRUE, 0); /* Make sure we notice if the menu changes because an account has * been added or removed */ - gaim_signal_connect(gaim_accounts_get_handle(), "account-added", + purple_signal_connect(purple_accounts_get_handle(), "account-added", ui_layout.accountmenu, - GAIM_CALLBACK(account_menu_added_removed_cb), NULL); - gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", + PURPLE_CALLBACK(account_menu_added_removed_cb), NULL); + purple_signal_connect(purple_accounts_get_handle(), "account-removed", ui_layout.accountmenu, - GAIM_CALLBACK(account_menu_added_removed_cb), NULL); + PURPLE_CALLBACK(account_menu_added_removed_cb), NULL); ui_layout.fprint_label = gtk_label_new(""); gtk_label_set_selectable(GTK_LABEL(ui_layout.fprint_label), 1); @@ -698,7 +698,7 @@ } /* Construct the OTR UI widget */ -GtkWidget* otrg_gtk_ui_make_widget(GaimPlugin *plugin) +GtkWidget* otrg_gtk_ui_make_widget(PurplePlugin *plugin) { GtkWidget *vbox = gtk_vbox_new(FALSE, 5); GtkWidget *fingerprintbox = gtk_vbox_new(FALSE, 5); @@ -734,7 +734,7 @@ struct cbdata { GtkWidget *dialog; - GaimBuddy *buddy; + PurpleBuddy *buddy; GtkWidget *defaultbox; struct otroptionsdata oo; }; @@ -807,7 +807,7 @@ gtk_widget_destroy(data->dialog); } -static void otrg_gtk_ui_config_buddy(GaimBuddy *buddy) +static void otrg_gtk_ui_config_buddy(PurpleBuddy *buddy) { GtkWidget *dialog; GtkWidget *label; @@ -835,7 +835,7 @@ /* Set the title */ label_text = g_strdup_printf("" - "OTR Settings for %s", gaim_buddy_get_contact_alias(buddy)); + "OTR Settings for %s", purple_buddy_get_contact_alias(buddy)); label = gtk_label_new(NULL); @@ -882,10 +882,10 @@ } /* Calculate the policy for a particular account / username */ -static OtrlPolicy otrg_gtk_ui_find_policy(GaimAccount *account, +static OtrlPolicy otrg_gtk_ui_find_policy(PurpleAccount *account, const char *name) { - GaimBuddy *buddy; + PurpleBuddy *buddy; gboolean otrenabled, otrautomatic, otronlyprivate; gboolean buddyusedefault, buddyenabled, buddyautomatic, buddyonlyprivate; OtrlPolicy policy = OTRL_POLICY_DEFAULT; @@ -907,7 +907,7 @@ policy = OTRL_POLICY_NEVER; } - buddy = gaim_find_buddy(account, name); + buddy = purple_find_buddy(account, name); if (!buddy) return policy; /* Get the buddy-specific policy, if present */ diff -ur gaim-otr.gaim/gtk-ui.h gaim-otr.pidgin/gtk-ui.h --- gaim-otr.gaim/gtk-ui.h 2005-05-04 18:49:46.000000000 +0100 +++ gaim-otr.pidgin/gtk-ui.h 2007-05-11 18:32:08.000000000 +0100 @@ -21,7 +21,7 @@ #define __OTRG_GTK_UI_H__ /* Construct the GTK OTR UI widget */ -GtkWidget* otrg_gtk_ui_make_widget(GaimPlugin *plugin); +GtkWidget* otrg_gtk_ui_make_widget(PurplePlugin *plugin); /* Get the GTK UI ops */ const OtrgUiUiOps *otrg_gtk_ui_get_ui_ops(void); diff -ur gaim-otr.gaim/Makefile.am gaim-otr.pidgin/Makefile.am --- gaim-otr.gaim/Makefile.am 2005-05-04 18:49:46.000000000 +0100 +++ gaim-otr.pidgin/Makefile.am 2007-05-11 18:35:25.000000000 +0100 @@ -1,8 +1,8 @@ AM_CFLAGS= @LIBGCRYPT_CFLAGS@ @LIBOTR_CFLAGS@ @EXTRA_CFLAGS@ -AM_CFLAGS+= -DUSING_GTK -DGAIM_PLUGINS \ +AM_CFLAGS+= -DUSING_GTK -DPURPLE_PLUGINS \ -DGAIM_OTR_VERSION=\"@VERSION@\" -plugindir= ${libdir}/gaim +plugindir= ${libdir}/pidgin plugin_LTLIBRARIES= gaim-otr.la diff -ur gaim-otr.gaim/otr-plugin.c gaim-otr.pidgin/otr-plugin.c --- gaim-otr.gaim/otr-plugin.c 2006-01-20 15:22:06.000000000 +0000 +++ gaim-otr.pidgin/otr-plugin.c 2007-05-11 18:32:08.000000000 +0100 @@ -31,7 +31,7 @@ #include /* gaim headers */ -#include "gaim.h" + #include "notify.h" #include "version.h" #include "util.h" @@ -60,23 +60,23 @@ #include "gtk-dialog.h" #endif -GaimPlugin *otrg_plugin_handle; +PurplePlugin *otrg_plugin_handle; /* We'll only use the one OtrlUserState. */ OtrlUserState otrg_plugin_userstate = NULL; /* Send an IM from the given account to the given recipient. Display an * error dialog if that account isn't currently logged in. */ -void otrg_plugin_inject_message(GaimAccount *account, const char *recipient, +void otrg_plugin_inject_message(PurpleAccount *account, const char *recipient, const char *message) { - GaimConnection *connection; + PurpleConnection *connection; - connection = gaim_account_get_connection(account); + connection = purple_account_get_connection(account); if (!connection) { - const char *protocol = gaim_account_get_protocol_id(account); - const char *accountname = gaim_account_get_username(account); - GaimPlugin *p = gaim_find_prpl(protocol); + const char *protocol = purple_account_get_protocol_id(account); + const char *accountname = purple_account_get_username(account); + PurplePlugin *p = purple_find_prpl(protocol); char *msg = g_strdup_printf("You are not currently connected to " "account %s (%s).", accountname, (p && p->info->name) ? p->info->name : "Unknown"); @@ -90,12 +90,12 @@ static OtrlPolicy policy_cb(void *opdata, ConnContext *context) { - GaimAccount *account; + PurpleAccount *account; OtrlPolicy policy = OTRL_POLICY_DEFAULT; if (!context) return policy; - account = gaim_accounts_find(context->accountname, context->protocol); + account = purple_accounts_find(context->accountname, context->protocol); if (!account) return policy; return otrg_ui_find_policy(account, context->username); @@ -103,7 +103,7 @@ static const char *protocol_name_cb(void *opdata, const char *protocol) { - GaimPlugin *p = gaim_find_prpl(protocol); + PurplePlugin *p = purple_find_prpl(protocol); if (!p) return NULL; return p->info->name; } @@ -120,7 +120,7 @@ { OtrgDialogWaitHandle waithandle; - gchar *privkeyfile = g_build_filename(gaim_user_dir(), PRIVKEYFNAME, NULL); + gchar *privkeyfile = g_build_filename(purple_user_dir(), PRIVKEYFNAME, NULL); if (!privkeyfile) { fprintf(stderr, "Out of memory building filenames!\n"); return; @@ -147,28 +147,28 @@ static int is_logged_in_cb(void *opdata, const char *accountname, const char *protocol, const char *recipient) { - GaimAccount *account; - GaimBuddy *buddy; + PurpleAccount *account; + PurpleBuddy *buddy; - account = gaim_accounts_find(accountname, protocol); + account = purple_accounts_find(accountname, protocol); if (!account) return -1; - buddy = gaim_find_buddy(account, recipient); + buddy = purple_find_buddy(account, recipient); if (!buddy) return -1; -#if GAIM_MAJOR_VERSION < 2 - return (buddy->present == GAIM_BUDDY_ONLINE); +#if PURPLE_MAJOR_VERSION < 2 + return (buddy->present == PURPLE_BUDDY_ONLINE); #else - return (GAIM_BUDDY_IS_ONLINE(buddy)); + return (PURPLE_BUDDY_IS_ONLINE(buddy)); #endif } static void inject_message_cb(void *opdata, const char *accountname, const char *protocol, const char *recipient, const char *message) { - GaimAccount *account = gaim_accounts_find(accountname, protocol); + PurpleAccount *account = purple_accounts_find(accountname, protocol); if (!account) { - GaimPlugin *p = gaim_find_prpl(protocol); + PurplePlugin *p = purple_find_prpl(protocol); char *msg = g_strdup_printf("Unknown account %s (%s).", accountname, (p && p->info->name) ? p->info->name : "Unknown"); otrg_dialog_notify_error(accountname, protocol, recipient, @@ -183,17 +183,17 @@ const char *accountname, const char *protocol, const char *username, const char *title, const char *primary, const char *secondary) { - GaimNotifyMsgType gaimlevel = GAIM_NOTIFY_MSG_ERROR; + PurpleNotifyMsgType gaimlevel = PURPLE_NOTIFY_MSG_ERROR; switch (level) { case OTRL_NOTIFY_ERROR: - gaimlevel = GAIM_NOTIFY_MSG_ERROR; + gaimlevel = PURPLE_NOTIFY_MSG_ERROR; break; case OTRL_NOTIFY_WARNING: - gaimlevel = GAIM_NOTIFY_MSG_WARNING; + gaimlevel = PURPLE_NOTIFY_MSG_WARNING; break; case OTRL_NOTIFY_INFO: - gaimlevel = GAIM_NOTIFY_MSG_INFO; + gaimlevel = PURPLE_NOTIFY_MSG_INFO; break; } @@ -245,7 +245,7 @@ static void log_message_cb(void *opdata, const char *message) { - gaim_debug_info("otr", message); + purple_debug_info("otr", message); } static OtrlMessageAppOps ui_ops = { @@ -266,19 +266,19 @@ log_message_cb }; -static void process_sending_im(GaimAccount *account, char *who, char **message, +static void process_sending_im(PurpleAccount *account, char *who, char **message, void *m) { char *newmessage = NULL; - const char *accountname = gaim_account_get_username(account); - const char *protocol = gaim_account_get_protocol_id(account); + const char *accountname = purple_account_get_username(account); + const char *protocol = purple_account_get_protocol_id(account); char *username; gcry_error_t err; if (!who || !message || !*message) return; - username = strdup(gaim_normalize(account, who)); + username = strdup(purple_normalize(account, who)); err = otrl_message_sending(otrg_plugin_userstate, &ui_ops, NULL, accountname, protocol, username, *message, NULL, &newmessage, @@ -303,11 +303,11 @@ /* Send the default OTR Query message to the correspondent of the given * context, from the given account. [account is actually a - * GaimAccount*, but it's declared here as void* so this can be passed + * PurpleAccount*, but it's declared here as void* so this can be passed * as a callback.] */ void otrg_plugin_send_default_query(ConnContext *context, void *vaccount) { - GaimAccount *account = vaccount; + PurpleAccount *account = vaccount; char *msg = otrl_proto_default_query_msg(context->accountname, otrg_ui_find_policy(account, context->username)); otrg_plugin_inject_message(account, context->username, @@ -317,15 +317,15 @@ /* Send the default OTR Query message to the correspondent of the given * conversation. */ -void otrg_plugin_send_default_query_conv(GaimConversation *conv) +void otrg_plugin_send_default_query_conv(PurpleConversation *conv) { - GaimAccount *account; + PurpleAccount *account; const char *username, *accountname; char *msg; - account = gaim_conversation_get_account(conv); - accountname = gaim_account_get_username(account); - username = gaim_conversation_get_name(conv); + account = purple_conversation_get_account(conv); + accountname = purple_account_get_username(account); + username = purple_conversation_get_name(conv); msg = otrl_proto_default_query_msg(accountname, otrg_ui_find_policy(account, username)); @@ -333,7 +333,7 @@ free(msg); } -static gboolean process_receiving_im(GaimAccount *account, char **who, +static gboolean process_receiving_im(PurpleAccount *account, char **who, char **message, int *flags, void *m) { char *newmessage = NULL; @@ -347,9 +347,9 @@ if (!who || !*who || !message || !*message) return 0; - username = strdup(gaim_normalize(account, *who)); - accountname = gaim_account_get_username(account); - protocol = gaim_account_get_protocol_id(account); + username = strdup(purple_normalize(account, *who)); + accountname = purple_account_get_username(account); + protocol = purple_account_get_protocol_id(account); res = otrl_message_receiving(otrg_plugin_userstate, &ui_ops, NULL, accountname, protocol, username, *message, @@ -387,21 +387,21 @@ return res; } -static void process_conv_create(GaimConversation *conv, void *data) +static void process_conv_create(PurpleConversation *conv, void *data) { if (conv) otrg_dialog_new_conv(conv); } -static void process_connection_change(GaimConnection *conn, void *data) +static void process_connection_change(PurpleConnection *conn, void *data) { /* If we log in or out of a connection, make sure all of the OTR * buttons are in the appropriate sensitive/insensitive state. */ otrg_dialog_resensitize_all(); } -#if GAIM_MAJOR_VERSION < 2 +#if PURPLE_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, +static void process_button_type_change(const char *name, PurplePrefType type, gpointer value, gpointer data) { /* If the user changes the style of the buttons at the bottom of the @@ -412,39 +412,39 @@ } #endif -static void otr_options_cb(GaimBlistNode *node, gpointer user_data) +static void otr_options_cb(PurpleBlistNode *node, gpointer user_data) { - /* We've already checked GAIM_BLIST_NODE_IS_BUDDY(node) */ - GaimBuddy *buddy = (GaimBuddy *)node; + /* We've already checked PURPLE_BLIST_NODE_IS_BUDDY(node) */ + PurpleBuddy *buddy = (PurpleBuddy *)node; /* Modify the settings for this buddy */ otrg_ui_config_buddy(buddy); } -static void supply_extended_menu(GaimBlistNode *node, GList **menu) +static void supply_extended_menu(PurpleBlistNode *node, GList **menu) { -#if GAIM_MAJOR_VERSION < 2 - GaimBlistNodeAction *act; +#if PURPLE_MAJOR_VERSION < 2 + PurpleBlistNodeAction *act; #else - GaimMenuAction *act; + PurpleMenuAction *act; #endif - GaimBuddy *buddy; - GaimAccount *acct; + PurpleBuddy *buddy; + PurpleAccount *acct; const char *proto; - if (!GAIM_BLIST_NODE_IS_BUDDY(node)) return; + if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) return; /* Extract the account, and then the protocol, for this buddy */ - buddy = (GaimBuddy *)node; + buddy = (PurpleBuddy *)node; acct = buddy->account; if (acct == NULL) return; - proto = gaim_account_get_protocol_id(acct); + proto = purple_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); +#if PURPLE_MAJOR_VERSION < 2 + act = purple_blist_node_action_new("OTR Settings", otr_options_cb, NULL); #else - act = gaim_menu_action_new("OTR Settings", (GaimCallback)otr_options_cb, + act = purple_menu_action_new("OTR Settings", (PurpleCallback)otr_options_cb, NULL, NULL); #endif *menu = g_list_append(*menu, act); @@ -461,24 +461,24 @@ /* Write the fingerprints to disk. */ void otrg_plugin_write_fingerprints(void) { - gchar *storefile = g_build_filename(gaim_user_dir(), STOREFNAME, NULL); + gchar *storefile = g_build_filename(purple_user_dir(), STOREFNAME, NULL); otrl_privkey_write_fingerprints(otrg_plugin_userstate, storefile); g_free(storefile); } -/* Find the ConnContext appropriate to a given GaimConversation. */ -ConnContext *otrg_plugin_conv_to_context(GaimConversation *conv) +/* Find the ConnContext appropriate to a given PurpleConversation. */ +ConnContext *otrg_plugin_conv_to_context(PurpleConversation *conv) { - GaimAccount *account; + PurpleAccount *account; char *username; const char *accountname, *proto; ConnContext *context; - account = gaim_conversation_get_account(conv); - accountname = gaim_account_get_username(account); - proto = gaim_account_get_protocol_id(account); + account = purple_conversation_get_account(conv); + accountname = purple_account_get_username(account); + proto = purple_account_get_protocol_id(account); username = g_strdup( - gaim_normalize(account, gaim_conversation_get_name(conv))); + purple_normalize(account, purple_conversation_get_name(conv))); context = otrl_context_find(otrg_plugin_userstate, username, accountname, proto, 0, NULL, NULL, NULL); @@ -487,27 +487,27 @@ return context; } -/* Find the GaimConversation appropriate to the given ConnContext. If +/* Find the PurpleConversation appropriate to the given ConnContext. If * one doesn't yet exist, create it if force_create is true. */ -GaimConversation *otrg_plugin_context_to_conv(ConnContext *context, +PurpleConversation *otrg_plugin_context_to_conv(ConnContext *context, int force_create) { - GaimAccount *account; - GaimConversation *conv; + PurpleAccount *account; + PurpleConversation *conv; - account = gaim_accounts_find(context->accountname, context->protocol); + account = purple_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); +#if PURPLE_MAJOR_VERSION < 2 + conv = purple_find_conversation_with_account(context->username, account); #else - conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account); + conv = purple_find_conversation_with_account(PURPLE_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); +#if PURPLE_MAJOR_VERSION < 2 + conv = purple_conversation_new(PURPLE_CONV_IM, account, context->username); #else - conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, context->username); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, context->username); #endif } @@ -547,19 +547,19 @@ } } -#if GAIM_MAJOR_VERSION < 2 +#if PURPLE_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) +static gboolean otr_plugin_load(PurplePlugin *handle) { - gchar *privkeyfile = g_build_filename(gaim_user_dir(), PRIVKEYFNAME, NULL); - gchar *storefile = g_build_filename(gaim_user_dir(), STOREFNAME, NULL); - void *conv_handle = gaim_conversations_get_handle(); - void *conn_handle = gaim_connections_get_handle(); - void *blist_handle = gaim_blist_get_handle(); - void *core_handle = gaim_get_core(); + gchar *privkeyfile = g_build_filename(purple_user_dir(), PRIVKEYFNAME, NULL); + gchar *storefile = g_build_filename(purple_user_dir(), STOREFNAME, NULL); + void *conv_handle = purple_conversations_get_handle(); + void *conn_handle = purple_connections_get_handle(); + void *blist_handle = purple_blist_get_handle(); + void *core_handle = purple_get_core(); if (!privkeyfile || !storefile) { g_free(privkeyfile); @@ -580,61 +580,61 @@ otrg_ui_update_fingerprint(); - gaim_signal_connect(core_handle, "quitting", otrg_plugin_handle, - GAIM_CALLBACK(process_quitting), NULL); - gaim_signal_connect(conv_handle, "sending-im-msg", otrg_plugin_handle, - GAIM_CALLBACK(process_sending_im), NULL); - gaim_signal_connect(conv_handle, "receiving-im-msg", otrg_plugin_handle, - GAIM_CALLBACK(process_receiving_im), NULL); - gaim_signal_connect(conv_handle, "conversation-created", - otrg_plugin_handle, GAIM_CALLBACK(process_conv_create), NULL); - gaim_signal_connect(conn_handle, "signed-on", otrg_plugin_handle, - GAIM_CALLBACK(process_connection_change), NULL); - gaim_signal_connect(conn_handle, "signed-off", otrg_plugin_handle, - 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", + purple_signal_connect(core_handle, "quitting", otrg_plugin_handle, + PURPLE_CALLBACK(process_quitting), NULL); + purple_signal_connect(conv_handle, "sending-im-msg", otrg_plugin_handle, + PURPLE_CALLBACK(process_sending_im), NULL); + purple_signal_connect(conv_handle, "receiving-im-msg", otrg_plugin_handle, + PURPLE_CALLBACK(process_receiving_im), NULL); + purple_signal_connect(conv_handle, "conversation-created", + otrg_plugin_handle, PURPLE_CALLBACK(process_conv_create), NULL); + purple_signal_connect(conn_handle, "signed-on", otrg_plugin_handle, + PURPLE_CALLBACK(process_connection_change), NULL); + purple_signal_connect(conn_handle, "signed-off", otrg_plugin_handle, + PURPLE_CALLBACK(process_connection_change), NULL); + purple_signal_connect(blist_handle, "blist-node-extended-menu", + otrg_plugin_handle, PURPLE_CALLBACK(supply_extended_menu), NULL); +#if PURPLE_MAJOR_VERSION < 2 + button_type_cbid = purple_prefs_connect_callback( + PIDGIN_PREFS_ROOT "/conversations/button_type", process_button_type_change, NULL); #endif - gaim_conversation_foreach(otrg_dialog_new_conv); + purple_conversation_foreach(otrg_dialog_new_conv); return 1; } -static gboolean otr_plugin_unload(GaimPlugin *handle) +static gboolean otr_plugin_unload(PurplePlugin *handle) { - void *conv_handle = gaim_conversations_get_handle(); - void *conn_handle = gaim_connections_get_handle(); - void *blist_handle = gaim_blist_get_handle(); - void *core_handle = gaim_get_core(); + void *conv_handle = purple_conversations_get_handle(); + void *conn_handle = purple_connections_get_handle(); + void *blist_handle = purple_blist_get_handle(); + void *core_handle = purple_get_core(); /* Clean up all of our state. */ otrl_userstate_free(otrg_plugin_userstate); otrg_plugin_userstate = NULL; - gaim_signal_disconnect(core_handle, "quitting", otrg_plugin_handle, - GAIM_CALLBACK(process_quitting)); - gaim_signal_disconnect(conv_handle, "sending-im-msg", otrg_plugin_handle, - GAIM_CALLBACK(process_sending_im)); - gaim_signal_disconnect(conv_handle, "receiving-im-msg", otrg_plugin_handle, - GAIM_CALLBACK(process_receiving_im)); - gaim_signal_disconnect(conv_handle, "conversation-created", - otrg_plugin_handle, GAIM_CALLBACK(process_conv_create)); - gaim_signal_disconnect(conn_handle, "signed-on", otrg_plugin_handle, - GAIM_CALLBACK(process_connection_change)); - gaim_signal_disconnect(conn_handle, "signed-off", otrg_plugin_handle, - 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); + purple_signal_disconnect(core_handle, "quitting", otrg_plugin_handle, + PURPLE_CALLBACK(process_quitting)); + purple_signal_disconnect(conv_handle, "sending-im-msg", otrg_plugin_handle, + PURPLE_CALLBACK(process_sending_im)); + purple_signal_disconnect(conv_handle, "receiving-im-msg", otrg_plugin_handle, + PURPLE_CALLBACK(process_receiving_im)); + purple_signal_disconnect(conv_handle, "conversation-created", + otrg_plugin_handle, PURPLE_CALLBACK(process_conv_create)); + purple_signal_disconnect(conn_handle, "signed-on", otrg_plugin_handle, + PURPLE_CALLBACK(process_connection_change)); + purple_signal_disconnect(conn_handle, "signed-off", otrg_plugin_handle, + PURPLE_CALLBACK(process_connection_change)); + purple_signal_disconnect(blist_handle, "blist-node-extended-menu", + otrg_plugin_handle, PURPLE_CALLBACK(supply_extended_menu)); +#if PURPLE_MAJOR_VERSION < 2 + purple_prefs_disconnect_callback(button_type_cbid); #endif - gaim_conversation_foreach(otrg_dialog_remove_conv); + purple_conversation_foreach(otrg_dialog_remove_conv); return 1; } @@ -652,13 +652,13 @@ #ifdef USING_GTK -static GaimGtkPluginUiInfo ui_info = +static PidginPluginUiInfo ui_info = { otrg_gtk_ui_make_widget }; #define UI_INFO &ui_info -#define PLUGIN_TYPE GAIM_GTK_PLUGIN_TYPE +#define PLUGIN_TYPE PIDGIN_PLUGIN_TYPE #else @@ -667,11 +667,11 @@ #endif -static GaimPluginInfo info = +static PurplePluginInfo info = { - GAIM_PLUGIN_MAGIC, + PURPLE_PLUGIN_MAGIC, -#if GAIM_MAJOR_VERSION < 2 +#if PURPLE_MAJOR_VERSION < 2 /* We stick with the functions in the gaim 1.0.x API for * compatibility. */ 1, /* major version */ @@ -682,11 +682,11 @@ 0, /* minor version */ #endif - GAIM_PLUGIN_STANDARD, /* type */ + PURPLE_PLUGIN_STANDARD, /* type */ PLUGIN_TYPE, /* ui_requirement */ 0, /* flags */ NULL, /* dependencies */ - GAIM_PRIORITY_DEFAULT, /* priority */ + PURPLE_PRIORITY_DEFAULT, /* priority */ "otr", /* id */ "Off-the-Record Messaging", /* name */ GAIM_OTR_VERSION, /* version */ @@ -711,7 +711,7 @@ }; static void -__init_plugin(GaimPlugin *plugin) +__init_plugin(PurplePlugin *plugin) { /* Set up the UI ops */ #ifdef USING_GTK @@ -723,4 +723,4 @@ OTRL_INIT; } -GAIM_INIT_PLUGIN(otr, __init_plugin, info) +PURPLE_INIT_PLUGIN(otr, __init_plugin, info) diff -ur gaim-otr.gaim/otr-plugin.h gaim-otr.pidgin/otr-plugin.h --- gaim-otr.gaim/otr-plugin.h 2005-10-16 16:59:34.000000000 +0100 +++ gaim-otr.pidgin/otr-plugin.h 2007-05-11 18:32:08.000000000 +0100 @@ -20,7 +20,7 @@ #ifndef __OTRG_OTR_PLUGIN_H__ #define __OTRG_OTR_PLUGIN_H__ -/* Gaim headers */ +/* Purple headers */ #include "account.h" #include "plugin.h" @@ -31,13 +31,13 @@ #define PRIVKEYFNAME "otr.private_key" #define STOREFNAME "otr.fingerprints" -extern GaimPlugin *otrg_plugin_handle; +extern PurplePlugin *otrg_plugin_handle; extern OtrlUserState otrg_plugin_userstate; /* Send an IM from the given account to the given recipient. Display an * error dialog if that account isn't currently logged in. */ -void otrg_plugin_inject_message(GaimAccount *account, const char *recipient, +void otrg_plugin_inject_message(PurpleAccount *account, const char *recipient, const char *message); /* Generate a private key for the given accountname/protocol */ @@ -46,13 +46,13 @@ /* Send the default OTR Query message to the correspondent of the given * context, from the given account. [account is actually a - * GaimAccount*, but it's declared here as void* so this can be passed + * PurpleAccount*, but it's declared here as void* so this can be passed * as a callback.] */ void otrg_plugin_send_default_query(ConnContext *context, void *account); /* Send the default OTR Query message to the correspondent of the given * conversation. */ -void otrg_plugin_send_default_query_conv(GaimConversation *conv); +void otrg_plugin_send_default_query_conv(PurpleConversation *conv); /* Disconnect a context, sending a notice to the other side, if * appropriate. */ @@ -61,12 +61,12 @@ /* Write the fingerprints to disk. */ void otrg_plugin_write_fingerprints(void); -/* Find the ConnContext appropriate to a given GaimConversation. */ -ConnContext *otrg_plugin_conv_to_context(GaimConversation *conv); +/* Find the ConnContext appropriate to a given PurpleConversation. */ +ConnContext *otrg_plugin_conv_to_context(PurpleConversation *conv); -/* Find the GaimConversation appropriate to the given ConnContext. If +/* Find the PurpleConversation appropriate to the given ConnContext. If * one doesn't yet exist, create it if force_create is true. */ -GaimConversation *otrg_plugin_context_to_conv(ConnContext *context, +PurpleConversation *otrg_plugin_context_to_conv(ConnContext *context, int force_create); typedef enum { diff -ur gaim-otr.gaim/ui.c gaim-otr.pidgin/ui.c --- gaim-otr.gaim/ui.c 2005-10-16 16:59:34.000000000 +0100 +++ gaim-otr.pidgin/ui.c 2007-05-11 18:32:08.000000000 +0100 @@ -69,16 +69,16 @@ void otrg_ui_connect_connection(ConnContext *context) { /* Send an OTR Query to the other side. */ - GaimAccount *account; + PurpleAccount *account; char *msg; /* Don't do this if we're already ENCRYPTED */ if (context == NULL || context->msgstate == OTRL_MSGSTATE_ENCRYPTED) return; - account = gaim_accounts_find(context->accountname, context->protocol); + account = purple_accounts_find(context->accountname, context->protocol); if (!account) { - GaimPlugin *p = gaim_find_prpl(context->protocol); + PurplePlugin *p = purple_find_prpl(context->protocol); msg = g_strdup_printf("Account %s (%s) could not be found", context->accountname, (p && p->info->name) ? p->info->name : "Unknown"); @@ -121,7 +121,7 @@ } /* Configure OTR for a particular buddy */ -void otrg_ui_config_buddy(GaimBuddy *buddy) +void otrg_ui_config_buddy(PurpleBuddy *buddy) { if (ui_ops != NULL) { ui_ops->config_buddy(buddy); @@ -129,10 +129,10 @@ } /* Calculate the policy for a particular account / username */ -OtrlPolicy otrg_ui_find_policy(GaimAccount *account, const char *name) +OtrlPolicy otrg_ui_find_policy(PurpleAccount *account, const char *name) { /* Check to see if the protocol for this account supports OTR at all. */ - const char *proto = gaim_account_get_protocol_id(account); + const char *proto = purple_account_get_protocol_id(account); if (!otrg_plugin_proto_supports_otr(proto)) { return OTRL_POLICY_NEVER; } diff -ur gaim-otr.gaim/ui.h gaim-otr.pidgin/ui.h --- gaim-otr.gaim/ui.h 2005-10-16 16:59:34.000000000 +0100 +++ gaim-otr.pidgin/ui.h 2007-05-11 18:32:08.000000000 +0100 @@ -27,9 +27,9 @@ void (*update_keylist)(void); - void (*config_buddy)(GaimBuddy *buddy); + void (*config_buddy)(PurpleBuddy *buddy); - OtrlPolicy (*find_policy)(GaimAccount *account, const char *name); + OtrlPolicy (*find_policy)(PurpleAccount *account, const char *name); } OtrgUiUiOps; /* Set the UI ops */ @@ -55,9 +55,9 @@ void otrg_ui_forget_fingerprint(Fingerprint *fingerprint); /* Configure OTR for a particular buddy */ -void otrg_ui_config_buddy(GaimBuddy *buddy); +void otrg_ui_config_buddy(PurpleBuddy *buddy); /* Calculate the policy for a particular account / username */ -OtrlPolicy otrg_ui_find_policy(GaimAccount *account, const char *name); +OtrlPolicy otrg_ui_find_policy(PurpleAccount *account, const char *name); #endif