[Pkg-privacy-commits] [irssi-plugin-otr] 49/267: Automatically create queries for OTR messages if otr_createqueries is set.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:27 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 dfc474501b4aeff530cdaea376e7cf163a9264d0
Author: Uli Meis <a.sporto+bee at gmail.com>
Date:   Mon Feb 2 21:23:06 2009 +0100

    Automatically create queries for OTR messages if otr_createqueries is set.
---
 irssi_otr.c |  9 +++++++++
 irssi_otr.h | 19 +++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/irssi_otr.c b/irssi_otr.c
index eb37fb7..684e400 100644
--- a/irssi_otr.c
+++ b/irssi_otr.c
@@ -291,6 +291,14 @@ static void otr_statusbar(struct SBAR_ITEM_REC *item, int get_size_only)
 		formatnum ? formats[formatnum].def : ""," ",FALSE);
 }
 
+void otr_query_create(SERVER_REC *server, const char *nick)
+{
+	if (!settings_get_bool("otr_createqueries")||query_find(server, nick))
+		return;
+
+	irc_query_create(server->tag, nick, TRUE);
+}
+
 static void read_settings(void)
 {
 	otr_setpolicies(settings_get_str("otr_policy"),FALSE);
@@ -336,6 +344,7 @@ void otr_init(void)
 	settings_add_str("otr", "otr_policy_known",IO_DEFAULT_POLICY_KNOWN);
 	settings_add_str("otr", "otr_ignore",IO_DEFAULT_IGNORE);
 	settings_add_bool("otr", "otr_finishonunload",TRUE);
+	settings_add_bool("otr", "otr_createqueries",TRUE);
 	read_settings();
 	signal_add("setup changed", (SIGNAL_FUNC) read_settings);
 
diff --git a/irssi_otr.h b/irssi_otr.h
index 3769284..ca63c1c 100644
--- a/irssi_otr.h
+++ b/irssi_otr.h
@@ -10,6 +10,8 @@
 #include <fe-common/core/module-formats.h>
 #include <core/modules.h>
 #include <core/settings.h>
+#include <irc/core/irc.h>
+#include <irc/core/irc-queries.h>
 
 #include <fe-text/statusbar-item.h>
 
@@ -30,21 +32,26 @@ static IRC_CTX *IRCCTX_FREE(IRC_CTX *ircctx)
 	return ircctx;
 }
 
+void otr_query_create(IRC_CTX *ircctx, const char *nick);
+
 #define IRCCTX_ADDR(ircctx) ircctx->connrec->address
 #define IRCCTX_NICK(ircctx) ircctx->nick
 
 #define otr_noticest(formatnum,...) \
 	printformat(NULL,NULL,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
 
-#define otr_notice(ircctx,nick,formatnum,...) \
-		printformat(ircctx,nick,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__);
+#define otr_notice(ircctx,nick,formatnum,...) { \
+	otr_query_create(ircctx,nick); \
+	printformat(ircctx,nick,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__);}
 
 #define otr_infost(formatnum,...) \
 	printformat(NULL,NULL,MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
 
-#define otr_info(server,nick,formatnum,...) \
-	printformat(ircctx,nick,MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
+#define otr_info(server,nick,formatnum,...) { \
+	otr_query_create(ircctx,nick); \
+	printformat(ircctx,nick,MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__);}
 
 #define otr_debug(ircctx,nick,formatnum,...) { \
-	if (debug) \
-		printformat(ircctx,nick,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__); }
+	if (debug) { \
+		otr_query_create(ircctx,nick); \
+		printformat(ircctx,nick,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__); } }

-- 
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