diff --git a/security/gaim-otr/Makefile b/security/gaim-otr/Makefile index 9f5425826eb..9c578097846 100644 --- a/security/gaim-otr/Makefile +++ b/security/gaim-otr/Makefile @@ -1,10 +1,9 @@ -# $OpenBSD: Makefile,v 1.6 2006/08/03 23:28:11 espie Exp $ +# $OpenBSD: Makefile,v 1.7 2006/10/31 20:15:30 alek Exp $ COMMENT= "Allows deniable private conversations using GAIM" -VERSION= 3.0.0 -DISTNAME= gaim-otr-${VERSION} -#PKGNAME= ${DISTNAME}p0 +DISTNAME= gaim-otr-3.0.0 +PKGNAME= ${DISTNAME}p0 CATEGORIES= security net HOMEPAGE= http://www.cypherpunks.ca/otr/ \ @@ -17,12 +16,13 @@ PERMIT_PACKAGE_FTP= Yes PERMIT_DISTFILES_CDROM= Yes PERMIT_DISTFILES_FTP= Yes -BUILD_DEPENDS= ::net/gaim -RUN_DEPENDS= gaim::net/gaim -LIB_DEPENDS= otr.>=2::security/libotr \ +RUN_DEPENDS= :gaim-2.0.0beta4:net/gaim +BUILD_DEPENDS= ${RUN_DEPENDS} +LIB_DEPENDS= otr.>=3:libotr->=3.0.0p0:security/libotr \ gcrypt.>=12:libgcrypt->=1.2:security/libgcrypt -WANTLIB= gpg-error iconv intl +MODULES= devel/gettext +WANTLIB= gpg-error USE_X11= Yes USE_LIBTOOL= Yes diff --git a/security/gaim-otr/patches/patch-gtk-dialog_c b/security/gaim-otr/patches/patch-gtk-dialog_c new file mode 100644 index 00000000000..9409c7d646c --- /dev/null +++ b/security/gaim-otr/patches/patch-gtk-dialog_c @@ -0,0 +1,129 @@ +$OpenBSD: patch-gtk-dialog_c,v 1.1 2006/10/31 20:15:30 alek Exp $ +--- gtk-dialog.c.orig Fri Oct 28 05:38:21 2005 ++++ gtk-dialog.c Sat Oct 28 23:52:37 2006 +@@ -26,7 +26,12 @@ + #include + + /* gaim headers */ ++#include "version.h" ++#if GAIM_MAJOR_VERSION < 2 + #include "stock.h" ++#else ++#include "gaimstock.h" ++#endif + #include "plugin.h" + #include "notify.h" + #include "gtkconv.h" +@@ -779,7 +784,11 @@ static int otrg_gtk_dialog_display_otr_m + account = gaim_accounts_find(accountname, protocol); + if (!account) return -1; + ++#if GAIM_MAJOR_VERSION < 2 + conv = gaim_find_conversation_with_account(username, account); ++#else ++ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); ++#endif + if (!conv) return -1; + + gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); +@@ -908,7 +917,11 @@ static void dialog_update_label_conv(Gai + GtkWidget *menuquerylabel; + GtkWidget *menuview; + GtkWidget *menuverf; ++#if GAIM_MAJOR_VERSION < 2 ++ /* gaim-2.0.0 no longer has the row of buttons, so it doesn't have ++ * the button_type pref */ + GaimButtonStyle buttonstyle; ++#endif + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + label = gaim_conversation_get_data(conv, "otr-label"); + icon = gaim_conversation_get_data(conv, "otr-icon"); +@@ -919,7 +932,9 @@ static void dialog_update_label_conv(Gai + menuend = gaim_conversation_get_data(conv, "otr-menuend"); + menuview = gaim_conversation_get_data(conv, "otr-menuview"); + menuverf = gaim_conversation_get_data(conv, "otr-menuverf"); ++#if GAIM_MAJOR_VERSION < 2 + buttonstyle = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); ++#endif + + /* Set the button's icon, label and tooltip. */ + otr_icon(icon, level); +@@ -948,6 +963,7 @@ static void dialog_update_label_conv(Gai + + /* Set the appropriate visibility */ + gtk_widget_show_all(button); ++#if GAIM_MAJOR_VERSION < 2 + if (buttonstyle == GAIM_BUTTON_IMAGE) { + /* Hide the text */ + gtk_widget_hide(icontext); +@@ -958,6 +974,7 @@ static void dialog_update_label_conv(Gai + gtk_widget_hide(icontext); + gtk_widget_hide(icon); + } ++#endif + } + + static void dialog_update_label(ConnContext *context) +@@ -968,7 +985,11 @@ static void dialog_update_label(ConnCont + + account = gaim_accounts_find(context->accountname, context->protocol); + if (!account) return; ++#if GAIM_MAJOR_VERSION < 2 + conv = gaim_find_conversation_with_account(context->username, account); ++#else ++ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account); ++#endif + if (!conv) return; + dialog_update_label_conv(conv, level); + } +@@ -1252,7 +1273,11 @@ static void otrg_gtk_dialog_finished(con + account = gaim_accounts_find(accountname, protocol); + if (!account) return; + ++#if GAIM_MAJOR_VERSION < 2 + conv = gaim_find_conversation_with_account(username, account); ++#else ++ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); ++#endif + if (!conv) return; + + buf = g_strdup_printf("%s has ended his private conversation with you; " +@@ -1406,9 +1431,13 @@ static void otrg_gtk_dialog_new_conv(Gai + GtkWidget *whatsthis; + + /* Do nothing if this isn't an IM conversation */ ++#if GAIM_MAJOR_VERSION < 2 + if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) return; +- + bbox = gtkconv->bbox; ++#else ++ if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) return; ++ bbox = gtkconv->lower_hbox; ++#endif + + context = otrg_plugin_conv_to_context(conv); + +@@ -1515,7 +1544,11 @@ static void otrg_gtk_dialog_remove_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 + + button = gaim_conversation_get_data(conv, "otr-button"); + if (button) gtk_object_destroy(GTK_OBJECT(button)); +@@ -1531,7 +1564,11 @@ static void dialog_resensitize(GaimConve + 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 --git a/security/gaim-otr/patches/patch-otr-plugin_c b/security/gaim-otr/patches/patch-otr-plugin_c new file mode 100644 index 00000000000..14244be14cb --- /dev/null +++ b/security/gaim-otr/patches/patch-otr-plugin_c @@ -0,0 +1,239 @@ +$OpenBSD: patch-otr-plugin_c,v 1.1 2006/10/31 20:15:30 alek Exp $ +--- otr-plugin.c.orig Thu Oct 27 18:01:59 2005 ++++ otr-plugin.c Sat Oct 28 23:01:28 2006 +@@ -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 */ +@@ -60,6 +60,20 @@ + #include "gtk-dialog.h" + #endif + ++/* If we're using glib on Windows, we need to use g_fopen to open files. ++ * On other platforms, it's also safe to use it. If we're not using ++ * glib, just use fopen. */ ++#ifdef USING_GTK ++/* If we're cross-compiling, this might be wrong, so fix it. */ ++#ifdef WIN32 ++#undef G_OS_UNIX ++#define G_OS_WIN32 ++#endif ++#include ++#else ++#define g_fopen fopen ++#endif ++ + GaimPlugin *otrg_plugin_handle; + + /* We'll only use the one OtrlUserState. */ +@@ -119,19 +133,26 @@ void otrg_plugin_create_privkey(const ch + const char *protocol) + { + OtrgDialogWaitHandle waithandle; ++ FILE *privf; + + gchar *privkeyfile = g_build_filename(gaim_user_dir(), PRIVKEYFNAME, NULL); + if (!privkeyfile) { + fprintf(stderr, "Out of memory building filenames!\n"); + return; + } ++ privf = g_fopen(privkeyfile, "w+b"); ++ g_free(privkeyfile); ++ if (!privf) { ++ fprintf(stderr, "Could not write private key file\n"); ++ return; ++ } + + waithandle = otrg_dialog_private_key_wait_start(accountname, protocol); + + /* Generate the key */ +- otrl_privkey_generate(otrg_plugin_userstate, privkeyfile, ++ otrl_privkey_generate_FILEp(otrg_plugin_userstate, privf, + accountname, protocol); +- g_free(privkeyfile); ++ fclose(privf); + otrg_ui_update_fingerprint(); + + /* Mark the dialog as done. */ +@@ -156,7 +177,11 @@ static int is_logged_in_cb(void *opdata, + buddy = gaim_find_buddy(account, recipient); + if (!buddy) return -1; + ++#if GAIM_MAJOR_VERSION < 2 + return (buddy->present == GAIM_BUDDY_ONLINE); ++#else ++ return (GAIM_BUDDY_IS_ONLINE(buddy)); ++#endif + } + + static void inject_message_cb(void *opdata, const char *accountname, +@@ -395,6 +420,8 @@ static void process_connection_change(Ga + otrg_dialog_resensitize_all(); + } + ++#if GAIM_MAJOR_VERSION < 2 ++/* gaim-2.0.0 no longer has the row of buttons in question */ + static void process_button_type_change(const char *name, GaimPrefType type, + gpointer value, gpointer data) + { +@@ -404,6 +431,7 @@ static void process_button_type_change(c + * buttons as well. */ + otrg_dialog_resensitize_all(); + } ++#endif + + static void otr_options_cb(GaimBlistNode *node, gpointer user_data) + { +@@ -416,7 +444,11 @@ static void otr_options_cb(GaimBlistNode + + static void supply_extended_menu(GaimBlistNode *node, GList **menu) + { ++#if GAIM_MAJOR_VERSION < 2 + GaimBlistNodeAction *act; ++#else ++ GaimMenuAction *act; ++#endif + GaimBuddy *buddy; + GaimAccount *acct; + const char *proto; +@@ -430,7 +462,12 @@ static void supply_extended_menu(GaimBli + proto = gaim_account_get_protocol_id(acct); + if (!otrg_plugin_proto_supports_otr(proto)) return; + ++#if GAIM_MAJOR_VERSION < 2 + act = gaim_blist_node_action_new("OTR Settings", otr_options_cb, NULL); ++#else ++ act = gaim_menu_action_new("OTR Settings", (GaimCallback)otr_options_cb, ++ NULL, NULL); ++#endif + *menu = g_list_append(*menu, act); + } + +@@ -445,9 +482,13 @@ void otrg_plugin_disconnect(ConnContext + /* Write the fingerprints to disk. */ + void otrg_plugin_write_fingerprints(void) + { ++ FILE *storef; + gchar *storefile = g_build_filename(gaim_user_dir(), STOREFNAME, NULL); +- otrl_privkey_write_fingerprints(otrg_plugin_userstate, storefile); ++ storef = g_fopen(storefile, "wb"); + g_free(storefile); ++ if (!storef) return; ++ otrl_privkey_write_fingerprints_FILEp(otrg_plugin_userstate, storef); ++ fclose(storef); + } + + /* Find the ConnContext appropriate to a given GaimConversation. */ +@@ -482,9 +523,17 @@ GaimConversation *otrg_plugin_context_to + account = gaim_accounts_find(context->accountname, context->protocol); + if (account == NULL) return NULL; + ++#if GAIM_MAJOR_VERSION < 2 + conv = gaim_find_conversation_with_account(context->username, account); ++#else ++ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, context->username, account); ++#endif + if (conv == NULL && force_create) { ++#if GAIM_MAJOR_VERSION < 2 + conv = gaim_conversation_new(GAIM_CONV_IM, account, context->username); ++#else ++ conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, context->username); ++#endif + } + + return conv; +@@ -523,7 +572,10 @@ 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) + { +@@ -533,6 +585,8 @@ static gboolean otr_plugin_load(GaimPlug + void *conn_handle = gaim_connections_get_handle(); + void *blist_handle = gaim_blist_get_handle(); + void *core_handle = gaim_get_core(); ++ FILE *privf; ++ FILE *storef; + + if (!privkeyfile || !storefile) { + g_free(privkeyfile); +@@ -540,16 +594,21 @@ static gboolean otr_plugin_load(GaimPlug + return 0; + } + ++ privf = g_fopen(privkeyfile, "rb"); ++ storef = g_fopen(storefile, "rb"); ++ g_free(privkeyfile); ++ g_free(storefile); ++ + otrg_plugin_handle = handle; + + /* Make our OtrlUserState; we'll only use the one. */ + otrg_plugin_userstate = otrl_userstate_create(); + +- otrl_privkey_read(otrg_plugin_userstate, privkeyfile); +- g_free(privkeyfile); +- otrl_privkey_read_fingerprints(otrg_plugin_userstate, storefile, ++ otrl_privkey_read_FILEp(otrg_plugin_userstate, privf); ++ otrl_privkey_read_fingerprints_FILEp(otrg_plugin_userstate, storef, + NULL, NULL); +- g_free(storefile); ++ if (privf) fclose(privf); ++ if (storef) fclose(storef); + + otrg_ui_update_fingerprint(); + +@@ -567,9 +626,11 @@ static gboolean otr_plugin_load(GaimPlug + GAIM_CALLBACK(process_connection_change), NULL); + gaim_signal_connect(blist_handle, "blist-node-extended-menu", + otrg_plugin_handle, GAIM_CALLBACK(supply_extended_menu), NULL); ++#if GAIM_MAJOR_VERSION < 2 + button_type_cbid = gaim_prefs_connect_callback( + "/gaim/gtk/conversations/button_type", + process_button_type_change, NULL); ++#endif + + gaim_conversation_foreach(otrg_dialog_new_conv); + +@@ -601,7 +662,9 @@ static gboolean otr_plugin_unload(GaimPl + GAIM_CALLBACK(process_connection_change)); + gaim_signal_disconnect(blist_handle, "blist-node-extended-menu", + otrg_plugin_handle, GAIM_CALLBACK(supply_extended_menu)); ++#if GAIM_MAJOR_VERSION < 2 + gaim_prefs_disconnect_callback(button_type_cbid); ++#endif + + gaim_conversation_foreach(otrg_dialog_remove_conv); + +@@ -640,10 +703,16 @@ static GaimPluginInfo info = + { + GAIM_PLUGIN_MAGIC, + ++#if GAIM_MAJOR_VERSION < 2 + /* We stick with the functions in the gaim 1.0.x API for + * compatibility. */ +- 1, /* major version */ ++ 1, /* major version */ + 0, /* minor version */ ++#else ++ /* Use the 2.0.x API */ ++ 2, /* major version */ ++ 0, /* minor version */ ++#endif + + GAIM_PLUGIN_STANDARD, /* type */ + PLUGIN_TYPE, /* ui_requirement */