[OTR-dev] otr against gaim-cvs
Ian Goldberg
ian at cypherpunks.ca
Thu Nov 17 08:46:28 EST 2005
On Thu, Nov 17, 2005 at 03:38:09AM -0500, Andrew Rodland wrote:
> Is there a tree anywhere that's tracking the changes going into gaim (pre-2.0)
> CVS, or are the devs waiting for things to settle down first? I'm tracking
> gaim-cvs, so if there's an otr-cvs, I'm willing to keep on it and find out
> when and how it breaks :)
Someone's sent in a patch, which we'll look at when we get a chance (at
the end of the month). We'll probably stick it in CVS if it looks
plausible, and then you'll be able to let us know what breaks. ;-)
Ah, whatever. Here's the patch that was sent in (only briefly looked
at by me). Have at it, and let us know... ;-)
- Ian
-------------- next part --------------
diff -Naur gaim-otr-3.0.0/gtk-dialog.c gaim-otr-3.0.0-gaim2/gtk-dialog.c
--- gaim-otr-3.0.0/gtk-dialog.c 2005-10-27 23:38:21.000000000 -0400
+++ gaim-otr-3.0.0-gaim2/gtk-dialog.c 2005-11-16 20:23:59.000000000 -0500
@@ -33,6 +33,7 @@
#include "gtkutils.h"
#include "gtkimhtml.h"
#include "util.h"
+#include "version.h"
/* libotr headers */
#include <libotr/dh.h>
@@ -779,7 +780,11 @@
account = gaim_accounts_find(accountname, protocol);
if (!account) return -1;
+#if GAIM_MAJOR_VERSION < 2
conv = gaim_find_conversation_with_account(username, account);
+#else
+ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account);
+#endif
if (!conv) return -1;
gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
@@ -968,7 +973,11 @@
account = gaim_accounts_find(context->accountname, context->protocol);
if (!account) return;
+#if GAIM_MAJOR_VERSION < 2
conv = gaim_find_conversation_with_account(context->username, account);
+#else
+ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account);
+#endif
if (!conv) return;
dialog_update_label_conv(conv, level);
}
@@ -1252,7 +1261,11 @@
account = gaim_accounts_find(accountname, protocol);
if (!account) return;
+#if GAIM_MAJOR_VERSION < 2
conv = gaim_find_conversation_with_account(username, account);
+#else
+ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account);
+#endif
if (!conv) return;
buf = g_strdup_printf("%s has ended his private conversation with you; "
@@ -1406,9 +1419,13 @@
GtkWidget *whatsthis;
/* Do nothing if this isn't an IM conversation */
+#if GAIM_MAJOR_VERSION < 2
if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return;
-
bbox = gtkconv->bbox;
+#else
+ if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return;
+ bbox = gtkconv->lower_hbox;
+#endif
context = otrg_plugin_conv_to_context(conv);
@@ -1515,7 +1532,11 @@
GtkWidget *button;
/* Do nothing if this isn't an IM conversation */
+#if GAIM_MAJOR_VERSION < 2
if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return;
+#else
+ if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return;
+#endif
button = gaim_conversation_get_data(conv, "otr-button");
if (button) gtk_object_destroy(GTK_OBJECT(button));
@@ -1531,7 +1552,11 @@
OtrlPolicy policy;
/* Do nothing if this isn't an IM conversation */
+#if GAIM_MAJOR_VERSION < 2
if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return;
+#else
+ if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return;
+#endif
account = gaim_conversation_get_account(conv);
name = gaim_conversation_get_name(conv);
diff -Naur gaim-otr-3.0.0/otr-plugin.c gaim-otr-3.0.0-gaim2/otr-plugin.c
--- gaim-otr-3.0.0/otr-plugin.c 2005-10-27 12:01:59.000000000 -0400
+++ gaim-otr-3.0.0-gaim2/otr-plugin.c 2005-11-15 21:08:51.000000000 -0500
@@ -32,11 +32,11 @@
/* gaim headers */
#include "gaim.h"
-#include "core.h"
#include "notify.h"
#include "version.h"
#include "util.h"
#include "debug.h"
+#include "core.h"
#ifdef USING_GTK
/* gaim GTK headers */
@@ -156,7 +156,11 @@
buddy = gaim_find_buddy(account, recipient);
if (!buddy) return -1;
+#if GAIM_MAJOR_VERSION < 2
return (buddy->present == GAIM_BUDDY_ONLINE);
+#else
+ return (GAIM_BUDDY_IS_ONLINE(buddy));
+#endif
}
static void inject_message_cb(void *opdata, const char *accountname,
@@ -430,7 +434,11 @@
proto = gaim_account_get_protocol_id(acct);
if (!otrg_plugin_proto_supports_otr(proto)) return;
+#if GAIM_MAJOR_VERSION < 2
act = gaim_blist_node_action_new("OTR Settings", otr_options_cb, NULL);
+#else
+ act = gaim_blist_node_action_new("OTR Settings", otr_options_cb, NULL, NULL);
+#endif
*menu = g_list_append(*menu, act);
}
@@ -482,9 +490,17 @@
account = gaim_accounts_find(context->accountname, context->protocol);
if (account == NULL) return NULL;
+#if GAIM_MAJOR_VERSION < 2
conv = gaim_find_conversation_with_account(context->username, account);
+#else
+ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account);
+#endif
if (conv == NULL && force_create) {
+#if GAIM_MAJOR_VERSION < 2
conv = gaim_conversation_new(GAIM_CONV_IM, account, context->username);
+#else
+ conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, context->username);
+#endif
}
return conv;
@@ -567,9 +583,15 @@
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);
+#else
+ button_type_cbid = gaim_prefs_connect_callback(NULL,
+ "/gaim/gtk/conversations/button_type",
+ process_button_type_change, NULL);
+#endif
gaim_conversation_foreach(otrg_dialog_new_conv);
@@ -642,7 +664,12 @@
/* We stick with the functions in the gaim 1.0.x API for
* compatibility. */
- 1, /* major version */
+#if GAIM_MAJOR_VERSION < 2
+ 1, /* major version */
+#else
+ /* The 2.0.x API is causing no trouble - Dustin */
+ 2, /* major version */
+#endif
0, /* minor version */
GAIM_PLUGIN_STANDARD, /* type */
More information about the OTR-dev
mailing list