~ubuntu-branches/ubuntu/trusty/irssi-plugin-xmpp/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/singpolyma-0008-Command-to-turn-encryption-on-off.patch

  • Committer: Package Import Robot
  • Author(s): Florian Schlichting, Florian Schlichting
  • Date: 2014-01-03 00:25:20 UTC
  • mfrom: (1.3.6)
  • Revision ID: package-import@ubuntu.com-20140103002520-zc3sfydzt1wp03i0
Tags: 0.52+git20140102-1
[ 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

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 88af13c85590cc3a2229c36ddf5612e876d05f0e Mon Sep 17 00:00:00 2001
 
2
From: Stephen Paul Weber <singpolyma@singpolyma.net>
 
3
Date: Sat, 23 Apr 2011 14:01:51 -0500
 
4
Subject: [PATCH 08/18] Command to turn encryption on/off
 
5
 
 
6
---
 
7
 src/core/rosters.h       |  1 +
 
8
 src/core/xmpp-commands.c | 28 ++++++++++++++++++++++++++++
 
9
 2 files changed, 29 insertions(+)
 
10
 
 
11
--- a/src/core/rosters.h
 
12
+++ b/src/core/rosters.h
 
13
@@ -31,6 +31,7 @@
 
14
        char    *status;
 
15
        char    *composing_id;
 
16
        char    *pgp_keyid;
 
17
+       int     pgp_encrypt;
 
18
 } XMPP_ROSTER_RESOURCE_REC;
 
19
 
 
20
 typedef struct _XMPP_ROSTER_USER_REC {
 
21
--- a/src/core/xmpp-commands.c
 
22
+++ b/src/core/xmpp-commands.c
 
23
@@ -534,6 +534,32 @@
 
24
        g_free(recoded);
 
25
 }
 
26
 
 
27
+/* SYNTAX: XMPPPGP <on|off|KEYID> */
 
28
+static void
 
29
+cmd_xmpppgp(const char *data, XMPP_SERVER_REC *server, WI_ITEM_REC *item)
 
30
+{
 
31
+       if(IS_QUERY(item)) {
 
32
+               XMPP_ROSTER_USER_REC *user = rosters_find_user(server->roster, \
 
33
+                       QUERY(item)->name, NULL, NULL);
 
34
+               XMPP_ROSTER_RESOURCE_REC *res;
 
35
+               if(!user) goto error;
 
36
+               res = rosters_find_resource(user->resources, \
 
37
+                       xmpp_extract_resource(QUERY(item)->name));
 
38
+               if(!res) goto error;
 
39
+
 
40
+               if(res->pgp_keyid && strcmp(data, "on") == 0) {
 
41
+                       res->pgp_encrypt = 1;
 
42
+               } else if(strcmp(data, "off") == 0) {
 
43
+                       res->pgp_encrypt = 0;
 
44
+               } else {
 
45
+                       res->pgp_keyid = malloc(9);
 
46
+                       strcpy(res->pgp_keyid, data);
 
47
+               }
 
48
+       }
 
49
+error:
 
50
+       return;
 
51
+}
 
52
+
 
53
 char *
 
54
 xmpp_get_dest(const char *cmd_dest, XMPP_SERVER_REC *server, WI_ITEM_REC *item)
 
55
 {
 
56
@@ -579,6 +605,7 @@
 
57
        command_bind_xmpp("presence unsubscribe", NULL,
 
58
            (SIGNAL_FUNC)cmd_presence_unsubscribe);
 
59
        command_bind_xmpp("me", NULL, (SIGNAL_FUNC)cmd_me);
 
60
+       command_bind_xmpp("xmpppgp", NULL, (SIGNAL_FUNC)cmd_xmpppgp);
 
61
        settings_add_str("xmpp", "xmpp_default_away_mode", "away");
 
62
 }
 
63
 
 
64
@@ -603,4 +630,5 @@
 
65
        command_unbind("presence unsubscribe",
 
66
            (SIGNAL_FUNC)cmd_presence_unsubscribe);
 
67
        command_unbind("me", (SIGNAL_FUNC)cmd_me);
 
68
+       command_unbind("xmpppgp", (SIGNAL_FUNC)cmd_xmpppgp);
 
69
 }