debian/0000755000000000000000000000000012261372615007173 5ustar debian/patches/0000755000000000000000000000000012261372144010617 5ustar debian/patches/singpolyma-0004-Move-call_gpg-into-tools-make-more-robust.patch0000644000000000000000000001371712261372144024362 0ustar From 74660ff12004b3e6e8c9320082c6f4e0d3513399 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 21 Apr 2011 22:07:24 -0500 Subject: [PATCH 04/18] Move call_gpg into tools, make more robust Move to tools.[ch] Allow passing in two bits of data. Only get password if we need it. Allow caller to specify in_data (that is, that we should return all output) --- src/core/protocol.c | 63 +---------------------------------- src/core/tools.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/core/tools.h | 2 ++ 3 files changed, 98 insertions(+), 62 deletions(-) --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -15,11 +15,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _POSIX_SOURCE 1 -#define _BSD_SOURCE 1 -#define _SVID_SOURCE 1 -#include - #include "module.h" #include "signals.h" #include "settings.h" @@ -30,62 +25,6 @@ char *pgp_passwd = NULL; -char *call_gpg(char *keyid, char *switches, char *input) { - int pipefd[2], tmp_fd, in_data = 0; - FILE *cstream; - char *cmd, *tmp_path, *output = NULL; - size_t output_size = 0; - char buf[100], buf2[100] = ""; - - if(pipe(pipefd)) goto pgp_error; - if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); - - if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 1) goto pgp_error; - if(close(pipefd[1])) goto pgp_error; - - if(!(tmp_path = tempnam(NULL, "irssi-xmpp-gpg"))) goto pgp_error; - if((tmp_fd = open(tmp_path, O_WRONLY|O_CREAT|O_EXCL, \ - S_IRUSR|S_IWUSR)) < 0) - goto pgp_error; - - if(write(tmp_fd, input, strlen(input)) < 0) goto pgp_error; - - cmd = malloc(sizeof("gpg -u '' -qo - --no-tty --passphrase-fd '' ''") \ - +strlen(switches)+6+strlen(tmp_path)); - sprintf(cmd, "gpg -u '%s' %s -qo - --no-tty --passphrase-fd '%d' '%s'", \ - keyid, switches, pipefd[0], tmp_path); - fflush(NULL); - cstream = popen(cmd, "r"); - - while(fgets(buf, sizeof(buf)-1, cstream)) { - if(strlen(buf2) > 0) { - output = realloc(output, output_size+strlen(buf2)+1); - if(!output) goto pgp_error; - if(output_size < 1) output[0] = '\0'; - output_size += strlen(buf2); - strcat(output, buf2); - } - - if(!in_data && buf[0] == '\n') { - in_data = 1; - continue; - } else if(in_data) { - strcpy(buf2, buf); - } - } - - pclose(cstream); /* TODO: check exit code */ - - close(tmp_fd); - close(pipefd[0]); - free(tmp_path); - free(cmd); - - return output; -pgp_error: - return NULL; -} - static void sig_set_presence(XMPP_SERVER_REC *server, const int show, const char *status, const int priority) @@ -122,7 +61,7 @@ if((pgp_keyid = settings_get_str("xmpp_pgp"))) { LmMessageNode *x; - char *signature = call_gpg(pgp_keyid, "-ab", str); + char *signature = call_gpg("-ab", str, NULL, 0); x = lm_message_node_add_child(lmsg->node, "x", signature); lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); --- a/src/core/tools.c +++ b/src/core/tools.c @@ -15,18 +15,113 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define _POSIX_SOURCE 1 +#define _BSD_SOURCE 1 +#define _SVID_SOURCE 1 +#include + #include #include "module.h" #include "recode.h" #include "settings.h" #include "signals.h" +#include "xmpp-servers.h" #define XMPP_PRIORITY_MIN -128 #define XMPP_PRIORITY_MAX 127 static const char *utf8_charset = "UTF-8"; +char *call_gpg(char *switches, char *input, char *input2, int in_data) { + int pipefd[2], tmp_fd, tmp2_fd = 0; + FILE *cstream; + char *cmd, *tmp_path, *tmp2_path = NULL, *output = NULL; + size_t output_size = 0; + char buf[100], buf2[100] = ""; + const char *keyid = settings_get_str("xmpp_pgp"); + + if(keyid) { /* If no keyID, then we don't need a password */ + if(pipe(pipefd)) goto pgp_error; + if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); + + if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 1) goto pgp_error; + if(close(pipefd[1])) goto pgp_error; + } + + if(!(tmp_path = tempnam(NULL, "irssi-xmpp-gpg"))) goto pgp_error; + if((tmp_fd = open(tmp_path, O_WRONLY|O_CREAT|O_EXCL, \ + S_IRUSR|S_IWUSR)) < 0) + goto pgp_error; + + if(write(tmp_fd, input, strlen(input)) < 0) goto pgp_error; + + if(input2) { + if(!(tmp2_path = tempnam(NULL, "irssi-xmpp-gpg"))) goto pgp_error; + if((tmp2_fd = open(tmp2_path, O_WRONLY|O_CREAT|O_EXCL, \ + S_IRUSR|S_IWUSR)) < 0) + goto pgp_error; + + if(write(tmp2_fd, input2, strlen(input2)) < 0) goto pgp_error; + } + + cmd = malloc(sizeof("gpg -u '' --passphrase-fd '' -qo - --batch --no-tty '' '' 2>&1") \ + +strlen(switches)+8+strlen(tmp_path)+ \ + (tmp2_path ? strlen(tmp2_path) : 0)); + if(keyid) { + sprintf(cmd, "gpg -u '%s' --passphrase-fd '%d' ", keyid, pipefd[0]); + } else { + strcpy(cmd, "gpg "); + } + strcat(cmd, switches); + strcat(cmd, " -qo - --batch --no-tty '"); + strcat(cmd, tmp_path); + strcat(cmd, "' "); + + if(tmp2_path) { + strcat(cmd, "'"); + strcat(cmd, tmp2_path); + strcat(cmd, "'"); + } + + strcat(cmd, " 2>&1"); + + fflush(NULL); + cstream = popen(cmd, "r"); + + while(fgets(buf, sizeof(buf)-1, cstream)) { + if(strlen(buf2) > 0) { + output = realloc(output, output_size+strlen(buf2)+1); + if(!output) goto pgp_error; + if(output_size < 1) output[0] = '\0'; + output_size += strlen(buf2); + strcat(output, buf2); + } + + if(!in_data && buf[0] == '\n') { + in_data = 1; + continue; + } else if(in_data) { + strcpy(buf2, buf); + } + } + + pclose(cstream); /* TODO: check exit code */ + + close(tmp_fd); + free(tmp_path); + if(tmp2_fd) close(tmp2_fd); + if(tmp2_path) free(tmp2_path); + if(keyid) close(pipefd[0]); + free(cmd); + + return output; +pgp_error: + return NULL; +} + + + static gboolean xmpp_get_local_charset(G_CONST_RETURN char **charset) { --- a/src/core/tools.h +++ b/src/core/tools.h @@ -2,6 +2,8 @@ #define __TOOLS_H __BEGIN_DECLS +char *call_gpg(char *switches, char *input, char *input2, int in_data); + char *xmpp_recode_out(const char *); char *xmpp_recode_in(const char *); debian/patches/singpolyma-0015-Format-keyID-the-same-everywhere.patch0000644000000000000000000000243212261372144022523 0ustar From 12e4ec8e61c59380c7dd92baae1df9747cdc29df Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 24 Apr 2011 14:48:45 -0500 Subject: [PATCH 15/18] Format keyID the same everywhere --- src/fe-common/fe-rosters.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/src/fe-common/fe-rosters.c +++ b/src/fe-common/fe-rosters.c @@ -133,7 +133,7 @@ static void show_begin_of_roster(XMPP_SERVER_REC *server) { - char *show, *status, *priority, *text, *resources; + char *show, *status, *priority, *text, *resources, *pgp_keyid; g_return_if_fail(IS_XMPP_SERVER(server)); show = (server->show == XMPP_PRESENCE_AVAILABLE) ? NULL : @@ -145,9 +145,12 @@ format_get_text(MODULE_NAME, NULL, server, NULL, XMPPTXT_FORMAT_RESOURCE_STATUS, server->away_reason); priority = g_strdup_printf("%d", server->priority); + pgp_keyid = !settings_get_str("xmpp_pgp") ? NULL : \ + format_get_text(MODULE_NAME, NULL, server, NULL, + XMPPTXT_FORMAT_PGP_KEYID, settings_get_str("xmpp_pgp")); text = format_get_text(MODULE_NAME, NULL, server, NULL, XMPPTXT_FORMAT_RESOURCE, show, server->resource, priority, - status, settings_get_str("xmpp_pgp")); + status, pgp_keyid); g_free(show); g_free(status); g_free(priority); debian/patches/hardening.patch0000644000000000000000000000051612261365453013606 0ustar Description: enable the use of dh-provided hardening flags Author: Florian Schlichting --- a/src/rules.mk +++ b/src/rules.mk @@ -7,7 +7,7 @@ all: ${LIBSO} .c.o: - ${CC} ${CFLAGS} ${INCS} -o $@ -c $< + ${CC} ${CPPFLAGS} ${CFLAGS} ${INCS} -o $@ -c $< ${LIBSO}: ${OBJS} ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} debian/patches/singpolyma-0019-Forgot-these-files.patch0000644000000000000000000000464112261372144020062 0ustar From eb08b8579355c6962e187f27e6c69a8e5e837d2c Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 7 Oct 2013 13:31:29 -0500 Subject: [PATCH] Forgot these files --- src/core/popenRWE.c | 93 ++++++++++++++++++++++++++++++++++++++++++ src/core/popenRWE.h | 7 ++++ 2 files changed, 100 insertions(+) create mode 100644 src/core/popenRWE.c create mode 100644 src/core/popenRWE.h --- /dev/null +++ b/src/core/popenRWE.c @@ -0,0 +1,93 @@ +/** + * Copyright 2009-2010 Bart Trojanowski + * Licensed under GPLv2, or later, at your choosing. + * + * bidirectional popen() call + * + * @param rwepipe - int array of size three + * @param exe - program to run + * @param argv - argument list + * @return pid or -1 on error + * + * The caller passes in an array of three integers (rwepipe), on successful + * execution it can then write to element 0 (stdin of exe), and read from + * element 1 (stdout) and 2 (stderr). + */ + +/* Modified by Stephen Paul Weber to take a path and pass it to sh -c */ + +#include +#include +#include + +#include "popenRWE.h" + +int popenRWE(int *rwepipe, const char *path) { + int in[2]; + int out[2]; + int err[2]; + int pid; + int rc; + const char *argv[4] = {"sh", "-c", NULL, NULL}; + argv[2] = path; + + rc = pipe(in); + if (rc<0) + goto error_in; + + rc = pipe(out); + if (rc<0) + goto error_out; + + rc = pipe(err); + if (rc<0) + goto error_err; + + pid = fork(); + if (pid > 0) { /* parent */ + close(in[0]); + close(out[1]); + close(err[1]); + rwepipe[0] = in[1]; + rwepipe[1] = out[0]; + rwepipe[2] = err[0]; + return pid; + } else if (pid == 0) { /* child */ + close(in[1]); + close(out[0]); + close(err[0]); + close(0); + dup(in[0]); + close(1); + dup(out[1]); + close(2); + dup(err[1]); + + execvp(argv[0], (char**)argv); + exit(1); + } else + goto error_fork; + + return pid; + +error_fork: + close(err[0]); + close(err[1]); +error_err: + close(out[0]); + close(out[1]); +error_out: + close(in[0]); + close(in[1]); +error_in: + return -1; +} + +int pcloseRWE(int pid, int *rwepipe) { + int rc, status; + close(rwepipe[0]); + close(rwepipe[1]); + close(rwepipe[2]); + rc = waitpid(pid, &status, 0); + return status; +} --- /dev/null +++ b/src/core/popenRWE.h @@ -0,0 +1,7 @@ +#ifndef __POPEN_RWE +#define __POPEN_RWE + +int popenRWE(int *rwepipe, const char *path); +int pcloseRWE(int pid, int *rwepipe); + +#endif debian/patches/series0000644000000000000000000000200712261372144012033 0ustar useless-dependency-on-libidn.patch hardening.patch GTalk-MUC-support.patch singpolyma-0001-Set-presence-in-one-place.patch singpolyma-0002-Generalize-get_password.patch singpolyma-0003-If-an-OpenPGP-KeyID-is-set-sign-presence.patch singpolyma-0004-Move-call_gpg-into-tools-make-more-robust.patch singpolyma-0005-Verify-signed-presences.patch singpolyma-0006-Display-verified-keyID-in-roster.patch singpolyma-0007-Fix-segfault.patch singpolyma-0008-Command-to-turn-encryption-on-off.patch singpolyma-0009-Encrypt-outgoing-messages-when-told-to.patch singpolyma-0010-More-robuse-call_gpg-invocation.patch singpolyma-0011-Fix-some-potential-crashing-issues.patch singpolyma-0012-Ask-again-for-password-if-wrong.patch singpolyma-0013-Decrypt-incoming-messages.patch singpolyma-0014-fix-some-assertion-failures.patch singpolyma-0015-Format-keyID-the-same-everywhere.patch singpolyma-0016-trust-keys.patch singpolyma-0017-Many-fewer-temp-files.patch singpolyma-0018-Option-to-use-gpg-agent.patch singpolyma-0019-Forgot-these-files.patch debian/patches/useless-dependency-on-libidn.patch0000644000000000000000000000074212261372144017313 0ustar Description: do not link against libidn dpkg-shlibdeps warns "package could avoid a useless dependency if libxmpp_core.so was not linked against libidn.so.11 (it uses none of the library's symbols)" Author: Florian Schlichting --- a/src/core/Makefile +++ b/src/core/Makefile @@ -29,6 +29,6 @@ xep/version.c \ xep/xep.c -LIB_LIBS = `pkg-config --libs loudmouth-1.0` +LIB_LIBS = `pkg-config --libs loudmouth-1.0 | sed -e's/-lidn//'` include ../rules.mk debian/patches/singpolyma-0010-More-robuse-call_gpg-invocation.patch0000644000000000000000000000751512261372144022522 0ustar From 854e60b80cf0f2bbb86f063a593038c3f671bd80 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 15:04:04 -0500 Subject: [PATCH 10/18] More robuse call_gpg invocation --- src/core/protocol.c | 2 +- src/core/rosters.c | 2 +- src/core/tools.c | 23 +++++++++++++++++++---- src/core/tools.h | 3 ++- src/core/xmpp-servers.c | 4 ++-- 5 files changed, 25 insertions(+), 9 deletions(-) --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -61,7 +61,7 @@ if((pgp_keyid = settings_get_str("xmpp_pgp"))) { LmMessageNode *x; - char *signature = call_gpg("-ab", str, NULL, 0); + char *signature = call_gpg("-ab", str, NULL, 0, 1); x = lm_message_node_add_child(lmsg->node, "x", signature); lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); --- a/src/core/rosters.c +++ b/src/core/rosters.c @@ -514,7 +514,7 @@ strcat(send_to_gpg, signature->value); strcat(send_to_gpg, "----- END PGP SIGNATURE-----\n"); - from_gpg = call_gpg("--verify", send_to_gpg, send_status, 1); + from_gpg = call_gpg("--verify", send_to_gpg, send_status, 1, 0); free(send_to_gpg); /* If there is a good signature, grab the key ID */ --- a/src/core/tools.c +++ b/src/core/tools.c @@ -33,8 +33,9 @@ static const char *utf8_charset = "UTF-8"; -char *call_gpg(char *switches, char *input, char *input2, int in_data) { - int pipefd[2], tmp_fd, tmp2_fd = 0; +char *call_gpg(char *switches, char *input, char *input2, \ + int get_stderr, int snip_data) { + int pipefd[2], tmp_fd, tmp2_fd = 0, in_data = !snip_data; FILE *cstream; char *cmd, *tmp_path, *tmp2_path = NULL, *output = NULL; size_t output_size = 0; @@ -65,7 +66,8 @@ if(write(tmp2_fd, input2, strlen(input2)) < 0) goto pgp_error; } - cmd = malloc(sizeof("gpg -u '' --passphrase-fd '' -qo - --batch --no-tty '' '' 2>&1") \ + cmd = malloc(sizeof("gpg -u '' --passphrase-fd '' -qo - --batch " \ + "--no-tty '' '' 2>/dev/null") \ +strlen(switches)+8+strlen(tmp_path)+ \ (tmp2_path ? strlen(tmp2_path) : 0)); if(keyid) { @@ -84,7 +86,11 @@ strcat(cmd, "'"); } - strcat(cmd, " 2>&1"); + if(get_stderr) { + strcat(cmd, " 2>&1"); + } else { + strcat(cmd, " 2>/dev/null"); + } fflush(NULL); cstream = popen(cmd, "r"); @@ -106,6 +112,15 @@ } } + /* Get last line if not snipping */ + if(!snip_data && strlen(buf2) > 0) { + output = realloc(output, output_size+strlen(buf2)+1); + if(!output) goto pgp_error; + if(output_size < 1) output[0] = '\0'; + output_size += strlen(buf2); + strcat(output, buf2); + } + pclose(cstream); /* TODO: check exit code */ close(tmp_fd); --- a/src/core/tools.h +++ b/src/core/tools.h @@ -2,7 +2,8 @@ #define __TOOLS_H __BEGIN_DECLS -char *call_gpg(char *switches, char *input, char *input2, int in_data); +char *call_gpg(char *switches, char *input, char *input2, \ + int get_stderr, int snip_data); char *xmpp_recode_out(const char *); char *xmpp_recode_in(const char *); --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -102,7 +102,7 @@ if(settings_get_str("xmpp_pgp")) strcat(switches, "s"); strcat(switches, "R "); strcat(switches, encrypt_to); - encrypted = call_gpg(switches, recoded, NULL, 0); + encrypted = call_gpg(switches, recoded, NULL, 0, 1); x = lm_message_node_add_child(lmsg->node, "x", encrypted); lm_message_node_set_attribute(x, "xmlns", "jabber:x:encrypted"); @@ -113,7 +113,7 @@ recoded = g_strdup("[This message is encrypted.]"); } else if(settings_get_str("xmpp_pgp")) { LmMessageNode *x; - char *msigned = call_gpg("-ab", recoded, NULL, 0); + char *msigned = call_gpg("-ab", recoded, NULL, 0, 1); x = lm_message_node_add_child(lmsg->node, "x", msigned); lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); free(msigned); debian/patches/singpolyma-0008-Command-to-turn-encryption-on-off.patch0000644000000000000000000000366212261372144022752 0ustar From 88af13c85590cc3a2229c36ddf5612e876d05f0e Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 14:01:51 -0500 Subject: [PATCH 08/18] Command to turn encryption on/off --- src/core/rosters.h | 1 + src/core/xmpp-commands.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) --- a/src/core/rosters.h +++ b/src/core/rosters.h @@ -31,6 +31,7 @@ char *status; char *composing_id; char *pgp_keyid; + int pgp_encrypt; } XMPP_ROSTER_RESOURCE_REC; typedef struct _XMPP_ROSTER_USER_REC { --- a/src/core/xmpp-commands.c +++ b/src/core/xmpp-commands.c @@ -534,6 +534,32 @@ g_free(recoded); } +/* SYNTAX: XMPPPGP */ +static void +cmd_xmpppgp(const char *data, XMPP_SERVER_REC *server, WI_ITEM_REC *item) +{ + if(IS_QUERY(item)) { + XMPP_ROSTER_USER_REC *user = rosters_find_user(server->roster, \ + QUERY(item)->name, NULL, NULL); + XMPP_ROSTER_RESOURCE_REC *res; + if(!user) goto error; + res = rosters_find_resource(user->resources, \ + xmpp_extract_resource(QUERY(item)->name)); + if(!res) goto error; + + if(res->pgp_keyid && strcmp(data, "on") == 0) { + res->pgp_encrypt = 1; + } else if(strcmp(data, "off") == 0) { + res->pgp_encrypt = 0; + } else { + res->pgp_keyid = malloc(9); + strcpy(res->pgp_keyid, data); + } + } +error: + return; +} + char * xmpp_get_dest(const char *cmd_dest, XMPP_SERVER_REC *server, WI_ITEM_REC *item) { @@ -579,6 +605,7 @@ command_bind_xmpp("presence unsubscribe", NULL, (SIGNAL_FUNC)cmd_presence_unsubscribe); command_bind_xmpp("me", NULL, (SIGNAL_FUNC)cmd_me); + command_bind_xmpp("xmpppgp", NULL, (SIGNAL_FUNC)cmd_xmpppgp); settings_add_str("xmpp", "xmpp_default_away_mode", "away"); } @@ -603,4 +630,5 @@ command_unbind("presence unsubscribe", (SIGNAL_FUNC)cmd_presence_unsubscribe); command_unbind("me", (SIGNAL_FUNC)cmd_me); + command_unbind("xmpppgp", (SIGNAL_FUNC)cmd_xmpppgp); } debian/patches/singpolyma-0006-Display-verified-keyID-in-roster.patch0000644000000000000000000000456612261372144022541 0ustar From 9647768f6caf2180026c0206be2476ccc77eaccf Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 21 Apr 2011 22:10:23 -0500 Subject: [PATCH 06/18] Display verified keyID in roster --- src/fe-common/fe-rosters.c | 9 ++++++--- src/fe-common/module-formats.c | 3 ++- src/fe-common/module-formats.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) --- a/src/fe-common/fe-rosters.c +++ b/src/fe-common/fe-rosters.c @@ -65,7 +65,7 @@ GSList *tmp; GString *resources; XMPP_ROSTER_RESOURCE_REC *resource; - char *show, *status, *status_str, *priority, *text; + char *show, *status, *status_str, *priority, *text, *pgp_keyid; if (list == NULL) return NULL; @@ -82,9 +82,12 @@ XMPPTXT_FORMAT_RESOURCE_STATUS, status_str); g_free(status_str); priority = g_strdup_printf("%d", resource->priority); + pgp_keyid = !resource->pgp_keyid ? NULL : \ + format_get_text(MODULE_NAME, NULL, server, NULL, + XMPPTXT_FORMAT_PGP_KEYID, resource->pgp_keyid); text = format_get_text(MODULE_NAME, NULL, server, NULL, XMPPTXT_FORMAT_RESOURCE, show, resource->name, priority, - status); + status, pgp_keyid); g_free(show); g_free(status); g_free(priority); @@ -144,7 +147,7 @@ priority = g_strdup_printf("%d", server->priority); text = format_get_text(MODULE_NAME, NULL, server, NULL, XMPPTXT_FORMAT_RESOURCE, show, server->resource, priority, - status); + status, settings_get_str("xmpp_pgp")); g_free(show); g_free(status); g_free(priority); --- a/src/fe-common/module-formats.c +++ b/src/fe-common/module-formats.c @@ -26,10 +26,11 @@ { "format_name", "{nick $0} {nickhost $1}", 2, { 0, 0 } }, { "format_jid", "{nick $0}", 1, { 0 } }, - { "format_resource", "{comment $0{hilight $1}($2)$3}", 4, { 0, 0, 0, 0 } }, + { "format_resource", "{comment $0{hilight $1}($2)$4$3}", 5, { 0, 0, 0, 0, 0 } }, { "format_resource_show", "($0)", 1, { 0 } }, { "format_resource_status", ": $0", 1, { 0 } }, { "format_subscription", "(subscription: $0)", 1, { 0 } }, + { "format_pgp_keyid", "(pgp: $0)", 1, { 0 } }, /* ---- */ { NULL, "Roster", 0, { 0 } }, --- a/src/fe-common/module-formats.h +++ b/src/fe-common/module-formats.h @@ -11,6 +11,7 @@ XMPPTXT_FORMAT_RESOURCE_SHOW, XMPPTXT_FORMAT_RESOURCE_STATUS, XMPPTXT_FORMAT_SUBSCRIPTION, + XMPPTXT_FORMAT_PGP_KEYID, XMPPTXT_FILL_2, debian/patches/GTalk-MUC-support.patch0000644000000000000000000001271412261372144015003 0ustar From 5301dbbea1db1a7ca8f780cc377df27e5ce515e9 Mon Sep 17 00:00:00 2001 From: Andrew Freeman Date: Mon, 7 Nov 2011 14:16:12 -0500 Subject: GTalk support by github/freemandrew This patch is a merge of the following commits from https://github.com/freemandrew/irssi-xmpp: - simple gtalk chatroom fix (a1935b7dd0279df7c3cde71e34e524391b610831) - more presence changes to interop with gtalk (f7c4611d6ce90856a89d74c00abda2bd2225df32) - test (6a7ffd9aaf5e56f353b3624a5f4a44218c37590f) - the "lm_message_node_get_child(parent, ..." hunk from "works with some stuff now but not others, awesome" (e96a1a9850ad7ed33aa89b96bcfa78352b2d82c5) - missed one! (a968ecf495e0e41ac30c1aa30ef6d391764d00f1) Support for GTalk ============== I'm new to github so I hope this note suffices for now. I updated this plugin mainly to get IRSSI working with GTalk. In group chats, I've recently started to get segfaults but haven't had the time to track down the issue. For the most part, it works... Author: Andrew Freeman --- src/core/xep/muc-events.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) --- a/src/core/xep/muc-events.c +++ b/src/core/xep/muc-events.c @@ -288,15 +288,15 @@ item_affiliation = item_role = status = NULL; item_jid = item_nick = NULL; /* */ - if ((node = lm_find_node(lmsg->node, "x", XMLNS, - XMLNS_MUC_USER)) == NULL) + if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", XMLNS_MUC_USER)) == NULL && + (node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER)) == NULL) return; /* */ - own = lm_find_node(node, "status", "code", "110") != NULL; + own = lm_find_node(node, "status", "code", "110") != NULL || lm_find_node(node, "user:status", "code", "110") != NULL ; /* */ - forced = lm_find_node(node, "status", "code", "210") != NULL; + forced = lm_find_node(node, "status", "code", "210") != NULL || lm_find_node(node, "user:status", "code", "210") != NULL; /* */ - created = lm_find_node(node, "status", "code", "201") != NULL; + created = lm_find_node(node, "status", "code", "201") != NULL || lm_find_node(node, "user:status", "code", "201") != NULL; if (created) { char str[MAX_LONG_STRLEN], *data; @@ -306,7 +306,9 @@ signal_emit("event 329", 2, channel->server, data); g_free(data); } - if ((node = lm_message_node_get_child(node, "item")) == NULL) + LmMessageNode *parent = node; + if ((node = lm_message_node_get_child(parent, "user:item")) == NULL && + (node = lm_message_node_get_child(parent, "item")) == NULL) return; /* nick) == 0) own_event(channel, nick, item_jid, item_affiliation, item_role, forced); - else + else nick_event(channel, nick, item_jid, item_affiliation, item_role); /* text */ - node = lm_message_node_get_child(lmsg->node, "status"); - if (node != NULL) + if ((node = lm_message_node_get_child(lmsg->node, "user:status")) != NULL || + (node = lm_message_node_get_child(lmsg->node, "status")) != NULL) status = xmpp_recode_in(node->value); /* show */ node = lm_message_node_get_child(lmsg->node, "show"); @@ -346,16 +348,20 @@ status_code = NULL; reason = actor = item_nick = status = NULL; /* */ - node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER); - if (node != NULL) { + if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", + XMLNS_MUC_USER)) != NULL || + (node = lm_find_node(lmsg->node, "x", XMLNS, + XMLNS_MUC_USER)) != NULL) + { /* */ - child = lm_message_node_get_child(node, "status"); - if (child != NULL) + if ((child = lm_message_node_get_child(node, "user:status")) != NULL || + (child = lm_message_node_get_child(node, "status")) != NULL) status_code = lm_message_node_get_attribute(child, "code"); /* */ - node = lm_message_node_get_child(node, "item"); - if (node != NULL) { + LmMessageNode *parent = node; + if ((node = lm_message_node_get_child(parent, "user:item")) != NULL || + (node = lm_message_node_get_child(parent, "item")) != NULL) { item_nick = xmpp_recode_in( lm_message_node_get_attribute(node, "nick")); /* reason */ @@ -383,8 +389,8 @@ } } else { /* text */ - node = lm_message_node_get_child(lmsg->node, "status"); - if (node != NULL) + if ((node = lm_message_node_get_child(lmsg->node, "user:status")) != NULL || + (node = lm_message_node_get_child(lmsg->node, "status")) != NULL) status = xmpp_recode_in(node->value); nick_part(channel, nick, status); g_free(status); @@ -438,8 +444,10 @@ if ((channel = get_muc(server, from)) == NULL) { /* Not a joined channel, search the MUC namespace */ /* */ - node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER); - if (node == NULL) + if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", + XMLNS_MUC_USER)) == NULL && + (node = lm_find_node(lmsg->node, "x", XMLNS, + XMLNS_MUC_USER)) == NULL) return; switch (type) { case LM_MESSAGE_SUB_TYPE_NOT_SET: debian/patches/singpolyma-0007-Fix-segfault.patch0000644000000000000000000000200612261372144016740 0ustar From 20b181d678ad167395ab4c9f969c8517863fd73f Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 13:54:08 -0500 Subject: [PATCH 07/18] Fix segfault --- src/core/rosters.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/src/core/rosters.c +++ b/src/core/rosters.c @@ -138,6 +138,7 @@ resource->status = NULL; resource->composing_id = NULL; resource->pgp_keyid = NULL; + resource->pgp_encrypt = 0; return resource; } @@ -517,7 +518,7 @@ free(send_to_gpg); /* If there is a good signature, grab the key ID */ - if(strstr(from_gpg, "Good signature from")) { + if(from_gpg && strstr(from_gpg, "Good signature from")) { char *s = strstr(from_gpg, "key ID "); if(s) { pgp_keyid = malloc(sizeof(*pgp_keyid)*9); @@ -525,7 +526,7 @@ pgp_keyid[8] = '\0'; } } - free(from_gpg); + if(from_gpg) free(from_gpg); } update_user_presence(server, from, node_show != NULL ? node_show->value : NULL, status, debian/patches/singpolyma-0018-Option-to-use-gpg-agent.patch0000644000000000000000000000315312261372144020741 0ustar From d6b046d0c1b2e92d3db2f1847214ef3d0132d758 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 24 Apr 2011 16:40:57 -0500 Subject: [PATCH 18/18] Option to use gpg-agent --- src/core/tools.c | 10 ++++++++-- src/core/xmpp-servers.c | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) --- a/src/core/tools.c +++ b/src/core/tools.c @@ -43,7 +43,8 @@ char buf[100], buf2[100] = ""; const char *keyid = settings_get_str("xmpp_pgp"); - if(keyid) { /* If no keyID, then we don't need a password */ + /* If no keyID, then we don't need a password */ + if(keyid && !settings_get_str("xmpp_pgp_agent")) { if(pipe(pipefd)) goto pgp_error; if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); if(!pgp_passwd) goto pgp_error; @@ -66,7 +67,12 @@ +strlen(switches)+8+ \ (tmp2_path ? strlen(tmp2_path) : 0)); if(keyid) { - sprintf(cmd, "gpg -u '%s' --passphrase-fd '%d' ", keyid, pipefd[0]); + strcpy(cmd, "gpg -u '"); + strcat(cmd, keyid); + strcat(cmd, "' "); + if(!settings_get_str("xmpp_pgp_agent")) { + sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pipefd[0]); + } } else { strcpy(cmd, "gpg "); } --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -610,6 +610,7 @@ settings_add_int("xmpp", "xmpp_priority", 0); settings_add_int("xmpp", "xmpp_priority_away", -1); settings_add_str("xmpp", "xmpp_pgp", NULL); + settings_add_str("xmpp", "xmpp_pgp_agent", NULL); settings_add_bool("xmpp_lookandfeel", "xmpp_set_nick_as_username", FALSE); settings_add_bool("xmpp_proxy", "xmpp_use_proxy", FALSE); debian/patches/singpolyma-0011-Fix-some-potential-crashing-issues.patch0000644000000000000000000000233512261372144023173 0ustar From e05ba5a190f6d0be3354537a1486fcbe9a40c20c Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 15:04:26 -0500 Subject: [PATCH 11/18] Fix some potential crashing issues --- src/core/protocol.c | 8 +++++--- src/core/rosters.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -63,10 +63,12 @@ LmMessageNode *x; char *signature = call_gpg("-ab", str, NULL, 0, 1); - x = lm_message_node_add_child(lmsg->node, "x", signature); - lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); + if(signature) { + x = lm_message_node_add_child(lmsg->node, "x", signature); + lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); - free(signature); + free(signature); + } } g_free(str); --- a/src/core/rosters.c +++ b/src/core/rosters.c @@ -512,7 +512,7 @@ send_to_gpg[0] = '\0'; strcat(send_to_gpg, "-----BEGIN PGP SIGNATURE-----\n\n"); strcat(send_to_gpg, signature->value); - strcat(send_to_gpg, "----- END PGP SIGNATURE-----\n"); + strcat(send_to_gpg, "-----END PGP SIGNATURE-----\n"); from_gpg = call_gpg("--verify", send_to_gpg, send_status, 1, 0); free(send_to_gpg); debian/patches/singpolyma-0014-fix-some-assertion-failures.patch0000644000000000000000000000311712261372144021750 0ustar From c8e5b81a0825ec33c7b850e8eb998f3eb33fcc5d Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 24 Apr 2011 14:11:59 -0500 Subject: [PATCH 14/18] fix some assertion failures --- src/core/xmpp-commands.c | 2 +- src/core/xmpp-servers.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) --- a/src/core/xmpp-commands.c +++ b/src/core/xmpp-commands.c @@ -538,7 +538,7 @@ static void cmd_xmpppgp(const char *data, XMPP_SERVER_REC *server, WI_ITEM_REC *item) { - if(IS_QUERY(item)) { + if(IS_QUERY(item) && QUERY(item)->name) { XMPP_ROSTER_USER_REC *user = rosters_find_user(server->roster, \ QUERY(item)->name, NULL, NULL); XMPP_ROSTER_RESOURCE_REC *res; --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -74,14 +74,16 @@ } else { XMPP_ROSTER_USER_REC *user; str = rosters_resolve_name(XMPP_SERVER(server), target); - user = rosters_find_user(((XMPP_SERVER_REC*)server)->roster, str, \ - NULL, NULL); - if(user) { - XMPP_ROSTER_RESOURCE_REC *res; - res = rosters_find_resource(user->resources, \ - xmpp_extract_resource(str)); - if(res && res->pgp_encrypt) { - encrypt_to = res->pgp_keyid; + if(str) { + user = rosters_find_user(((XMPP_SERVER_REC*)server)->roster, \ + str, NULL, NULL); + if(user) { + XMPP_ROSTER_RESOURCE_REC *res; + res = rosters_find_resource(user->resources, \ + xmpp_extract_resource(str)); + if(res && res->pgp_encrypt) { + encrypt_to = res->pgp_keyid; + } } } recoded = xmpp_recode_out(str != NULL ? str : target); debian/patches/singpolyma-0002-Generalize-get_password.patch0000644000000000000000000000363112261372144021166 0ustar From a1c765a2cb08f49d31c70e5e6fbfba4190eb126e Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 21 Apr 2011 00:10:40 -0500 Subject: [PATCH 02/18] Generalize get_password So that we can use it to get other passwords as well. --- src/core/xmpp-servers.c | 10 +++++----- src/core/xmpp-servers.h | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -261,8 +261,8 @@ * Displays input prompt on command line and takes input data from user * From irssi-silc (silc-client/lib/silcutil/silcutil.c) */ -static char * -get_password() +char * +get_password(char *prompt) { char input[2048], *ret = NULL; int fd; @@ -287,7 +287,7 @@ to.c_cc[VMIN] = 255; tcsetattr(fd, TCSANOW, &to); - printf("\tXMPP Password: "); + printf("\n\n%s", prompt); fflush(stdout); memset(input, 0, sizeof(input)); @@ -311,6 +311,7 @@ ret = g_strdup(input); memset(input, 0, sizeof(input)); #endif /* DISABLE_TERMIOS */ + signal_emit("send command", 1, "redraw"); return ret; } @@ -350,8 +351,7 @@ || *(server->connrec->password) == '\0' || *(server->connrec->password) == '\r') { g_free_not_null(server->connrec->password); - server->connrec->prompted_password = get_password(); - signal_emit("send command", 1, "redraw"); + server->connrec->prompted_password = get_password("XMPP Password: "); if (server->connrec->prompted_password != NULL) server->connrec->password = g_strdup(server->connrec->prompted_password); --- a/src/core/xmpp-servers.h +++ b/src/core/xmpp-servers.h @@ -58,8 +58,9 @@ SERVER_REC *xmpp_server_init_connect(SERVER_CONNECT_REC *); void xmpp_server_connect(XMPP_SERVER_REC *); -void xmpp_servers_init(void); -void xmpp_servers_deinit(void); +void xmpp_servers_init(void); +void xmpp_servers_deinit(void); +char *get_password(char *prompt); __END_DECLS #endif debian/patches/singpolyma-0013-Decrypt-incoming-messages.patch0000644000000000000000000000371212261372144021424 0ustar From cec9e13dd16554b743ebff4b303cc10c4ca6205d Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 15:04:55 -0500 Subject: [PATCH 13/18] Decrypt incoming messages --- src/core/protocol.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -89,7 +89,7 @@ sig_recv_message(XMPP_SERVER_REC *server, LmMessage *lmsg, const int type, const char *id, const char *from, const char *to) { - LmMessageNode *node; + LmMessageNode *node, *encrypted; char *str, *subject; if ((type != LM_MESSAGE_SUB_TYPE_NOT_SET @@ -106,9 +106,38 @@ signal_emit("message private", 4, server, subject, from, from); g_free(subject); } - node = lm_message_node_get_child(lmsg->node, "body"); - if (node != NULL && node->value != NULL && *node->value != '\0') { - str = xmpp_recode_in(node->value); + + str = NULL; + encrypted = lm_find_node(lmsg->node, "x", "xmlns", "jabber:x:encrypted"); + if(encrypted && encrypted->value) { + /* TODO: indicate the message was encrypted */ + /* TODO: verify signatures */ + char *send_to_gpg = malloc(sizeof( \ + "-----BEGIN PGP MESSAGE-----\n\n" \ + "-----END PGP MESSAGE-----\n")+ \ + strlen(encrypted->value)+1 \ + ); + char *from_gpg; + + send_to_gpg[0] = '\0'; + strcat(send_to_gpg, "-----BEGIN PGP MESSAGE-----\n\n"); + strcat(send_to_gpg, encrypted->value); + strcat(send_to_gpg, "-----END PGP MESSAGE-----\n"); + + from_gpg = call_gpg("-d", send_to_gpg, NULL, 0, 0); + if(from_gpg) { + str = xmpp_recode_in(from_gpg); + free(from_gpg); + } + + free(send_to_gpg); + } else { + node = lm_message_node_get_child(lmsg->node, "body"); + if (node != NULL && node->value != NULL && *node->value != '\0') { + str = xmpp_recode_in(node->value); + } + } + if(str) { if (g_ascii_strncasecmp(str, "/me ", 4) == 0) signal_emit("message xmpp action", 5, server, str+4, from, from, debian/patches/singpolyma-0001-Set-presence-in-one-place.patch0000644000000000000000000000246112261372144021203 0ustar From 2d68051afcdddcc02a1a5e46c58cee388086418f Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 20 Apr 2011 23:58:34 -0500 Subject: [PATCH 01/18] Set presence in one place Had two bits of code to set presence, one on initial connect, and one when changing. No reason to do that, snip out the code duplication. --- src/core/xmpp-servers.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -506,22 +506,14 @@ static void sig_connected(XMPP_SERVER_REC *server) { - LmMessage *lmsg; - char *str; - if (!IS_XMPP_SERVER(server) || (server->connrec->reconnection && xmpp_presence_changed(server->connrec->show, server->show, server->connrec->away_reason, server->away_reason, server->connrec->priority, server->priority))) return; + /* set presence available */ - lmsg = lm_message_new_with_sub_type(NULL, LM_MESSAGE_TYPE_PRESENCE, - LM_MESSAGE_SUB_TYPE_AVAILABLE); - str = g_strdup_printf("%d", server->priority); - lm_message_node_add_child(lmsg->node, "priority", str); - g_free(str); - signal_emit("xmpp send presence", 2, server, lmsg); - lm_message_unref(lmsg); + signal_emit("xmpp set presence", 4, server, XMPP_PRESENCE_AVAILABLE, "", server->priority); } static void debian/patches/singpolyma-0017-Many-fewer-temp-files.patch0000644000000000000000000000740012261372144020463 0ustar From c8d2c9316ef968e8d83ceb1b9ca1ee90298efe77 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 24 Apr 2011 16:33:48 -0500 Subject: [PATCH 17/18] Many fewer temp files --- src/core/Makefile | 1 + src/core/tools.c | 43 +++++++++++++++++++------------------------ 2 files changed, 20 insertions(+), 24 deletions(-) --- a/src/core/Makefile +++ b/src/core/Makefile @@ -11,6 +11,7 @@ rosters-tools.c \ stanzas.c \ tools.c \ + popenRWE.c \ xep/chatstates.c \ xep/composing.c \ xep/datetime.c \ --- a/src/core/tools.c +++ b/src/core/tools.c @@ -27,6 +27,7 @@ #include "settings.h" #include "signals.h" #include "xmpp-servers.h" +#include "popenRWE.h" #define XMPP_PRIORITY_MIN -128 #define XMPP_PRIORITY_MAX 127 @@ -35,9 +36,9 @@ char *call_gpg(char *switches, char *input, char *input2, \ int get_stderr, int snip_data) { - int pipefd[2], tmp_fd, tmp2_fd = 0, in_data = !snip_data; - FILE *cstream; - char *cmd, *tmp_path, *tmp2_path = NULL, *output = NULL; + int pipefd[2], rwepipe[3], childpid, tmp2_fd = 0, in_data = !snip_data; + FILE* cstream; + char *cmd, *tmp2_path = NULL, *output = NULL; size_t output_size = 0; char buf[100], buf2[100] = ""; const char *keyid = settings_get_str("xmpp_pgp"); @@ -45,19 +46,13 @@ if(keyid) { /* If no keyID, then we don't need a password */ if(pipe(pipefd)) goto pgp_error; if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); + if(!pgp_passwd) goto pgp_error; if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 1) goto pgp_error; if(close(pipefd[1])) goto pgp_error; } - if(!(tmp_path = tempnam(NULL, "irssi-xmpp-gpg"))) goto pgp_error; - if((tmp_fd = open(tmp_path, O_WRONLY|O_CREAT|O_EXCL, \ - S_IRUSR|S_IWUSR)) < 0) - goto pgp_error; - - if(write(tmp_fd, input, strlen(input)) < 0) goto pgp_error; - - if(input2) { + if(input2) { /* NOTE for security it might be better if this were a named pipe */ if(!(tmp2_path = tempnam(NULL, "irssi-xmpp-gpg"))) goto pgp_error; if((tmp2_fd = open(tmp2_path, O_WRONLY|O_CREAT|O_EXCL, \ S_IRUSR|S_IWUSR)) < 0) @@ -67,8 +62,8 @@ } cmd = malloc(sizeof("gpg -u '' --passphrase-fd '' --trust-model always" \ - " -qo - --batch --no-tty '' '' 2>/dev/null") \ - +strlen(switches)+8+strlen(tmp_path)+ \ + " -qo - --batch --no-tty - ''") \ + +strlen(switches)+8+ \ (tmp2_path ? strlen(tmp2_path) : 0)); if(keyid) { sprintf(cmd, "gpg -u '%s' --passphrase-fd '%d' ", keyid, pipefd[0]); @@ -76,9 +71,7 @@ strcpy(cmd, "gpg "); } strcat(cmd, switches); - strcat(cmd, " --trust-model always -qo - --batch --no-tty '"); - strcat(cmd, tmp_path); - strcat(cmd, "' "); + strcat(cmd, " --trust-model always -qo - --batch --no-tty - "); if(tmp2_path) { strcat(cmd, "'"); @@ -86,14 +79,18 @@ strcat(cmd, "'"); } + fflush(NULL); + childpid = popenRWE(rwepipe, cmd); + + if(write(rwepipe[0], input, strlen(input)) < 0) goto pgp_error; + if(close(rwepipe[0])) goto pgp_error; + if(get_stderr) { - strcat(cmd, " 2>&1"); + cstream = fdopen(rwepipe[2], "r"); } else { - strcat(cmd, " 2>/dev/null"); + cstream = fdopen(rwepipe[1], "r"); } - - fflush(NULL); - cstream = popen(cmd, "r"); + if(!cstream) goto pgp_error; while(fgets(buf, sizeof(buf)-1, cstream)) { if(strlen(buf2) > 0) { @@ -121,14 +118,12 @@ strcat(output, buf2); } - if(pclose(cstream) == 512) { /* TODO: more check exit code */ + if(pcloseRWE(childpid, rwepipe) == 512) { /* TODO: more check exit code */ g_free(pgp_passwd); pgp_passwd = NULL; output = call_gpg(switches, input, input2, get_stderr, snip_data); } - close(tmp_fd); - free(tmp_path); if(tmp2_fd) close(tmp2_fd); if(tmp2_path) free(tmp2_path); if(keyid) close(pipefd[0]); debian/patches/singpolyma-0009-Encrypt-outgoing-messages-when-told-to.patch0000644000000000000000000000430612261372144024012 0ustar From 0e29fbe582209e5470acbf8e423c3c50e33614ed Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 14:03:18 -0500 Subject: [PATCH 09/18] Encrypt outgoing messages when told to Also, sign messages when we have a keyid --- src/core/xmpp-servers.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -61,6 +61,7 @@ { LmMessage *lmsg; char *str, *recoded; + char *encrypt_to = NULL; if (!IS_XMPP_SERVER(server)) return; @@ -71,7 +72,18 @@ lmsg = lm_message_new_with_sub_type(recoded, LM_MESSAGE_TYPE_MESSAGE, LM_MESSAGE_SUB_TYPE_GROUPCHAT); } else { + XMPP_ROSTER_USER_REC *user; str = rosters_resolve_name(XMPP_SERVER(server), target); + user = rosters_find_user(((XMPP_SERVER_REC*)server)->roster, str, \ + NULL, NULL); + if(user) { + XMPP_ROSTER_RESOURCE_REC *res; + res = rosters_find_resource(user->resources, \ + xmpp_extract_resource(str)); + if(res && res->pgp_encrypt) { + encrypt_to = res->pgp_keyid; + } + } recoded = xmpp_recode_out(str != NULL ? str : target); g_free(str); lmsg = lm_message_new_with_sub_type(recoded, @@ -82,6 +94,31 @@ str = recode_in(server, msg, target); recoded = xmpp_recode_out(str); g_free(str); + + if(encrypt_to) { + LmMessageNode *x; + char *encrypted; + char switches[sizeof("-aesR 00000000")] = "-ae"; + if(settings_get_str("xmpp_pgp")) strcat(switches, "s"); + strcat(switches, "R "); + strcat(switches, encrypt_to); + encrypted = call_gpg(switches, recoded, NULL, 0); + + x = lm_message_node_add_child(lmsg->node, "x", encrypted); + lm_message_node_set_attribute(x, "xmlns", "jabber:x:encrypted"); + + free(encrypted); + + g_free(recoded); + recoded = g_strdup("[This message is encrypted.]"); + } else if(settings_get_str("xmpp_pgp")) { + LmMessageNode *x; + char *msigned = call_gpg("-ab", recoded, NULL, 0); + x = lm_message_node_add_child(lmsg->node, "x", msigned); + lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); + free(msigned); + } + lm_message_node_add_child(lmsg->node, "body", recoded); g_free(recoded); signal_emit("xmpp send message", 2, server, lmsg); debian/patches/singpolyma-0016-trust-keys.patch0000644000000000000000000000200112261372144016527 0ustar From 6e82d11a2414edff0b01965fdae501bccfcb79b8 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 24 Apr 2011 15:07:32 -0500 Subject: [PATCH 16/18] trust keys --- src/core/tools.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/src/core/tools.c +++ b/src/core/tools.c @@ -66,8 +66,8 @@ if(write(tmp2_fd, input2, strlen(input2)) < 0) goto pgp_error; } - cmd = malloc(sizeof("gpg -u '' --passphrase-fd '' -qo - --batch " \ - "--no-tty '' '' 2>/dev/null") \ + cmd = malloc(sizeof("gpg -u '' --passphrase-fd '' --trust-model always" \ + " -qo - --batch --no-tty '' '' 2>/dev/null") \ +strlen(switches)+8+strlen(tmp_path)+ \ (tmp2_path ? strlen(tmp2_path) : 0)); if(keyid) { @@ -76,7 +76,7 @@ strcpy(cmd, "gpg "); } strcat(cmd, switches); - strcat(cmd, " -qo - --batch --no-tty '"); + strcat(cmd, " --trust-model always -qo - --batch --no-tty '"); strcat(cmd, tmp_path); strcat(cmd, "' "); debian/patches/singpolyma-0003-If-an-OpenPGP-KeyID-is-set-sign-presence.patch0000644000000000000000000001106212261372144023505 0ustar From 86e642797d08ccd0bcf3ca2bc9eda5c0ed407ed6 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 21 Apr 2011 00:11:19 -0500 Subject: [PATCH 03/18] If an OpenPGP KeyID is set, sign presence --- src/core/protocol.c | 98 +++++++++++++++++++++++++++++++++++++++++++++---- src/core/xmpp-servers.c | 1 + src/core/xmpp.h | 2 + 3 files changed, 94 insertions(+), 7 deletions(-) --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -15,19 +15,84 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define _POSIX_SOURCE 1 +#define _BSD_SOURCE 1 +#define _SVID_SOURCE 1 +#include + #include "module.h" #include "signals.h" +#include "settings.h" #include "xmpp-servers.h" #include "rosters-tools.h" #include "tools.h" +char *pgp_passwd = NULL; + +char *call_gpg(char *keyid, char *switches, char *input) { + int pipefd[2], tmp_fd, in_data = 0; + FILE *cstream; + char *cmd, *tmp_path, *output = NULL; + size_t output_size = 0; + char buf[100], buf2[100] = ""; + + if(pipe(pipefd)) goto pgp_error; + if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); + + if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 1) goto pgp_error; + if(close(pipefd[1])) goto pgp_error; + + if(!(tmp_path = tempnam(NULL, "irssi-xmpp-gpg"))) goto pgp_error; + if((tmp_fd = open(tmp_path, O_WRONLY|O_CREAT|O_EXCL, \ + S_IRUSR|S_IWUSR)) < 0) + goto pgp_error; + + if(write(tmp_fd, input, strlen(input)) < 0) goto pgp_error; + + cmd = malloc(sizeof("gpg -u '' -qo - --no-tty --passphrase-fd '' ''") \ + +strlen(switches)+6+strlen(tmp_path)); + sprintf(cmd, "gpg -u '%s' %s -qo - --no-tty --passphrase-fd '%d' '%s'", \ + keyid, switches, pipefd[0], tmp_path); + fflush(NULL); + cstream = popen(cmd, "r"); + + while(fgets(buf, sizeof(buf)-1, cstream)) { + if(strlen(buf2) > 0) { + output = realloc(output, output_size+strlen(buf2)+1); + if(!output) goto pgp_error; + if(output_size < 1) output[0] = '\0'; + output_size += strlen(buf2); + strcat(output, buf2); + } + + if(!in_data && buf[0] == '\n') { + in_data = 1; + continue; + } else if(in_data) { + strcpy(buf2, buf); + } + } + + pclose(cstream); /* TODO: check exit code */ + + close(tmp_fd); + close(pipefd[0]); + free(tmp_path); + free(cmd); + + return output; +pgp_error: + return NULL; +} + static void sig_set_presence(XMPP_SERVER_REC *server, const int show, const char *status, const int priority) { LmMessage *lmsg; char *str; + const char *pgp_keyid; g_return_if_fail(IS_XMPP_SERVER(server)); if (!xmpp_presence_changed(show, server->show, status, @@ -35,23 +100,42 @@ signal_stop(); return; } + + lmsg = lm_message_new(NULL, LM_MESSAGE_TYPE_PRESENCE); server->show = show; - g_free(server->away_reason); - server->away_reason = g_strdup(status); + if (!xmpp_priority_out_of_bound(priority)) server->priority = priority; - lmsg = lm_message_new(NULL, LM_MESSAGE_TYPE_PRESENCE); + if (show != XMPP_PRESENCE_AVAILABLE) lm_message_node_add_child(lmsg->node, "show", xmpp_presence_show[server->show]); - if (status != NULL) { - str = xmpp_recode_out(server->away_reason); - lm_message_node_add_child(lmsg->node, "status", str); - g_free(str); + + if(server->away_reason) g_free(server->away_reason); + server->away_reason = NULL; + + if(!status) status = ""; + server->away_reason = g_strdup(status); + str = xmpp_recode_out(server->away_reason); + lm_message_node_add_child(lmsg->node, "status", str); + if(!str) str = g_strdup(""); + + if((pgp_keyid = settings_get_str("xmpp_pgp"))) { + LmMessageNode *x; + char *signature = call_gpg(pgp_keyid, "-ab", str); + + x = lm_message_node_add_child(lmsg->node, "x", signature); + lm_message_node_set_attribute(x, "xmlns", "jabber:x:signed"); + + free(signature); } + + g_free(str); + str = g_strdup_printf("%d", server->priority); lm_message_node_add_child(lmsg->node, "priority", str); g_free(str); + signal_emit("xmpp send presence", 2, server, lmsg); lm_message_unref(lmsg); if (show != XMPP_PRESENCE_AVAILABLE) /* away */ --- a/src/core/xmpp-servers.c +++ b/src/core/xmpp-servers.c @@ -570,6 +570,7 @@ settings_add_int("xmpp", "xmpp_priority", 0); settings_add_int("xmpp", "xmpp_priority_away", -1); + settings_add_str("xmpp", "xmpp_pgp", NULL); settings_add_bool("xmpp_lookandfeel", "xmpp_set_nick_as_username", FALSE); settings_add_bool("xmpp_proxy", "xmpp_use_proxy", FALSE); --- a/src/core/xmpp.h +++ b/src/core/xmpp.h @@ -13,4 +13,6 @@ #define IRSSI_XMPP_PACKAGE "irssi-xmpp" #define IRSSI_XMPP_VERSION "0.52" +extern char *pgp_passwd; + #endif debian/patches/singpolyma-0012-Ask-again-for-password-if-wrong.patch0000644000000000000000000000123112261372144022342 0ustar From 56775bd40880cebf0cc9b911d99b184f62e70f21 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 15:04:40 -0500 Subject: [PATCH 12/18] Ask again for password if wrong --- src/core/tools.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/src/core/tools.c +++ b/src/core/tools.c @@ -121,7 +121,11 @@ strcat(output, buf2); } - pclose(cstream); /* TODO: check exit code */ + if(pclose(cstream) == 512) { /* TODO: more check exit code */ + g_free(pgp_passwd); + pgp_passwd = NULL; + output = call_gpg(switches, input, input2, get_stderr, snip_data); + } close(tmp_fd); free(tmp_path); debian/patches/singpolyma-0005-Verify-signed-presences.patch0000644000000000000000000000656212261372144021113 0ustar From 9477752b43d6db7cec26f327faf4062da51527cb Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 21 Apr 2011 22:09:52 -0500 Subject: [PATCH 05/18] Verify signed presences And store the keyID in the resource structure --- src/core/rosters.c | 42 ++++++++++++++++++++++++++++++++++++++---- src/core/rosters.h | 1 + 2 files changed, 39 insertions(+), 4 deletions(-) --- a/src/core/rosters.c +++ b/src/core/rosters.c @@ -137,6 +137,7 @@ resource->show= XMPP_PRESENCE_UNAVAILABLE; resource->status = NULL; resource->composing_id = NULL; + resource->pgp_keyid = NULL; return resource; } @@ -151,6 +152,7 @@ g_free(resource->name); g_free(resource->status); g_free(resource->composing_id); + if(resource->pgp_keyid) free(resource->pgp_keyid); g_free(resource); } @@ -341,7 +343,8 @@ static void update_user_presence(XMPP_SERVER_REC *server, const char *full_jid, - const char *show_str, const char *status, const char *priority_str) + const char *show_str, const char *status, const char *priority_str, + char *pgp_keyid) { XMPP_ROSTER_GROUP_REC *group; XMPP_ROSTER_USER_REC *user; @@ -385,6 +388,7 @@ resource->show = show; resource->status = g_strdup(status); resource->priority = priority; + resource->pgp_keyid = pgp_keyid; if (!own) { user->resources = g_slist_sort( user->resources, func_sort_resource); @@ -483,8 +487,8 @@ sig_recv_presence(XMPP_SERVER_REC *server, LmMessage *lmsg, const int type, const char *id, const char *from, const char *to) { - LmMessageNode *node, *node_show, *node_priority; - char *status; + LmMessageNode *node, *node_show, *node_priority, *signature; + char *status, *pgp_keyid = NULL; if (server->ischannel(SERVER(server), from)) return; @@ -494,9 +498,39 @@ node = lm_message_node_get_child(lmsg->node, "status"); status = node != NULL ? xmpp_recode_in(node->value) : NULL; node_priority = lm_message_node_get_child(lmsg->node, "priority"); + signature = lm_find_node(lmsg->node, "x", "xmlns", "jabber:x:signed"); + if(signature) { + char *send_to_gpg = malloc(sizeof( \ + "-----BEGIN PGP SIGNATURE-----\n\n" \ + "-----END PGP SIGNATURE-----\n")+ \ + strlen(signature->value)+1 \ + ); + char *send_status = status ? status : ""; + char *from_gpg; + + send_to_gpg[0] = '\0'; + strcat(send_to_gpg, "-----BEGIN PGP SIGNATURE-----\n\n"); + strcat(send_to_gpg, signature->value); + strcat(send_to_gpg, "----- END PGP SIGNATURE-----\n"); + + from_gpg = call_gpg("--verify", send_to_gpg, send_status, 1); + free(send_to_gpg); + + /* If there is a good signature, grab the key ID */ + if(strstr(from_gpg, "Good signature from")) { + char *s = strstr(from_gpg, "key ID "); + if(s) { + pgp_keyid = malloc(sizeof(*pgp_keyid)*9); + strncpy(pgp_keyid, s+7, 8); + pgp_keyid[8] = '\0'; + } + } + free(from_gpg); + } update_user_presence(server, from, node_show != NULL ? node_show->value : NULL, status, - node_priority != NULL ? node_priority->value : NULL); + node_priority != NULL ? node_priority->value : NULL, + pgp_keyid); g_free(status); break; case LM_MESSAGE_SUB_TYPE_UNAVAILABLE: --- a/src/core/rosters.h +++ b/src/core/rosters.h @@ -30,6 +30,7 @@ int show; char *status; char *composing_id; + char *pgp_keyid; } XMPP_ROSTER_RESOURCE_REC; typedef struct _XMPP_ROSTER_USER_REC { debian/watch0000644000000000000000000000011112261363066010215 0ustar version=3 http://cybione.org/~irssi-xmpp/files/irssi-xmpp-(.*)\.tar\.gz debian/copyright0000644000000000000000000000264012261367232011127 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: irssi-xmpp Upstream-Contact: irssi-xmpp-list@cybione.org Source: http://cybione.org/~irssi-xmpp/ http://cybione.org/git/irssi-xmpp.git Files: * Copyright: 2007-2012, Colin DIDIER License: GPL-2+ Files: debian/* Copyright: 2007-2010, David Ammouial 2012-2013, Florian Schlichting License: GPL-2+ Files: debian/xmpp-admin.pl Copyright: 2011, Seth Difley - https://github.com/difley License: GPL-1+ Comment: This file was downloaded on 2013-09-25 from https://github.com/difley/xmpp-admin/blob/master/xmpp-admin.pl License: GPL-1+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. . On Debian systems, the complete text of version 1 of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-1'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2'. debian/control0000644000000000000000000000331512261372144010575 0ustar Source: irssi-plugin-xmpp Maintainer: Florian Schlichting Section: net Priority: optional Build-Depends: debhelper (>= 9), irssi-dev, libloudmouth1-dev, pkg-config Standards-Version: 3.9.5 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/irssi-plugin-xmpp.git Vcs-Git: git://anonscm.debian.org/collab-maint/irssi-plugin-xmpp.git Homepage: http://cybione.org/~irssi-xmpp/ Package: irssi-plugin-xmpp Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, irssi Enhances: irssi Description: XMPP plugin for irssi An irssi plugin to connect to the Jabber network, using the XMPP protocol. . Its main features are: - Sending and receiving messages in irssi's query windows - A roster with contact & resource tracking (contact list) - Contact management (add, remove, manage subscriptions) - Tab completion of commands, JIDs and resources - Support for multiple accounts - Unicode support (UTF-8) - SSL support Package: irssi-plugin-xmpp-dbg Architecture: any Section: debug Priority: extra Depends: ${misc:Depends}, irssi, irssi-plugin-xmpp (= ${binary:Version}) Enhances: irssi Description: XMPP plugin for irssi - Debugging symbols An irssi plugin to connect to the Jabber network, using the XMPP protocol. . Its main features are: - Sending and receiving messages in irssi's query windows - A roster with contact & resource tracking (contact list) - Contact management (add, remove, manage subscriptions) - Tab completion of commands, JIDs and resources - Support for multiple accounts - Unicode support (UTF-8) - SSL support . This package features debugging symbols for the plugin. debian/compat0000644000000000000000000000000212261363066010371 0ustar 9 debian/changelog0000644000000000000000000001232412261372615011047 0ustar irssi-plugin-xmpp (0.52+git20140102-1) unstable; urgency=medium [ Florian Schlichting ] * Import Upstream version 0.52+git20140102 * Add VCS-* fields for collab-maint on alioth * Add upstream git URL to Source field in debian/copyright * Drop patches plucked from upstream CVS * Refresh hardening.patch (offset, drop hunk fixed upstream) * Provide xmpp-admin.pl script by Seth Difley * Add GTalk-MUC-support.patch, plucked from github/freemandrew * Add support for XMPP-PGP, plucked from github/singpolyma * New useless-dependency-on-libidn.patch, to fix a lintian warning * Declare compliance with Debian Policy 3.9.5 -- Florian Schlichting Fri, 03 Jan 2014 00:25:20 +0100 irssi-plugin-xmpp (0.52-2) unstable; urgency=low * Added hardening.patch to actually use the dpkg-buildflags. * Dropped version on irssi(-dev) dependency * Email change: Florian Schlichting -> fsfs@debian.org * Patches plucked from upstream CVS: + kill-the-stroneline-function (closes: #693079) + fix-crash-on-empty-resource + replace-deprecated-g_strncasecmp -- Florian Schlichting Mon, 06 May 2013 00:03:37 +0200 irssi-plugin-xmpp (0.52-1) unstable; urgency=low * New Maintainer (closes: #667987). * Imported Upstream version 0.52 (closes: #661302). + fixing MUC invites to be compliant (closes: #609530). * Bumped debhelper compatibility to level 9. * Refreshed debian/copyright, switching to copyright-format 1.0. * Bumped Standards-Version to 3.9.3 (no further changes). * Renamed docs to irssi-plugin-xmpp.docs, include all of docs/, TODO. * Switched to short debian/rules. * Added a watch file. * Added pkg-config to build-dependencies. * Added Homepage field to source package control paragraph. -- Florian Schlichting Sun, 08 Apr 2012 15:34:43 +0200 irssi-plugin-xmpp (0.51+cvs20100627-1) unstable; urgency=low * New upstream release + CVS snapshot (Closes: #588163). - Prompt for a password if none was provided in the configuration (Closes: #580659). - Don't segfault upon reception of a ping without "from" field. (Closes: #521227). - Various bugfixes and improvements. * Provide a package with debugging symbols (Closes: #580658). * Bump Standards-Version to 3.8.4 (no changes needed). -- David Ammouial Tue, 06 Jul 2010 15:14:51 +0200 irssi-plugin-xmpp (0.50+cvs20100122-1) unstable; urgency=low * New CVS snapshot that allows connections to talk.google.com (Closes: #565581). -- David Ammouial Fri, 22 Jan 2010 16:09:55 -0600 irssi-plugin-xmpp (0.50+cvs20100105-1) unstable; urgency=low * New CVS snapshot. - Delayed Delivery (XEP-0203) support. - Account registration support. - Support for /CYCLE command, similar to IRC's. - Modification of "/roster add" behaviour. - TLS is used for connecting when available (Closes: #526356). - Use a timeout on connections to prevent frozen connections. * Bump Standards-Version to 3.8.3 (no changes). * Fix handling of CFLAGS environment in upstream Makefile (many thanks to Raphaƫl Hertzog). -- David Ammouial Wed, 06 Jan 2010 05:11:18 -0600 irssi-plugin-xmpp (0.13+cvs20090617-1) unstable; urgency=low * New CVS snapshot: - Some bugfixes and code cleanup. - Allow to build on ia64 (Closes: #530304). * Bump Standards-Version to 3.8.2 (no changes). -- David Ammouial Fri, 19 Jun 2009 23:14:39 -0500 irssi-plugin-xmpp (0.13+cvs20090406-1) unstable; urgency=low * New CVS snapshot, built against irssi-dev 0.8.13: - New features and bugfixes. - Fix segfault when successfully identified (Closes: #521227). - Fix build error (Closes: #527697) * Depend on irssi >=0.8.13, build-depend on irssi-dev >=0.8.13. * Bump Standards-Version to 3.8.1 (no changes needed). * Add INTERNAL to documentation files. -- David Ammouial Tue, 12 May 2009 12:14:44 -0500 irssi-plugin-xmpp (0.13+cvs20080610-1) unstable; urgency=low * New CVS snapshot: - New features and bugfixes. - Fix ignoring of messages without a type attribute (Closes: #477989). * Depend on irssi >=0.8.12 (Closes: #469923). * Add FAQ and MUC to documentation files (Closes: #485595). * debian/rules: install help files in irssi help directory. * debian/rules: Remove useless "make -n" command in build-stamp rule. * Bump Standards-Version to 3.8.0 (no changes needed). * debian/control: Add "Enhances: irssi". -- David Ammouial Mon, 23 Jun 2008 16:03:33 +0200 irssi-plugin-xmpp (0.13+cvs20080121-1) unstable; urgency=low * CVS snapshot. * Rephrased package description, thanks to Ted Percival (Closes: #444109). * debian/control: Promote "Homepage" to a real field. * Update homepage. * Adapt debian/rules to new upstream Makefile system. * Bump Standards-Version to 3.7.3 (no changes required). * Removed empty TODO from debian/docs, added docs/GENERAL, docs/STARTUP, docs/XEP. -- David Ammouial Mon, 04 Feb 2008 21:01:27 +0100 irssi-plugin-xmpp (0.13-1) unstable; urgency=low * Initial release (Closes: #440017). -- David Ammouial Wed, 29 Aug 2007 10:59:29 +0200 debian/irssi-plugin-xmpp.install0000644000000000000000000000005612261367110014165 0ustar debian/xmpp-admin.pl /usr/share/irssi/scripts debian/irssi-plugin-xmpp.docs0000644000000000000000000000002312261363066013447 0ustar README TODO docs/* debian/xmpp-admin.pl0000644000000000000000000000437112261367110011601 0ustar # xmpp-admin.pl #copy into .irssi/scripts #load in irssi with: /script load xmpp-admin use Irssi; $::VERSION='0.0.1'; %::IRSSI = ( authors => 'Seth Difley', contact => '', name => 'xmpp-admin', description => 'Adds admin commands to irssi-xmpp', url => '', license => 'GNU General Public License', changed => '$Date$' ); #/affiliate affiliation_level [jid] #If jid is absent, the affiliation list is returned (Raw xml messages must be active to see the list.) sub cmd_affiliate { my ($data,$server,$wid) = @_; @items = split(" ", $data); if ($items[0]) { if ($items[1]) { $affil = "QUOTE {name}\'> "; } else { $affil = "QUOTE {name}\'> "; } $server->command("$affil"); } else { Irssi::active_win()->print("/affiliate none|owner|admin|member|outcast [jid]"); } } #/role role_level nickname [reason] sub cmd_role { my ($data,$server,$wid) = @_; @items = split(" ", $data); if ($items[1]) { if ($items[2]) { $data =~ s/^.*?[\s]+.*?[\s]+//; $reason = "$data"; } else { $reason = ""; } $role = "QUOTE {name}\'> $reason "; $server->command("$role"); } else { Irssi::active_win()->print("/role none|moderator|participant|visitor nickname [reason]"); } } #/kick nickname [reason] sub cmd_kick { my ($data,$server,$wid) = @_; @items = split(" ", $data); if ($items[0]) { cmd_role("none " . $data,$server,$wid); } else { Irssi::active_win()->print("/kick nickname [reason]"); } } Irssi::command_bind('affiliate', \&cmd_affiliate); Irssi::command_bind('role', \&cmd_role); Irssi::command_bind('kick', \&cmd_kick); debian/source/0000755000000000000000000000000012261363066010473 5ustar debian/source/format0000644000000000000000000000001412261363066011701 0ustar 3.0 (quilt) debian/rules0000755000000000000000000000057012261363066010255 0ustar #!/usr/bin/make -f %: dh $@ override_dh_auto_build: PREFIX=/usr dh_auto_build override_dh_auto_install: $(MAKE) help-install PREFIX=$(CURDIR)/debian/irssi-plugin-xmpp/usr cd src/ && $(MAKE) install PREFIX=$(CURDIR)/debian/irssi-plugin-xmpp/usr override_dh_installchangelogs: dh_installchangelogs NEWS override_dh_strip: dh_strip --dbg-package=irssi-plugin-xmpp-dbg