[Pkg-privacy-commits] [irssi-plugin-otr] 63/267: And here comes a really bad hack to make otr_key use weechat_hook_fd.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:28 UTC 2015


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

infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.

commit 0d85b1ea46ddc4b831da7f7e9ed413952aa8df14
Author: Uli Meis <a.sporto+bee at gmail.com>
Date:   Wed Feb 11 19:41:59 2009 +0100

    And here comes a really bad hack to make otr_key use weechat_hook_fd.
---
 otr_key.c              |  3 ++-
 weechat/CMakeLists.txt |  2 ++
 weechat/weechat_otr.c  |  2 +-
 weechat/weechat_otr.h  | 42 +++++++++++++++++++++++++++++++++++++-----
 4 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/otr_key.c b/otr_key.c
index ee89193..3767f39 100644
--- a/otr_key.c
+++ b/otr_key.c
@@ -37,7 +37,8 @@ struct {
 	char *protocol;
 	time_t started;
 	GIOChannel *ch[2];
-	guint cpid,cwid;
+	guint cpid;
+	guint cwid;
 	pid_t pid;
 } kg_st = {.status = KEYGEN_NO };
 
diff --git a/weechat/CMakeLists.txt b/weechat/CMakeLists.txt
index c16696e..b5febf3 100644
--- a/weechat/CMakeLists.txt
+++ b/weechat/CMakeLists.txt
@@ -27,5 +27,7 @@ IF(NOT DOCDIR)
   SET(DOCDIR share/doc/weechat-otr)
 ENDIF(NOT DOCDIR)
 
+SET_TARGET_PROPERTIES(weechatotr PROPERTIES PREFIX "" OUTPUT_NAME "irc-otr")
+
 INSTALL(TARGETS weechatotr DESTINATION lib${LIB_SUFFIX}/weechat/plugins)
 INSTALL(FILES README LICENSE DESTINATION ${DOCDIR})
diff --git a/weechat/weechat_otr.c b/weechat/weechat_otr.c
index 78ef0f8..4cd3b55 100644
--- a/weechat/weechat_otr.c
+++ b/weechat/weechat_otr.c
@@ -58,7 +58,7 @@ void printformatva(IRC_CTX *ircctx, const char *nick, char *format, va_list para
 			weechat_command(NULL,cmd);
 			buffer = weechat_buffer_search("irc",s);
 			if (!buffer)
-				weechat_printf(NULL,"OTR: Failed to create " 
+				weechat_printf(NULL,"OTR: Failed to create "
 					       "a buffer for the following "
 					       "message! server=%s,nick=%s",
 					       ircctx->address,nick);
diff --git a/weechat/weechat_otr.h b/weechat/weechat_otr.h
index c9ffc16..f5b3f8c 100644
--- a/weechat/weechat_otr.h
+++ b/weechat/weechat_otr.h
@@ -68,7 +68,6 @@ void printformat(IRC_CTX *ircctx, const char *nick, int lvl, int fnum, ...);
 static IRC_CTX *IRCCTX_DUP(IRC_CTX *ircctx) __attribute__ ((unused));
 static void IRCCTX_FREE(IRC_CTX *ircctx) __attribute__ ((unused));
 
-//#define IRCCTX_DUP(ircctx) g_memdup(ircctx,sizeof(IRC_CTX));
 static IRC_CTX *IRCCTX_DUP(IRC_CTX *ircctx)
 {
 	IRC_CTX *nctx = g_memdup(ircctx,sizeof(IRC_CTX));
@@ -81,10 +80,43 @@ static IRC_CTX *IRCCTX_DUP(IRC_CTX *ircctx)
 
 #define IRCCTX_ADDR(ircctx) ircctx->address
 #define IRCCTX_NICK(ircctx) ircctx->nick
-//#define IRCCTX_FREE(ircctx) g_free(ircctx)
 static void IRCCTX_FREE(IRC_CTX *ircctx)
 {
-	g_free(ircctx->nick);
-	g_free(ircctx->address);
-	g_free(ircctx);
+	free(ircctx->nick);
+	free(ircctx->address);
+	free(ircctx);
+}
+
+#define g_io_add_watch(pid,a,func,b) gioaddwatchfake(pid,func)
+
+#define g_child_watch_add(pid,func,dunno) NULL
+#define g_source_remove(a) gsourceremovefake(a)
+#define guint  struct t_hook *
+
+static void gsourceremovefake(struct t_hook *hook) __attribute__ ((unused));
+static void gsourceremovefake(struct t_hook *hook)
+{
+	if (hook)
+		weechat_unhook(hook);
+
+}
+
+gboolean keygen_complete(GIOChannel *source, GIOCondition condition, 
+			 gpointer data);
+
+static int cb(void *data)
+{
+	keygen_complete(NULL,0,NULL);
+	return TRUE;
+}
+
+static struct t_hook *gioaddwatchfake(GIOChannel *source, int (*func)(GIOChannel *source,
+							   GIOCondition condition, 
+							   gpointer data)) 
+	__attribute__ ((unused));
+
+static struct t_hook *gioaddwatchfake(GIOChannel *source, int (*func)(GIOChannel *source,GIOCondition
+					     condition, gpointer data))
+{
+	return weechat_hook_fd(g_io_channel_unix_get_fd(source),TRUE,FALSE,FALSE,cb,source);
 }

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



More information about the Pkg-privacy-commits mailing list