Thu, 29 Aug 2013 22:59:30 -0700
Fix the FARSIGHT libs and cflags for the jabber prpl.
We never define FARSIGHT_LIBS or FARSIGHT_CFLAGS. We only ever define
FARSTREAM_LIBS and FARSTREAM_CFLAGS, even if they point to farsight.
I'm assuming this hasn't been a problem because:
1. The variables are allowed to be empty (it's not treated as an error)
2. libpurple and/or Pidgin link against farsight/farstream, so it's
apparently not necessary for the plugin to do it itself? Who knew.
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
1 | /* |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
2 | * purple - Jabber Protocol Plugin |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28321
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28321
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28321
diff
changeset
|
6 | * source distribution. |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
7 | * |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
12 | * |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
16 | * |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
18 | * |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
20 | * along with this program; if not, write to the Free Software |
|
28321
c8d617c408ab
Update various header copyrights thanks to licensecheck.
Paul Aurich <darkrain42@pidgin.im>
parents:
27435
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
22 | * |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
23 | */ |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
24 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
25 | #include "internal.h" |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
26 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
27 | #include "debug.h" |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
28 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
29 | #include "jabber.h" |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
30 | #include "ping.h" |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
31 | #include "iq.h" |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
32 | |
|
27143
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
33 | static void jabber_keepalive_pong_cb(JabberStream *js, const char *from, |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
34 | JabberIqType type, const char *id, |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
35 | xmlnode *packet, gpointer data) |
|
25555
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
36 | { |
|
27304
b2dc447b8c0b
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
37 | if (js->keepalive_timeout != 0) { |
|
26983
84be4c9b3ef9
Don't breaking if the user runs `/ping <user's server>` a bunch.
Paul Aurich <darkrain42@pidgin.im>
parents:
26982
diff
changeset
|
38 | purple_timeout_remove(js->keepalive_timeout); |
|
27304
b2dc447b8c0b
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
39 | js->keepalive_timeout = 0; |
|
27435
b702d555a6b6
disapproval of revision 'd584e1732e45d98d1a94bb50ccf136df0905d1b3'
Paul Aurich <darkrain42@pidgin.im>
parents:
27308
diff
changeset
|
40 | } |
|
25555
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
41 | } |
|
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
42 | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
43 | void |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
44 | jabber_ping_parse(JabberStream *js, const char *from, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
45 | JabberIqType type, const char *id, xmlnode *ping) |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
46 | { |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
47 | if (type == JABBER_IQ_GET) { |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
18911
diff
changeset
|
48 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT); |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
49 | |
|
25818
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
50 | if (from) |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
51 | xmlnode_set_attrib(iq->node, "to", from); |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
18911
diff
changeset
|
52 | xmlnode_set_attrib(iq->node, "id", id); |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
53 | |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
18911
diff
changeset
|
54 | jabber_iq_send(iq); |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
55 | } else if (type == JABBER_IQ_SET) { |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
18911
diff
changeset
|
56 | /* XXX: error */ |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
18911
diff
changeset
|
57 | } |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
58 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
59 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
25824
diff
changeset
|
60 | static void jabber_ping_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
25824
diff
changeset
|
61 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
25824
diff
changeset
|
62 | xmlnode *packet, gpointer data) |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
63 | { |
|
27143
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
64 | if (type == JABBER_IQ_RESULT) |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
65 | purple_debug_info("jabber", "PONG!\n"); |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
66 | else |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
67 | purple_debug_info("jabber", "ping not supported\n"); |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
68 | } |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
69 | |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
70 | void jabber_keepalive_ping(JabberStream *js) |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
71 | { |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
72 | JabberIq *iq; |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
73 | xmlnode *ping; |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
74 | |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
75 | iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
76 | ping = xmlnode_new_child(iq->node, "ping"); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
77 | xmlnode_set_namespace(ping, NS_PING); |
|
27143
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
78 | |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
79 | jabber_iq_set_callback(iq, jabber_keepalive_pong_cb, NULL); |
|
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
26983
diff
changeset
|
80 | jabber_iq_send(iq); |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
81 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
82 | |
|
25555
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
83 | gboolean jabber_ping_jid(JabberStream *js, const char *jid) |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
84 | { |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
85 | JabberIq *iq; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
86 | xmlnode *ping; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
87 | |
|
25555
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
88 | iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
89 | if (jid) |
|
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
90 | xmlnode_set_attrib(iq->node, "to", jid); |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
91 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
92 | ping = xmlnode_new_child(iq->node, "ping"); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
93 | xmlnode_set_namespace(ping, NS_PING); |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
94 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
95 | jabber_iq_set_callback(iq, jabber_ping_result_cb, NULL); |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
96 | jabber_iq_send(iq); |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
97 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
98 | return TRUE; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
diff
changeset
|
99 | } |