[pkg-otr-team] [irssi-plugin-otr] 25/167: * Makefile.am: * configure.ac: * dialogs.c: * dialogs.h: * gtk-dialog.c: * gtk-dialog.h: * gtk-ui.c: * gtk-ui.h: * otr-plugin.c: * otr-plugin.h: * ui.c: * ui.h: Porting to Pidgin 2.0.0 thanks to Reza Jelveh <reza.jelveh at tuhh.de>.

Holger Levsen holger at moszumanska.debian.org
Mon Mar 3 21:55:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to tag 4.0.0
in repository irssi-plugin-otr.

commit c0964cbfa57a807007ae57aa6167d9dc4cc0a310
Author: cypherpunk <cypherpunk>
Date:   Sun May 6 20:22:21 2007 +0000

    	* Makefile.am:
    	* configure.ac:
    	* dialogs.c:
    	* dialogs.h:
    	* gtk-dialog.c:
    	* gtk-dialog.h:
    	* gtk-ui.c:
    	* gtk-ui.h:
    	* otr-plugin.c:
    	* otr-plugin.h:
    	* ui.c:
    	* ui.h: Porting to Pidgin 2.0.0 thanks to Reza Jelveh
    	<reza.jelveh at tuhh.de>.
    
    	* packaging/windows/gaim-otr.nsi:
    	* Makefile.mingw: Porting the Windows version to Pidgin 2.0.0.
---
 AUTHORS                          |   2 +-
 ChangeLog                        |  19 +++
 Makefile.am                      |  14 +-
 Makefile.mingw                   |  23 +--
 NEWS                             |   3 +
 README                           |  26 ++--
 configure.ac                     |   4 +-
 dialogs.c                        |  20 +--
 dialogs.h                        |  18 +--
 gtk-dialog.c                     | 247 +++++++++++++------------------
 gtk-dialog.h                     |   2 +-
 gtk-ui.c                         |  94 ++++++------
 gtk-ui.h                         |   4 +-
 otr-plugin.c                     | 306 ++++++++++++++++-----------------------
 otr-plugin.h                     |  20 +--
 packaging/windows/pidgin-otr.nsi | 220 ++++++++++++++++++++++++++++
 ui.c                             |  18 +--
 ui.h                             |  10 +-
 18 files changed, 595 insertions(+), 455 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 6381be9..dc38a08 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
-Off-the-Record Messaging plugin for gaim
+Off-the-Record Messaging plugin for pidgin
 
 Authors:
 
diff --git a/ChangeLog b/ChangeLog
index ae0a58f..18bdd3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2007-05-06
+
+	* Makefile.am:
+	* configure.ac:
+	* dialogs.c:
+	* dialogs.h:
+	* gtk-dialog.c:
+	* gtk-dialog.h:
+	* gtk-ui.c:
+	* gtk-ui.h:
+	* otr-plugin.c:
+	* otr-plugin.h:
+	* ui.c:
+	* ui.h: Porting to Pidgin 2.0.0 thanks to Reza Jelveh
+	<reza.jelveh at tuhh.de>.
+
+	* packaging/windows/gaim-otr.nsi:
+	* Makefile.mingw: Porting the Windows version to Pidgin 2.0.0.
+
 2006-11-28
 
 	* Makefile.mingw: Build under newer mingw cross-compilation
diff --git a/Makefile.am b/Makefile.am
index 0a071b6..ac0235a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,14 +1,14 @@
 AM_CFLAGS=	@LIBGCRYPT_CFLAGS@ @LIBOTR_CFLAGS@ @EXTRA_CFLAGS@
-AM_CFLAGS+=	-DUSING_GTK -DGAIM_PLUGINS \
-		-DGAIM_OTR_VERSION=\"@VERSION@\"
+AM_CFLAGS+=	-DUSING_GTK -DPURPLE_PLUGINS \
+		-DPIDGIN_OTR_VERSION=\"@VERSION@\"
 
-plugindir=		${libdir}/gaim
+plugindir=		${libdir}/pidgin
 
-plugin_LTLIBRARIES=	gaim-otr.la
+plugin_LTLIBRARIES=	pidgin-otr.la
 
-gaim_otr_la_SOURCES=		otr-plugin.c ui.c dialogs.c gtk-ui.c gtk-dialog.c
-gaim_otr_la_LDFLAGS=		-module -avoid-version
-gaim_otr_la_LDFLAGS+=	@LIBGCRYPT_LIBS@ @LIBOTR_LIBS@
+pidgin_otr_la_SOURCES=		otr-plugin.c ui.c dialogs.c gtk-ui.c gtk-dialog.c
+pidgin_otr_la_LDFLAGS=		-module -avoid-version
+pidgin_otr_la_LDFLAGS+=	@LIBGCRYPT_LIBS@ @LIBOTR_LIBS@
 
 EXTRA_DIST=		dialogs.h gtk-dialog.h gtk-ui.h otr-plugin.h ui.h \
 			Makefile.mingw packaging
diff --git a/Makefile.mingw b/Makefile.mingw
index 6e14c14..3850847 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -1,10 +1,11 @@
 WIN32=1
 
 # The version number to put in the plugin info
-GAIM_OTR_VERSION = 3.0.0
+PIDGIN_OTR_VERSION = 3.0.0
 
-# Replace this with the path to the GAIM headers
-GAIM_SOURCE ?= /usr/i586-mingw32msvc/include/gaim
+# Replace this with the path to the pidgin and purple headers
+PIDGIN_HEADERS ?= /usr/i586-mingw32msvc/include/pidgin
+PURPLE_HEADERS ?= /usr/i586-mingw32msvc/include/libpurple
 
 # If you don't have pkg-config, put the appropriate -I entry on the next line
 GTK_HDRS ?= `pkg-config --cflags glib-2.0 gtk+-2.0`
@@ -18,16 +19,16 @@ LIBOTRINCDIR = /usr/include
 LIBOTRLIBDIR = /usr/lib
 
 # The target
-TARGET = gaim-otr.so
+TARGET = pidgin-otr.so
 
 ifdef WIN32
 CC = i586-mingw32msvc-gcc
 LIBOTRINCDIR = /usr/i586-mingw32msvc/include
 LIBOTRLIBDIR = /usr/i586-mingw32msvc/lib
-TARGET = gaim-otr.dll
+TARGET = pidgin-otr.dll
 LDFLAGS = -Wl,--enable-auto-image-base
 LDLIBS = $(LIBOTRLIBDIR)/libotr.a -lgtk-win32-2.0 -lglib-2.0 -lgdk_pixbuf-2.0 \
-	 -lgobject-2.0 -lgaim -lgtkgaim -lgcrypt -lgpg-error
+	 -lgobject-2.0 -lpidgin -llibpurple -lgcrypt -lgpg-error
 else
 FPIC = -fPIC
 LDFLAGS = -module -avoid-version
@@ -35,13 +36,13 @@ LDLIBS = -lotr -lgcrypt
 endif
 
 # Install directory
-GAIMDIR = /usr/lib/gaim
-INSTALLDIR = $(DESTDIR)$(GAIMDIR)
+PIDGINDIR = /usr/lib/pidgin
+INSTALLDIR = $(DESTDIR)$(PIDGINDIR)
 
 CC ?= gcc
-override CFLAGS += -g -Wall -I$(GAIM_SOURCE) $(GTK_HDRS) \
-	-I$(LIBOTRINCDIR) $(FPIC) -DUSING_GTK -DGAIM_PLUGINS \
-	-DGAIM_OTR_VERSION=\"$(GAIM_OTR_VERSION)\"
+override CFLAGS += -g -Wall -I$(PIDGIN_HEADERS) -I$(PURPLE_HEADERS) \
+	$(GTK_HDRS) -I$(LIBOTRINCDIR) $(FPIC) -DUSING_GTK -DPURPLE_PLUGINS \
+	-DPIDGIN_OTR_VERSION=\"$(PIDGIN_OTR_VERSION)\" -DPIDGIN_NAME=\"Pidgin\"
  
 all: $(TARGET)
 
diff --git a/NEWS b/NEWS
index 9901ffa..bb7cd07 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+06 May 2007:
+- Ported to Pidgin 2.0.0
+
 02 Nov 2005:
 - Released 3.0.0
 
diff --git a/README b/README
index 41fa31d..55b8eac 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
-		Off-the-Record Messaging plugin for GAIM
-			  v3.0.0,  2 Nov 2005
+	       Off-the-Record Messaging plugin for pidgin
+			  v3.0.0,  6 May 2007
 
-This is a gaim plugin which implements Off-the-Record (OTR) Messaging.
+This is a pidgin plugin which implements Off-the-Record (OTR) Messaging.
 It is known to work (at least) under the Linux and Windows versions of
-gaim (1.x).
+pidgin (2.0).
 
 OTR allows you to have private conversations over IM by providing:
  - Encryption
@@ -25,13 +25,11 @@ http://www.cypherpunks.ca/otr/
 
 USAGE
 
-Run gaim, and open the Preferences panel.  (If you had a copy of gaim
-running before you installed gaim-otr, you will need to restart it.)
-Choose "Plugins".  Find the Off-the-Record Messaging plugin, and enable
-it by selecting the "Load" box next to it.  This will cause
-"Off-the-Record Messaging" to appear under "Plugins" in the list at the
-left.  Click "Off-the-Record Messaging" to bring up the OTR UI.  The UI
-has two "pages": "Known fingerprints" and "Config".
+Run pidgin, and open the Plugins panel.  (If you had a copy of pidgin
+running before you installed pidgin-otr, you will need to restart it.)
+Find the Off-the-Record Messaging plugin, and enable it by selecting the
+checkbox next to it.  Click "Configure Plugin" to bring up the OTR UI.
+The UI has two "pages": "Known fingerprints" and "Config".
 
 The "Config" page allows you generate private keys, and to set OTR
 options.
@@ -143,7 +141,7 @@ Verify fingerprint
     Once you do this, the label on the OTR button will change to "OTR:
     Private".  Note that you only need to do this once per buddy (or
     once per fingerprint, if your buddy has more than one fingerprint).
-    gaim-otr will remember which fingerprints you have marked as
+    pidgin-otr will remember which fingerprints you have marked as
     verified.
 
 View secure session id
@@ -220,10 +218,10 @@ otr-dev:
 
 LICENSE
 
-The Off-the-Record Messaging plugin for gaim is covered by the following
+The Off-the-Record Messaging plugin for pidgin is covered by the following
 (GPL) license:
 
-    Off-the-Record Messaging plugin for gaim
+    Off-the-Record Messaging plugin for pidgin
     Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
 		             <otr at cypherpunks.ca>
 
diff --git a/configure.ac b/configure.ac
index 01c9970..afb5e6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_INIT(otr-plugin.c)
 
 AM_CONFIG_HEADER(config.h)
 
-AM_INIT_AUTOMAKE(gaim-otr, 3.0.0)
+AM_INIT_AUTOMAKE(pidgin-otr, 3.0.0)
 
 AC_PROG_CC
 
@@ -19,6 +19,6 @@ AM_PATH_LIBGCRYPT(1:1.2.0,,AC_MSG_ERROR(libgcrypt 1.2.0 or newer is required.))
 
 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 --git a/dialogs.c b/dialogs.c
index 8737228..0266278 100644
--- a/dialogs.c
+++ b/dialogs.c
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -24,14 +24,14 @@
 /* system headers */
 #include <stdlib.h>
 
-/* gaim headers */
+/* pidgin headers */
 #include "notify.h"
 
 /* libotr headers */
 #include <libotr/proto.h>
 #include <libotr/message.h>
 
-/* gaim-otr headers */
+/* pidgin-otr headers */
 #include "dialogs.h"
 #include "otr-plugin.h"
 
@@ -49,10 +49,10 @@ const OtrgDialogUiOps *otrg_dialog_get_ui_ops(void)
     return ui_ops;
 }
 
-/* This is just like gaim_notify_message, except: (a) it doesn't grab
+/* This is just like pidgin_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 @@ void otrg_dialog_notify_error(const char *accountname, const char *protocol,
 	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 @@ void otrg_dialog_notify_warning(const char *accountname, const char *protocol,
 	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 @@ void otrg_dialog_notify_info(const char *accountname, const char *protocol,
 	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 @@ 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)
 {
     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 --git a/dialogs.h b/dialogs.h
index 53eb858..733208e 100644
--- a/dialogs.h
+++ b/dialogs.h
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -20,7 +20,7 @@
 #ifndef __OTRG_DIALOGS_H__
 #define __OTRG_DIALOGS_H__
 
-/* gaim headers */
+/* pidgin headers */
 #include "notify.h"
 
 /* libotr headers */
@@ -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 @@ typedef struct {
 
     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 @@ void otrg_dialog_set_ui_ops(const OtrgDialogUiOps *ops);
 /* 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 pidgin_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_finished(const char *accountname, const char *protocol,
 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 --git a/gtk-dialog.c b/gtk-dialog.c
index b42a909..df5a97d 100644
--- a/gtk-dialog.c
+++ b/gtk-dialog.c
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -25,13 +25,9 @@
 /* gcrypt headers */
 #include <gcrypt.h>
 
-/* gaim headers */
+/* purple headers */
 #include "version.h"
-#if GAIM_MAJOR_VERSION < 2
-#include "stock.h"
-#else
-#include "gaimstock.h"
-#endif
+#include "pidginstock.h"
 #include "plugin.h"
 #include "notify.h"
 #include "gtkconv.h"
@@ -46,7 +42,7 @@
 #include <libotr/message.h>
 #include <libotr/userstate.h>
 
-/* gaim-otr headers */
+/* purple-otr headers */
 #include "otr-plugin.h"
 #include "dialogs.h"
 #include "ui.h"
@@ -633,7 +629,7 @@ static void message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget)
     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 +643,16 @@ static GtkWidget *create_dialog(GaimNotifyMsgType type, const char *title,
     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 +665,7 @@ static GtkWidget *create_dialog(GaimNotifyMsgType type, const char *title,
 	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_ALERT_TITLE,
 					 NULL, 0, GTK_STOCK_OK,
 					 GTK_RESPONSE_ACCEPT, NULL);
     gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT,
@@ -720,10 +716,10 @@ static GtkWidget *create_dialog(GaimNotifyMsgType type, const char *title,
     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 +737,7 @@ struct s_OtrgDialogWait {
 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 +746,14 @@ static OtrgDialogWaitHandle otrg_gtk_dialog_private_key_wait_start(
     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 +774,16 @@ static int otrg_gtk_dialog_display_otr_message(const char *accountname,
 	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);
-#else
-    conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account);
-#endif
+    conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account);
     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 +838,7 @@ static void add_whatsthis_more(GtkWidget *vbox, const char *whatsthismarkup,
     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 +881,7 @@ static void otrg_gtk_dialog_unknown_fingerprint(OtrlUserState us,
 {
     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 +889,7 @@ static void otrg_gtk_dialog_unknown_fingerprint(OtrlUserState us,
 	    (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 +898,7 @@ static void otrg_gtk_dialog_unknown_fingerprint(OtrlUserState us,
 
 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,24 +909,16 @@ static void dialog_update_label_conv(GaimConversation *conv, TrustLevel level)
     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");
-    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");
-#endif
+    menuend = purple_conversation_get_data(conv, "otr-menuend");
+    menuview = purple_conversation_get_data(conv, "otr-menuview");
+    menuverf = purple_conversation_get_data(conv, "otr-menuverf");
 
     /* Set the button's icon, label and tooltip. */
     otr_icon(icon, level);
@@ -958,38 +942,22 @@ static void dialog_update_label_conv(GaimConversation *conv, TrustLevel level)
     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) {
-	/* Hide the text */
-	gtk_widget_hide(icontext);
-	gtk_widget_hide(label);
-    }
-    if (buttonstyle == GAIM_BUTTON_TEXT) {
-	/* Hide the icon */
-	gtk_widget_hide(icontext);
-	gtk_widget_hide(icon);
-    }
-#endif
 }
 
 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);
-#else
-    conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account);
-#endif
+    conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, context->username, account);
     if (!conv) return;
     dialog_update_label_conv(conv, level);
 }
@@ -1042,7 +1010,7 @@ static GtkWidget* otrg_gtk_dialog_view_sessionid(ConnContext *context)
 	    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 +1153,7 @@ static void otrg_gtk_dialog_verify_fingerprint(Fingerprint *fprint)
     char *secondary;
     struct vrfy_fingerprint_data *vfd;
     ConnContext *context;
-    GaimPlugin *p;
+    PurplePlugin *p;
     char *proto_name;
 
     if (fprint == NULL) return;
@@ -1202,13 +1170,13 @@ static void otrg_gtk_dialog_verify_fingerprint(Fingerprint *fprint)
 
     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 +1188,7 @@ static void otrg_gtk_dialog_verify_fingerprint(Fingerprint *fprint)
 /* 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 +1202,11 @@ static void otrg_gtk_dialog_connected(ConnContext *context)
 		    /* 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 +1215,14 @@ static void otrg_gtk_dialog_connected(ConnContext *context)
 /* 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 +1234,19 @@ static void otrg_gtk_dialog_finished(const char *accountname,
 	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);
-#else
-    conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account);
-#endif
+    conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account);
     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 +1256,7 @@ static void otrg_gtk_dialog_finished(const char *accountname,
  * 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 +1271,11 @@ static void otrg_gtk_dialog_stillconnected(ConnContext *context)
 		    /* 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 +1287,15 @@ static void otrg_gtk_dialog_clicked_connect(GtkWidget *widget, gpointer data)
 {
     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 +1303,7 @@ static void otrg_gtk_dialog_clicked_connect(GtkWidget *widget, gpointer data)
 
 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 +1314,7 @@ static void view_sessionid(GtkWidget *widget, gpointer data)
 
 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 +1325,27 @@ static void verify_fingerprint(GtkWidget *widget, gpointer data)
 
 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 +1357,9 @@ static gboolean button_pressed(GtkWidget *w, GdkEventButton *event,
 
 /* 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 +1374,9 @@ static void button_destroyed(GtkWidget *w, GaimConversation *conv)
 }
 
 /* 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,20 +1395,15 @@ static void otrg_gtk_dialog_new_conv(GaimConversation *conv)
     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;
+    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
+	/* Check if we've been removed from the bbox; purple does this
 	 * when the user changes her prefs for the style of buttons to
 	 * display. */
 	GList *children = gtk_container_get_children(GTK_CONTAINER(bbox));
@@ -1508,15 +1467,15 @@ static void otrg_gtk_dialog_new_conv(GaimConversation *conv)
     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 +1498,31 @@ static void otrg_gtk_dialog_new_conv(GaimConversation *conv)
 }
 
 /* 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;
-#else
-    if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return;
-#endif
+    if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) return;
 
-    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;
-#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);
+    if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) return;
+
+    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 +1530,10 @@ static void dialog_resensitize(GaimConversation *conv)
     } 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 +1548,7 @@ static void dialog_resensitize(GaimConversation *conv)
  * 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 --git a/gtk-dialog.h b/gtk-dialog.h
index e1355b2..a9951a5 100644
--- a/gtk-dialog.h
+++ b/gtk-dialog.h
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
diff --git a/gtk-ui.c b/gtk-ui.c
index cae717e..efc01dd 100644
--- a/gtk-ui.c
+++ b/gtk-ui.c
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -26,13 +26,13 @@
 /* libotr headers */
 #include <libotr/privkey.h>
 
-/* gaim headers */
+/* purple headers */
 #include "util.h"
 #include "account.h"
 #include "notify.h"
 #include "gtkutils.h"
 
-/* gaim-otr headers */
+/* purple-otr headers */
 #include "dialogs.h"
 #include "ui.h"
 #include "otr-plugin.h"
@@ -65,7 +65,7 @@ static const gchar *trust_states[] = {
     "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 @@ static void account_menu_changed_cb(GtkWidget *item, GaimAccount *account,
     
     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 @@ static GtkWidget *accountmenu_get_selected_item(void)
     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 GaimAccount *item_get_account(GtkWidget *item)
 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 @@ static void otrg_gtk_ui_update_fingerprint(void)
     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 @@ static void otrg_gtk_ui_update_keylist(void)
     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 @@ static void otrg_gtk_ui_update_keylist(void)
 		"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 otrg_gtk_ui_update_keylist(void)
 
 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 create_otroption_buttons(struct otroptionsdata *oo,
 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_load(gboolean *enabledp,
 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 @@ static void make_privkeys_ui(GtkWidget *vbox)
     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 @@ static void make_fingerprints_ui(GtkWidget *vbox)
 }
 
 /* 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 @@ GtkWidget* otrg_gtk_ui_make_widget(GaimPlugin *plugin)
 
 struct cbdata {
     GtkWidget *dialog;
-    GaimBuddy *buddy;
+    PurpleBuddy *buddy;
     GtkWidget *defaultbox;
     struct otroptionsdata oo;
 };
@@ -807,7 +807,7 @@ static void config_buddy_response_cb(GtkDialog *dialog, gint resp,
     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 @@ static void otrg_gtk_ui_config_buddy(GaimBuddy *buddy)
     /* Set the title */
 
     label_text = g_strdup_printf("<span weight=\"bold\" size=\"larger\">"
-	    "OTR Settings for %s</span>", gaim_buddy_get_contact_alias(buddy));
+	    "OTR Settings for %s</span>", purple_buddy_get_contact_alias(buddy));
 
     label = gtk_label_new(NULL);
 
@@ -882,10 +882,10 @@ static void otrg_gtk_ui_config_buddy(GaimBuddy *buddy)
 }
 
 /* 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 @@ static OtrlPolicy otrg_gtk_ui_find_policy(GaimAccount *account,
 	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 --git a/gtk-ui.h b/gtk-ui.h
index c2c3654..3e82cb6 100644
--- a/gtk-ui.h
+++ b/gtk-ui.h
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -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 --git a/otr-plugin.c b/otr-plugin.c
index d9c7da7..18f3845 100644
--- a/otr-plugin.c
+++ b/otr-plugin.c
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -30,8 +30,8 @@
 /* libgcrypt headers */
 #include <gcrypt.h>
 
-/* gaim headers */
-#include "gaim.h"
+/* purple headers */
+#include "pidgin.h"
 #include "notify.h"
 #include "version.h"
 #include "util.h"
@@ -39,7 +39,7 @@
 #include "core.h"
 
 #ifdef USING_GTK
-/* gaim GTK headers */
+/* purple GTK headers */
 #include "gtkplugin.h"
 #endif
 
@@ -49,13 +49,13 @@
 #include <libotr/message.h>
 #include <libotr/userstate.h>
 
-/* gaim-otr headers */
+/* purple-otr headers */
 #include "ui.h"
 #include "dialogs.h"
 #include "otr-plugin.h"
 
 #ifdef USING_GTK
-/* gaim-otr GTK headers */
+/* purple-otr GTK headers */
 #include "gtk-ui.h"
 #include "gtk-dialog.h"
 #endif
@@ -74,23 +74,23 @@
 #define g_fopen fopen
 #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");
@@ -104,12 +104,12 @@ void otrg_plugin_inject_message(GaimAccount *account, const char *recipient,
 
 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);
@@ -117,7 +117,7 @@ static OtrlPolicy policy_cb(void *opdata, ConnContext *context)
 
 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;
 }
@@ -135,7 +135,7 @@ void otrg_plugin_create_privkey(const char *accountname,
     OtrgDialogWaitHandle waithandle;
     FILE *privf;
 
-    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;
@@ -168,28 +168,24 @@ static void create_privkey_cb(void *opdata, const char *accountname,
 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);
-#else
-    return (GAIM_BUDDY_IS_ONLINE(buddy));
-#endif
+    return (PURPLE_BUDDY_IS_ONLINE(buddy));
 }
 
 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,
@@ -204,21 +200,21 @@ static void notify_cb(void *opdata, OtrlNotifyLevel level,
 	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 purplelevel = PURPLE_NOTIFY_MSG_ERROR;
 
     switch (level) {
 	case OTRL_NOTIFY_ERROR:
-	    gaimlevel = GAIM_NOTIFY_MSG_ERROR;
+	    purplelevel = PURPLE_NOTIFY_MSG_ERROR;
 	    break;
 	case OTRL_NOTIFY_WARNING:
-	    gaimlevel = GAIM_NOTIFY_MSG_WARNING;
+	    purplelevel = PURPLE_NOTIFY_MSG_WARNING;
 	    break;
 	case OTRL_NOTIFY_INFO:
-	    gaimlevel = GAIM_NOTIFY_MSG_INFO;
+	    purplelevel = PURPLE_NOTIFY_MSG_INFO;
 	    break;
     }
 
-    otrg_dialog_notify_message(gaimlevel, accountname, protocol,
+    otrg_dialog_notify_message(purplelevel, accountname, protocol,
 	    username, title, primary, secondary);
 }
 
@@ -266,7 +262,7 @@ static void still_secure_cb(void *opdata, ConnContext *context, int is_reply)
 
 static void log_message_cb(void *opdata, const char *message)
 {
-    gaim_debug_info("otr", message);
+    purple_debug_info("otr", message);
 }
 
 static OtrlMessageAppOps ui_ops = {
@@ -287,19 +283,19 @@ static OtrlMessageAppOps ui_ops = {
     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,
@@ -324,11 +320,11 @@ static void process_sending_im(GaimAccount *account, char *who, char **message,
 
 /* 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,
@@ -338,15 +334,15 @@ void otrg_plugin_send_default_query(ConnContext *context, void *vaccount)
 
 /* 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));
@@ -354,7 +350,7 @@ void otrg_plugin_send_default_query_conv(GaimConversation *conv)
     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;
@@ -368,9 +364,9 @@ static gboolean process_receiving_im(GaimAccount *account, char **who,
     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,
@@ -408,66 +404,45 @@ static gboolean process_receiving_im(GaimAccount *account, char **who,
     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
-/* 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)
-{
-    /* If the user changes the style of the buttons at the bottom of the
-     * conversation window, gaim annoyingly removes all the buttons from
-     * the bbox, and reinserts its own.  So we need to reinsert our
-     * buttons as well. */
-    otrg_dialog_resensitize_all();
-}
-#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;
-#else
-    GaimMenuAction *act;
-#endif
-    GaimBuddy *buddy;
-    GaimAccount *acct;
+    PurpleMenuAction *act;
+    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);
-#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);
 }
 
@@ -483,7 +458,7 @@ void otrg_plugin_disconnect(ConnContext *context)
 void otrg_plugin_write_fingerprints(void)
 {
     FILE *storef;
-    gchar *storefile = g_build_filename(gaim_user_dir(), STOREFNAME, NULL);
+    gchar *storefile = g_build_filename(purple_user_dir(), STOREFNAME, NULL);
     storef = g_fopen(storefile, "wb");
     g_free(storefile);
     if (!storef) return;
@@ -491,19 +466,19 @@ void otrg_plugin_write_fingerprints(void)
     fclose(storef);
 }
 
-/* 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);
@@ -512,28 +487,20 @@ ConnContext *otrg_plugin_conv_to_context(GaimConversation *conv)
     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);
-#else
-    conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account);
-#endif
+    conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, context->username, account);
     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
+	conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, context->username);
     }
 
     return conv;
@@ -572,19 +539,15 @@ static void process_quitting(void)
     }
 }
 
-#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)
+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();
     FILE *privf;
     FILE *storef;
 
@@ -612,61 +575,53 @@ static gboolean otr_plugin_load(GaimPlugin *handle)
 
     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",
-	    process_button_type_change, NULL);
-#endif
-
-    gaim_conversation_foreach(otrg_dialog_new_conv);
+    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);
+
+    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);
-#endif
-
-    gaim_conversation_foreach(otrg_dialog_remove_conv);
+    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));
+
+    purple_conversation_foreach(otrg_dialog_remove_conv);
 
     return 1;
 }
@@ -684,13 +639,13 @@ int otrg_plugin_proto_supports_otr(const char *proto)
 
 #ifdef USING_GTK
 
-static GaimGtkPluginUiInfo ui_info =
+static PurplePluginUiInfo 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
 
@@ -699,29 +654,22 @@ static GaimGtkPluginUiInfo ui_info =
 
 #endif
 
-static GaimPluginInfo info =
+static PurplePluginInfo info =
 {
-	GAIM_PLUGIN_MAGIC,
+	PURPLE_PLUGIN_MAGIC,
 
-#if GAIM_MAJOR_VERSION < 2
-	/* We stick with the functions in the gaim 1.0.x API for
-	 * compatibility. */
-        1,                                                /* major version  */
-	0,                                                /* minor version  */
-#else
         /* Use the 2.0.x API */
         2,                                                /* major version  */
 	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        */
+	PIDGIN_OTR_VERSION,                                 /* version        */
 	                                                  /* summary        */
 	"Provides private and secure conversations",
 	                                                  /* description    */
@@ -743,7 +691,7 @@ static GaimPluginInfo info =
 };
 
 static void
-__init_plugin(GaimPlugin *plugin)
+__init_plugin(PurplePlugin *plugin)
 {
     /* Set up the UI ops */
 #ifdef USING_GTK
@@ -755,4 +703,4 @@ __init_plugin(GaimPlugin *plugin)
     OTRL_INIT;
 }
 
-GAIM_INIT_PLUGIN(otr, __init_plugin, info)
+PURPLE_INIT_PLUGIN(otr, __init_plugin, info)
diff --git a/otr-plugin.h b/otr-plugin.h
index 46733d3..cbdf322 100644
--- a/otr-plugin.h
+++ b/otr-plugin.h
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -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 @@ void otrg_plugin_create_privkey(const char *accountname,
 
 /* 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 @@ void otrg_plugin_disconnect(ConnContext *context);
 /* 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 --git a/packaging/windows/pidgin-otr.nsi b/packaging/windows/pidgin-otr.nsi
new file mode 100644
index 0000000..2d03558
--- /dev/null
+++ b/packaging/windows/pidgin-otr.nsi
@@ -0,0 +1,220 @@
+; Script based on generated HM NIS Edit Script Wizard.
+; Forgive me, i am new at this. -- {paul,iang}@cypherpunks.ca
+;
+; known issue. installer induced uninstaller abortion causes overwrite by installer without
+; uninstall.
+; v3.0.0    - Version for pidgin-2.0.0
+; v3.0.0   - Bump version number.
+; v2.0.2   - Bump version number.
+; v2.0.1   - Bump version number.
+; v2.0.0-2 - linking to libotr-2.0.1
+; v2.0.0   - Bump version number. Fixed upgrading gaim2-otr (it didn't overwrite the dll)
+;            bug reported by Aldert Hazenberg <aldert at xelerance.com>
+;          - Added many safeguards and fixed conditions of failures when gaim is running
+;             during install, or failed to (un)install previously.
+;           - Removed popup signifying gaim is found
+; v1.99.0-1 - Bump version number, install Protocol.txt file
+; v1.0.3-2  - Fix for detecting gaim if not installed by Administrator
+;             bug report by Joanna Rutkowska <joanna at mailsnare.net>
+;           - Fix for uninstalling the dll when not installed as Administrator
+; v1.0.3    - Initial version
+
+
+; todo: SetBrandingImage
+; HM NIS Edit Wizard helper defines
+!define PRODUCT_NAME "pidgin-otr"
+!define PRODUCT_VERSION "3.0.0"
+!define PRODUCT_PUBLISHER "Cypherpunks CA"
+!define PRODUCT_WEB_SITE "http://otr.cypherpunks.ca/"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+; MUI 1.67 compatible ------
+!include "MUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
+!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+!insertmacro MUI_PAGE_LICENSE "c:\otr\COPYING.txt"
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+
+; MUI end ------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
+InstallDir "$PROGRAMFILES\pidgin-otr"
+InstallDirRegKey HKEY_LOCAL_MACHINE SOFTWARE\pidgin-otr "Install_Dir"
+;WriteRegStr HKLM "SOFTWARE\pidgin-otr" "pidgindir" ""
+
+Var "PidginDir"
+
+ShowInstDetails show
+ShowUnInstDetails show
+
+Section "MainSection" SEC01
+;InstallDir "$PROGRAMFILES\Pidgin\plugins"
+
+; uninstall previous pidgin-otr install if found.
+Call UnInstOld
+ ;Check for pidgin installation
+Call GetPidginInstPath
+WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\pidgin-otr" "pidgindir" "$PidginDir"
+
+	SetOutPath "$INSTDIR"
+  SetOverwrite on
+  File "c:\otr\pidgin-otr.dll"
+  ; move to pidgin plugin directory, check if not busy (pidgin is running)
+	call CopyDLL
+  ; hard part is done, do the rest now.
+  SetOverwrite on	  
+  File "c:\otr\README.Toolkit.txt"
+	File "c:\otr\README.txt"
+	File "c:\otr\Protocol-v2.html"
+	File "c:\otr\COPYING.txt"
+	File "c:\otr\COPYING.LIB.txt"
+	File "c:\otr\otr_mackey.exe"
+	File "c:\otr\otr_modify.exe"
+	File "c:\otr\otr_parse.exe"
+	File "c:\otr\otr_readforge.exe"
+	File "c:\otr\otr_remac.exe"
+	File "c:\otr\otr_sesskeys.exe"
+	File "c:\otr\pidgin-otr.nsi"
+SectionEnd
+
+Section -AdditionalIcons
+  CreateDirectory "$SMPROGRAMS\pidgin-otr"
+  CreateShortCut "$SMPROGRAMS\pidgin-otr\Uninstall.lnk" "$INSTDIR\pidgin-otr-uninst.exe"
+SectionEnd
+
+Section -Post
+  WriteUninstaller "$INSTDIR\pidgin-otr-uninst.exe"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\pidgin-otr-uninst.exe"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+ 
+SectionEnd
+
+Function un.onUninstSuccess
+  HideWindow
+  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
+FunctionEnd
+
+Function un.onInit
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+  Abort
+FunctionEnd
+
+Section Uninstall
+  Delete "$INSTDIR\pidgin-otr-uninst.exe"
+	Delete "$INSTDIR\README.Toolkit.txt"
+	Delete "$INSTDIR\README.txt"
+	Delete "$INSTDIR\Protocol-v2.txt"
+	Delete "$INSTDIR\COPYING.txt"
+	Delete "$INSTDIR\COPYING.LIB.txt"
+	Delete "$INSTDIR\otr_mackey.exe"
+	Delete "$INSTDIR\otr_modify.exe"
+	Delete "$INSTDIR\otr_parse.exe"
+	Delete "$INSTDIR\otr_readforge.exe"
+	Delete "$INSTDIR\otr_remac.exe"
+	Delete "$INSTDIR\otr_sesskeys.exe"
+	Delete "$INSTDIR\pidgin-otr.nsi"
+  Delete "$SMPROGRAMS\pidgin-otr\Uninstall.lnk"
+  RMDir "$SMPROGRAMS\pidgin-otr"
+  RMDir "$INSTDIR"
+  
+	ReadRegStr $PidginDir HKLM Software\pidgin-otr "pidgindir"
+	IfFileExists "$PidginDir\plugins\pidgin-otr.dll" dodelete
+  ReadRegStr $PidginDir HKCU Software\pidgin-otr "pidgindir"
+	IfFileExists "$PidginDir\plugins\pidgin-otr.dll" dodelete
+	
+  ReadRegStr $PidginDir HKLM Software\pidgin-otr "pidgindir"
+	IfFileExists "$PidginDir\plugins\pidgin-otr.dll" dodelete
+  ReadRegStr $PidginDir HKCU Software\Pidgin-otr "pidgindir"
+	IfFileExists "$PidginDir\plugins\pidgin-otr.dll" dodelete
+  MessageBox MB_OK|MB_ICONINFORMATION "Could not find pidgin plugin directory, pidgin-otr.dll not uninstalled!" IDOK ok
+dodelete:
+	Delete "$PidginDir\plugins\pidgin-otr.dll"
+	
+	IfFileExists "$PidginDir\plugins\pidgin-otr.dll" 0 +2
+		MessageBox MB_OK|MB_ICONINFORMATION "pidgin-otr.dll is busy. Probably Pidgin is still running. Please delete $PidginDir\plugins\pidgin-otr.dll manually."
+  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\pidgin-otr\pidgindir"
+ok:
+SetAutoClose true
+SectionEnd
+Function GetPidginInstPath
+  Push $0
+  ReadRegStr $0 HKLM "Software\pidgin" ""
+	IfFileExists "$0\pidgin.exe" cont
+	ReadRegStr $0 HKCU "Software\pidgin" ""
+	IfFileExists "$0\pidgin.exe" cont
+  MessageBox MB_OK|MB_ICONINFORMATION "Failed to find Pidgin installation."
+		Abort "Failed to find Pidgin installation. Please install Pidgin first."
+cont:
+	StrCpy $PidginDir $0
+	;MessageBox MB_OK|MB_ICONINFORMATION "Pidgin plugin directory found at $PidginDir\plugins ."
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\pidgin-otr" "pidgindir" "$PidginDir"
+FunctionEnd
+
+Function UnInstOld
+	  Push $0
+	  ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
+		IfFileExists "$0" deinst cont
+	deinst:
+		MessageBox MB_OK|MB_ICONEXCLAMATION  "pidgin-otr was already found on your system and will first be uninstalled"
+		; the uninstaller copies itself to temp and execs itself there, so it can delete 
+		; everything including its own original file location. To prevent the installer and
+		; uninstaller racing you can't simply ExecWait.
+		; We hide the uninstall because otherwise it gets really confusing window-wise
+		;HideWindow
+		  ClearErrors
+			ExecWait '"$0" _?=$INSTDIR'
+			IfErrors 0 cont
+				MessageBox MB_OK|MB_ICONEXCLAMATION  "Uninstall failed or aborted"
+				Abort "Uninstalling of the previous version gave an error. Install aborted."
+			
+		;BringToFront
+	cont:
+		;MessageBox MB_OK|MB_ICONINFORMATION "No old pidgin-otr found, continuing."
+		
+FunctionEnd
+
+Function CopyDLL
+SetOverwrite try
+ClearErrors
+; 3 hours wasted so you guys don't need a reboot!
+; Rename /REBOOTOK "$INSTDIR\pidgin-otr.dll" "$PidginDir\plugins\pidgin-otr.dll"
+IfFileExists "$PidginDir\plugins\pidgin-otr.dll" 0 copy ; remnant or uninstall prev version failed
+Delete "$PidginDir\plugins\pidgin-otr.dll"
+copy:
+ClearErrors
+Rename "$INSTDIR\pidgin-otr.dll" "$PidginDir\plugins\pidgin-otr.dll"
+IfErrors dllbusy
+	Return
+dllbusy:
+	MessageBox MB_RETRYCANCEL "pidgin-otr.dll is busy. Please close Pidgin (including tray icon) and try again" IDCANCEL cancel
+	Delete "$PidginDir\plugins\pidgin-otr.dll"
+	Goto copy
+	Return
+cancel:
+	Abort "Installation of pidgin-otr aborted"
+FunctionEnd
diff --git a/ui.c b/ui.c
index f12361e..11dff02 100644
--- a/ui.c
+++ b/ui.c
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -20,7 +20,7 @@
 /* system headers */
 #include <stdlib.h>
 
-/* gaim headers */
+/* purple headers */
 #include "util.h"
 #include "account.h"
 
@@ -29,7 +29,7 @@
 #include <libotr/proto.h>
 #include <libotr/message.h>
 
-/* gaim-otr headers */
+/* purple-otr headers */
 #include "ui.h"
 #include "dialogs.h"
 #include "otr-plugin.h"
@@ -69,16 +69,16 @@ void otrg_ui_update_keylist(void)
 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 @@ 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)
 {
     if (ui_ops != NULL) {
 	ui_ops->config_buddy(buddy);
@@ -129,10 +129,10 @@ void otrg_ui_config_buddy(GaimBuddy *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)
 {
     /* 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 --git a/ui.h b/ui.h
index 10896df..c510928 100644
--- a/ui.h
+++ b/ui.h
@@ -1,5 +1,5 @@
 /*
- *  Off-the-Record Messaging plugin for gaim
+ *  Off-the-Record Messaging plugin for pidgin
  *  Copyright (C) 2004-2005  Nikita Borisov and Ian Goldberg
  *                           <otr at cypherpunks.ca>
  *
@@ -27,9 +27,9 @@ typedef struct {
 
     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_disconnect_connection(ConnContext *context);
 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-otr/packages/irssi-plugin-otr.git



More information about the Pkg-otr-team mailing list