# HG changeset patch
# User Marcus Lundblad
# Date 1259520791 0
# Node ID cb8b53a6f23867768e0f9492980887acf814dd9c
# Parent 0b5520bf1fe3ed1788d59771b089bfc848a84ffc# Parent 8d213c65abad20f6c865f829709d7853006926ba
propagate from branch 'im.pidgin.pidgin' (head fd01d69465dca1c23c811963e2545236c2749d55)
to branch 'im.pidgin.cpw.malu.xmpp.google_relay' (head f42dc6597e138658717b57f998be0bb8b164ca6f)
diff -r 0b5520bf1fe3 -r cb8b53a6f238 ChangeLog
--- a/ChangeLog Mon Nov 23 21:32:39 2009 +0000
+++ b/ChangeLog Sun Nov 29 18:53:11 2009 +0000
@@ -4,6 +4,9 @@
version 2.6.4 (??/??/20??):
libpurple:
* Actually emit the hold signal for media calls.
+ * Don't send Proxy-Authorization headers to HTTP proxy servers until we've
+ received a "407 Proxy Authentication Required" response from the server.
+ (thecrux)
* Added "MXit" protocol plugin, supported and maintained by the MXit folks
themselves (MXit Lifestyle (Pty) Ltd.)
@@ -20,6 +23,7 @@
* The simultaneous login account option is respected when using
the clientLogin authentication method.
* Fix offline message retrieval (broken in 2.6.3)
+ * Fix handling of markup on some messages (broken in 2.6.2)
* Fix SSL when clientLogin is enabled.
* Fix sending and receiving Unicode characters in a Direct IM
@@ -32,6 +36,9 @@
* Fix a random crash that might occur when idle.
* Fix a crash when logging in with some long non-ASCII passwords.
(Shaun Lindsay)
+ * Cache our own friendly name as the server no longer does that for
+ us. Users of older versions may need to re-set their friendly name
+ as it has probably been reset.
XMPP:
* Users connecting to Google Talk now have an "Initiate Chat" context menu
@@ -67,6 +74,9 @@
* Add a hold button to the media window.
* Fix a bug where the conversation backlog stops scrolling in a very busy
chat room.
+ * In the Conversation "Send To" menu, offline buddies appear grayed
+ out (but are still selectable). Previously, only offline buddies on
+ accounts that do not support offline messaging appeared grayed out.
Pidgin Preference and Preference Window Changes:
* Removed the "Use font from theme" and "Conversation Font" preferences
diff -r 0b5520bf1fe3 -r cb8b53a6f238 doc/finch.1.in
--- a/doc/finch.1.in Mon Nov 23 21:32:39 2009 +0000
+++ b/doc/finch.1.in Sun Nov 29 18:53:11 2009 +0000
@@ -114,7 +114,7 @@
.B Ctrl \+ o \fR or \fB F10
Bring up the menu (if there is one) for a window.
.TP
-.B F11
+.B F11 \fR or \fB Ctrl \+ x
Popup the context menu (if there is one) for the selected widget.
.TP
.B Alt \+ /
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/certificate.c
--- a/libpurple/certificate.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/certificate.c Sun Nov 29 18:53:11 2009 +0000
@@ -26,8 +26,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#include
-
#include "internal.h"
#include "certificate.h"
#include "dbus-maybe.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/cmds.c
--- a/libpurple/cmds.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/cmds.c Sun Nov 29 18:53:11 2009 +0000
@@ -21,8 +21,6 @@
*
*/
-#include
-
#include "internal.h"
#include "account.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/dbus-server.c
--- a/libpurple/dbus-server.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/dbus-server.c Sun Nov 29 18:53:11 2009 +0000
@@ -25,14 +25,16 @@
#define DBUS_API_SUBJECT_TO_CHANGE
#endif
+/* Allow the code below to see deprecated functions, so we can continue to
+ * export them via DBus. */
+#undef PURPLE_DISABLE_DEPRECATED
+
+#include "internal.h"
+
#include
#include
#include
-/* Allow the code below to see deprecated functions, so we can continue to
- * export them via DBus. */
-#undef PURPLE_DISABLE_DEPRECATED
-
#include "account.h"
#include "blist.h"
#include "conversation.h"
@@ -42,7 +44,6 @@
#include "dbus-bindings.h"
#include "debug.h"
#include "core.h"
-#include "internal.h"
#include "savedstatuses.h"
#include "smiley.h"
#include "util.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/debug.c
--- a/libpurple/debug.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/debug.c Sun Nov 29 18:53:11 2009 +0000
@@ -23,8 +23,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#include "internal.h"
#include "debug.h"
-#include "internal.h"
#include "prefs.h"
#include "util.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/desktopitem.c
--- a/libpurple/desktopitem.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/desktopitem.c Sun Nov 29 18:53:11 2009 +0000
@@ -53,12 +53,12 @@
* Boston, MA 02111-1301, USA.
*/
+#include "internal.h"
#include
#include
#include
#include
#include "desktopitem.h"
-#include "internal.h"
struct _PurpleDesktopItem {
int refcount;
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/eventloop.c
--- a/libpurple/eventloop.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/eventloop.c Sun Nov 29 18:53:11 2009 +0000
@@ -23,8 +23,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#include "internal.h"
#include "eventloop.h"
-#include "internal.h"
static PurpleEventLoopUiOps *eventloop_ui_ops = NULL;
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/ft.c
--- a/libpurple/ft.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/ft.c Sun Nov 29 18:53:11 2009 +0000
@@ -229,7 +229,7 @@
escaped = g_markup_escape_text(message, -1);
if (is_error)
- flags = PURPLE_MESSAGE_ERROR;
+ flags |= PURPLE_MESSAGE_ERROR;
purple_conversation_write(conv, NULL, escaped, flags, time(NULL));
g_free(escaped);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/ft.h
--- a/libpurple/ft.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/ft.h Sun Nov 29 18:53:11 2009 +0000
@@ -160,7 +160,10 @@
PurpleXferStatusType status; /**< File Transfer's status. */
- /* I/O operations. */
+ /** I/O operations, which should be set by the prpl using
+ * purple_xfer_set_init_fnc() and friends. Setting #init is
+ * mandatory; all others are optional.
+ */
struct
{
void (*init)(PurpleXfer *xfer);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/imgstore.c
--- a/libpurple/imgstore.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/imgstore.c Sun Nov 29 18:53:11 2009 +0000
@@ -25,7 +25,6 @@
*
*/
-#include
#include "internal.h"
#include "dbus-maybe.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/media.c
--- a/libpurple/media.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/media.c Sun Nov 29 18:53:11 2009 +0000
@@ -24,8 +24,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#include
-
#include "internal.h"
#include "account.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/mime.c
--- a/libpurple/mime.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/mime.c Sun Nov 29 18:53:11 2009 +0000
@@ -21,11 +21,6 @@
* USA.
*/
-#include
-#include
-
-#include
-
#include "internal.h"
/* this should become "util.h" if we ever get this into purple proper */
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/nat-pmp.c
--- a/libpurple/nat-pmp.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/nat-pmp.c Sun Nov 29 18:53:11 2009 +0000
@@ -29,8 +29,8 @@
* OF SUCH DAMAGE.
*/
+#include "internal.h"
#include "nat-pmp.h"
-#include "internal.h"
#include "debug.h"
#include "signals.h"
#include "network.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/ntlm.c
--- a/libpurple/ntlm.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/ntlm.c Sun Nov 29 18:53:11 2009 +0000
@@ -24,8 +24,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#include
-#include
#include "internal.h"
#include "util.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/plugins/log_reader.c
--- a/libpurple/plugins/log_reader.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/plugins/log_reader.c Sun Nov 29 18:53:11 2009 +0000
@@ -1,7 +1,7 @@
+#include "internal.h"
+
#include
-#include "internal.h"
-
#include "debug.h"
#include "log.h"
#include "plugin.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/plugins/signals-test.c
--- a/libpurple/plugins/signals-test.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/plugins/signals-test.c Sun Nov 29 18:53:11 2009 +0000
@@ -20,9 +20,10 @@
*/
#define SIGNAL_TEST_PLUGIN_ID "core-signals-test"
+#include "internal.h"
+
#include
-#include "internal.h"
#include "cipher.h"
#include "connection.h"
#include "conversation.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/Makefile.am
--- a/libpurple/protocols/jabber/Makefile.am Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/Makefile.am Sun Nov 29 18:53:11 2009 +0000
@@ -5,12 +5,17 @@
pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION)
-JABBERSOURCES = auth.c \
+JABBERSOURCES = \
+ adhoccommands.c \
+ adhoccommands.h \
+ auth.c \
auth.h \
buddy.c \
buddy.h \
bosh.c \
bosh.h \
+ caps.c \
+ caps.h \
chat.c \
chat.h \
data.c \
@@ -43,10 +48,13 @@
jutil.h \
message.c \
message.h \
+ namespaces.h \
oob.c \
oob.h \
parser.c \
parser.h \
+ pep.c \
+ pep.h \
ping.c \
ping.h \
presence.c \
@@ -55,14 +63,6 @@
roster.h \
si.c \
si.h \
- xdata.c \
- xdata.h \
- caps.c \
- caps.h \
- adhoccommands.c \
- adhoccommands.h \
- pep.c \
- pep.h \
useravatar.c \
useravatar.h \
usermood.c \
@@ -70,7 +70,9 @@
usernick.c \
usernick.h \
usertune.c \
- usertune.h
+ usertune.h \
+ xdata.c \
+ xdata.h
AM_CFLAGS = $(st)
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/adhoccommands.c
--- a/libpurple/protocols/jabber/adhoccommands.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/adhoccommands.c Sun Nov 29 18:53:11 2009 +0000
@@ -97,7 +97,7 @@
if (type == JABBER_IQ_ERROR)
return;
- query = xmlnode_get_child_with_namespace(packet, "query", "http://jabber.org/protocol/disco#items");
+ query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS);
if (!query)
return;
node = xmlnode_get_attrib(query, "node");
@@ -275,7 +275,8 @@
JabberIqType type, const char *id,
xmlnode *packet, gpointer data)
{
- xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", "http://jabber.org/protocol/disco#items");
+ xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
+ NS_DISCO_ITEMS);
jabber_adhoc_got_server_list(js, from, query);
@@ -291,8 +292,9 @@
}
void jabber_adhoc_server_get_list(JabberStream *js) {
- JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#items");
- xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
+ JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
+ xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query",
+ NS_DISCO_ITEMS);
xmlnode_set_attrib(iq->node,"to",js->user->domain);
xmlnode_set_attrib(query,"node","http://jabber.org/protocol/commands");
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/bosh.c
--- a/libpurple/protocols/jabber/bosh.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/bosh.c Sun Nov 29 18:53:11 2009 +0000
@@ -369,8 +369,8 @@
"sid='%s' "
"to='%s' "
"xml:lang='en' "
- "xmlns='http://jabber.org/protocol/httpbind' "
- "xmlns:xmpp='urn:xmpp:xbosh'",
+ "xmlns='" NS_BOSH "' "
+ "xmlns:xmpp='" NS_XMPP_BOSH "'",
++conn->rid,
conn->sid,
conn->js->user->domain);
@@ -567,13 +567,13 @@
"xml:lang='en' "
"xmpp:version='1.0' "
"ver='1.6' "
- "xmlns:xmpp='urn:xmpp:bosh' "
+ "xmlns:xmpp='" NS_XMPP_BOSH "' "
"rid='%" G_GUINT64_FORMAT "' "
/* TODO: This should be adjusted/adjustable automatically according to
* realtime network behavior */
"wait='60' "
"hold='1' "
- "xmlns='http://jabber.org/protocol/httpbind'/>",
+ "xmlns='" NS_BOSH "'/>",
conn->js->user->domain,
++conn->rid);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/buddy.c
--- a/libpurple/protocols/jabber/buddy.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c Sun Nov 29 18:53:11 2009 +0000
@@ -1466,7 +1466,7 @@
if(!jbr->client.name)
return FALSE;
- if(!strcmp(ns, "jabber:iq:last")) {
+ if(!strcmp(ns, NS_LAST_ACTIVITY)) {
if(!strcmp(jbr->client.name, "Trillian")) {
/* verified by nwalp 2007/05/09 */
if(!strcmp(jbr->client.version, "3.1.0.121") ||
@@ -1512,8 +1512,8 @@
* respond (with an error or otherwise) to jabber:iq:last
* requests. There are a number of Trillian users in my
* office. */
- if(!_client_is_blacklisted(jbr, "jabber:iq:last")) {
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last");
+ if(!_client_is_blacklisted(jbr, NS_LAST_ACTIVITY)) {
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY);
xmlnode_set_attrib(iq->node, "to", to);
jabber_iq_set_callback(iq, jabber_last_parse, jbi);
jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id));
@@ -1522,12 +1522,12 @@
if (jbr->tz_off == PURPLE_NO_TZ_OFF &&
(!jbr->caps.info ||
- jabber_resource_has_capability(jbr, "urn:xmpp:time"))) {
+ jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) {
xmlnode *child;
iq = jabber_iq_new(js, JABBER_IQ_GET);
xmlnode_set_attrib(iq->node, "to", to);
child = xmlnode_new_child(iq->node, "time");
- xmlnode_set_namespace(child, "urn:xmpp:time");
+ xmlnode_set_namespace(child, NS_ENTITY_TIME);
jabber_iq_set_callback(iq, jabber_time_parse, jbi);
jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id));
jabber_iq_send(iq);
@@ -1590,7 +1590,7 @@
if (!jb->resources && is_bare_jid) {
/* user is offline, send a jabber:iq:last to find out last time online */
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY);
xmlnode_set_attrib(iq->node, "to", jid);
jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi);
jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id));
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/caps.c
--- a/libpurple/protocols/jabber/caps.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/caps.c Sun Nov 29 18:53:11 2009 +0000
@@ -440,7 +440,7 @@
const char *id, xmlnode *packet, gpointer data)
{
xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
- "http://jabber.org/protocol/disco#info");
+ NS_DISCO_INFO);
jabber_caps_cbplususerdata *userdata = data;
JabberCapsClientInfo *info = NULL, *value;
JabberCapsTuple key;
@@ -531,7 +531,7 @@
const char *id, xmlnode *packet, gpointer data)
{
xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
- "http://jabber.org/protocol/disco#info");
+ NS_DISCO_INFO);
xmlnode *child;
ext_iq_data *userdata = data;
GList *features = NULL;
@@ -638,10 +638,9 @@
xmlnode *query;
char *nodever;
- iq = jabber_iq_new_query(js, JABBER_IQ_GET,
- "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
query = xmlnode_get_child_with_namespace(iq->node, "query",
- "http://jabber.org/protocol/disco#info");
+ NS_DISCO_INFO);
nodever = g_strdup_printf("%s#%s", node, ver);
xmlnode_set_attrib(query, "node", nodever);
g_free(nodever);
@@ -679,10 +678,9 @@
cbdata->name = exts[i];
cbdata->data = cbplususerdata_ref(userdata);
- iq = jabber_iq_new_query(js, JABBER_IQ_GET,
- "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
query = xmlnode_get_child_with_namespace(iq->node, "query",
- "http://jabber.org/protocol/disco#info");
+ NS_DISCO_INFO);
nodeext = g_strdup_printf("%s#%s", node, exts[i]);
xmlnode_set_attrib(query, "node", nodeext);
g_free(nodeext);
@@ -771,7 +769,7 @@
xmlnode *child;
JabberCapsClientInfo *info;
- if (!query || strcmp(query->xmlns, "http://jabber.org/protocol/disco#info"))
+ if (!query || strcmp(query->xmlns, NS_DISCO_INFO))
return 0;
info = g_new0(JabberCapsClientInfo, 1);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/chat.c
--- a/libpurple/protocols/jabber/chat.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/chat.c Sun Nov 29 18:53:11 2009 +0000
@@ -825,7 +825,7 @@
purple_roomlist_set_in_progress(js->roomlist, TRUE);
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
xmlnode_set_attrib(iq->node, "to", server);
@@ -1201,7 +1201,7 @@
for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) {
const char *var = xmlnode_get_attrib(x, "var");
- if(var && !strcmp(var, "http://jabber.org/protocol/xhtml-im")) {
+ if(var && !strcmp(var, NS_XHTML_IM)) {
chat->xhtml = TRUE;
}
}
@@ -1216,8 +1216,7 @@
room_jid = g_strdup_printf("%s@%s", chat->room, chat->server);
- iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET,
- "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO);
xmlnode_set_attrib(iq->node, "to", room_jid);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/data.c
--- a/libpurple/protocols/jabber/data.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/data.c Sun Nov 29 18:53:11 2009 +0000
@@ -18,11 +18,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#include "internal.h"
+
#include
#include
#include
-#include "internal.h"
#include "data.h"
#include "debug.h"
#include "xmlnode.h"
@@ -140,7 +141,7 @@
xmlnode *tag = xmlnode_new("data");
char *base64data = purple_base64_encode(data->data, data->size);
- xmlnode_set_namespace(tag, XEP_0231_NAMESPACE);
+ xmlnode_set_namespace(tag, NS_BOB);
xmlnode_set_attrib(tag, "cid", data->cid);
xmlnode_set_attrib(tag, "type", data->type);
@@ -169,7 +170,7 @@
{
xmlnode *tag = xmlnode_new("data");
- xmlnode_set_namespace(tag, XEP_0231_NAMESPACE);
+ xmlnode_set_namespace(tag, NS_BOB);
xmlnode_set_attrib(tag, "cid", cid);
return tag;
@@ -254,7 +255,7 @@
remote_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, jabber_data_delete);
- jabber_iq_register_handler("data", XEP_0231_NAMESPACE, jabber_data_parse);
+ jabber_iq_register_handler("data", NS_BOB, jabber_data_parse);
}
void
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/data.h
--- a/libpurple/protocols/jabber/data.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/data.h Sun Nov 29 18:53:11 2009 +0000
@@ -24,8 +24,6 @@
#include "xmlnode.h"
#include "jabber.h"
-#define XEP_0231_NAMESPACE "urn:xmpp:bob"
-
#include
typedef struct {
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/disco.c
--- a/libpurple/protocols/jabber/disco.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/disco.c Sun Nov 29 18:53:11 2009 +0000
@@ -60,7 +60,7 @@
{
JabberBytestreamsStreamhost *sh = data;
xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
- "http://jabber.org/protocol/bytestreams");
+ NS_BYTESTREAMS);
if (from && !strcmp(from, sh->jid) && query != NULL) {
xmlnode *sh_node = xmlnode_get_child(query, "streamhost");
@@ -109,8 +109,7 @@
/* create custom caps node URI */
node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL);
- iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
- "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO);
jabber_iq_set_id(iq, id);
@@ -152,7 +151,7 @@
* advertises as 'voice-v1'.
*/
xmlnode *feature = xmlnode_new_child(query, "feature");
- xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/voice/v1");
+ xmlnode_set_attrib(feature, "var", NS_GOOGLE_VOICE);
} else if (g_str_equal(node, CAPS0115_NODE "#" "video-v1")) {
/*
* HUGE HACK! We advertise this ext (see jabber_presence_create_js
@@ -164,7 +163,7 @@
* advertises as 'video-v1'.
*/
xmlnode *feature = xmlnode_new_child(query, "feature");
- xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/video/v1");
+ xmlnode_set_attrib(feature, "var", NS_GOOGLE_VIDEO);
} else if (g_str_equal(node, CAPS0115_NODE "#" "camera-v1")) {
/*
* HUGE HACK! We advertise this ext (see jabber_presence_create_js
@@ -176,7 +175,7 @@
* advertises as 'camera-v1'.
*/
xmlnode *feature = xmlnode_new_child(query, "feature");
- xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/camera/v1");
+ xmlnode_set_attrib(feature, "var", NS_GOOGLE_CAMERA);
#endif
} else {
xmlnode *error, *inf;
@@ -189,7 +188,7 @@
xmlnode_set_attrib(error, "code", "404");
xmlnode_set_attrib(error, "type", "cancel");
inf = xmlnode_new_child(error, "item-not-found");
- xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(inf, NS_XMPP_STANZAS);
}
g_free(node_uri);
jabber_iq_send(iq);
@@ -204,7 +203,7 @@
error = xmlnode_new_child(iq->node, "error");
xmlnode_set_attrib(error, "type", "modify");
bad_request = xmlnode_new_child(error, "bad-request");
- xmlnode_set_namespace(bad_request, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS);
jabber_iq_set_id(iq, id);
if (from)
@@ -221,8 +220,7 @@
struct _jabber_disco_info_cb_data *jdicd = data;
xmlnode *query;
- query = xmlnode_get_child_with_namespace(packet, "query",
- "http://jabber.org/protocol/disco#info");
+ query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO);
if (type == JABBER_IQ_RESULT && query) {
xmlnode *child;
@@ -257,7 +255,7 @@
} else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
/* we found a JUD */
js->user_directories = g_list_prepend(js->user_directories, g_strdup(from));
- } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) {
+ } else if(!strcmp(category, "proxy") && !strcmp(type, NS_BYTESTREAMS)) {
/* This is a bytestream proxy */
JabberIq *iq;
JabberBytestreamsStreamhost *sh;
@@ -269,7 +267,7 @@
js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
iq = jabber_iq_new_query(js, JABBER_IQ_GET,
- "http://jabber.org/protocol/bytestreams");
+ NS_BYTESTREAMS);
xmlnode_set_attrib(iq->node, "to", sh->jid);
jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
jabber_iq_send(iq);
@@ -284,20 +282,20 @@
capabilities |= JABBER_CAP_SI;
else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
capabilities |= JABBER_CAP_SI_FILE_XFER;
- else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
+ else if(!strcmp(var, NS_BYTESTREAMS))
capabilities |= JABBER_CAP_BYTESTREAMS;
else if(!strcmp(var, "jabber:iq:search"))
capabilities |= JABBER_CAP_IQ_SEARCH;
else if(!strcmp(var, "jabber:iq:register"))
capabilities |= JABBER_CAP_IQ_REGISTER;
- else if(!strcmp(var, "urn:xmpp:ping"))
+ else if(!strcmp(var, NS_PING))
capabilities |= JABBER_CAP_PING;
- else if(!strcmp(var, "http://jabber.org/protocol/disco#items"))
+ else if(!strcmp(var, NS_DISCO_ITEMS))
capabilities |= JABBER_CAP_ITEMS;
else if(!strcmp(var, "http://jabber.org/protocol/commands")) {
capabilities |= JABBER_CAP_ADHOC;
}
- else if(!strcmp(var, "http://jabber.org/protocol/ibb")) {
+ else if(!strcmp(var, NS_IBB)) {
purple_debug_info("jabber", "remote supports IBB\n");
capabilities |= JABBER_CAP_IBB;
}
@@ -341,7 +339,7 @@
{
if(type == JABBER_IQ_GET) {
JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
- "http://jabber.org/protocol/disco#items");
+ NS_DISCO_ITEMS);
/* preserve node */
xmlnode *iq_query = xmlnode_get_child(iq->node, "query");
@@ -409,8 +407,7 @@
sh->jid = g_strdup(ft_proxy_list[i]);
js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
- iq = jabber_iq_new_query(js, JABBER_IQ_GET,
- "http://jabber.org/protocol/bytestreams");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS);
xmlnode_set_attrib(iq->node, "to", sh->jid);
jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
jabber_iq_send(iq);
@@ -555,7 +552,7 @@
if (!var)
continue;
- if (!strcmp("google:mail:notify", var)) {
+ if (!strcmp(NS_GOOGLE_MAIL_NOTIFY, var)) {
js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
jabber_gmail_init(js);
} else if (!strcmp("google:roster", var)) {
@@ -563,7 +560,7 @@
jabber_google_roster_init(js);
} else if (!strcmp("http://jabber.org/protocol/commands", var)) {
js->server_caps |= JABBER_CAP_ADHOC;
- } else if (!strcmp("urn:xmpp:blocking", var)) {
+ } else if (!strcmp(NS_SIMPLE_BLOCKING, var)) {
js->server_caps |= JABBER_CAP_BLOCKING;
}
}
@@ -604,7 +601,7 @@
if((node = xmlnode_get_attrib(child, "node")))
continue;
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
xmlnode_set_attrib(iq->node, "to", jid);
jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL);
jabber_iq_send(iq);
@@ -613,15 +610,14 @@
void jabber_disco_items_server(JabberStream *js)
{
- JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
- "http://jabber.org/protocol/disco#items");
+ JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
xmlnode_set_attrib(iq->node, "to", js->user->domain);
jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL);
jabber_iq_send(iq);
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
xmlnode_set_attrib(iq->node, "to", js->user->domain);
jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL);
jabber_iq_send(iq);
@@ -650,7 +646,7 @@
jdicd->data = data;
jdicd->callback = callback;
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
xmlnode_set_attrib(iq->node, "to", who);
jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/google.c
--- a/libpurple/protocols/jabber/google.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/google.c Sun Nov 29 18:53:11 2009 +0000
@@ -37,9 +37,6 @@
#ifdef USE_VV
-#define NS_GOOGLE_VIDEO "http://www.google.com/session/video"
-#define NS_GOOGLE_PHONE "http://www.google.com/session/phone"
-
typedef struct {
char *id;
char *initiator;
@@ -86,7 +83,7 @@
google_session_create_xmlnode(GoogleSession *session, const char *type)
{
xmlnode *node = xmlnode_new("session");
- xmlnode_set_namespace(node, "http://www.google.com/session");
+ xmlnode_set_namespace(node, NS_GOOGLE_SESSION);
xmlnode_set_attrib(node, "id", session->id.id);
xmlnode_set_attrib(node, "initiator", session->id.initiator);
xmlnode_set_attrib(node, "type", type);
@@ -215,9 +212,9 @@
xmlnode_insert_child(iq->node, sess);
desc = xmlnode_new_child(sess, "description");
if (session->video)
- xmlnode_set_namespace(desc, NS_GOOGLE_VIDEO);
+ xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_VIDEO);
else
- xmlnode_set_namespace(desc, NS_GOOGLE_PHONE);
+ xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_PHONE);
codecs = purple_media_get_codecs(media, "google-video");
@@ -250,7 +247,7 @@
purple_media_codec_get_clock_rate(codec));
payload = xmlnode_new_child(desc, "payload-type");
if (session->video)
- xmlnode_set_namespace(payload, NS_GOOGLE_PHONE);
+ xmlnode_set_namespace(payload, NS_GOOGLE_SESSION_PHONE);
xmlnode_set_attrib(payload, "id", id);
/*
* Hack to make Gmail accept speex as the codec.
@@ -613,7 +610,7 @@
id = xmlnode_get_attrib(codec_element, "id");
if (!session->video ||
- (xmlns && !strcmp(xmlns, NS_GOOGLE_PHONE))) {
+ (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_PHONE))) {
clock_rate = xmlnode_get_attrib(
codec_element, "clockrate");
video = FALSE;
@@ -790,7 +787,7 @@
GList *codecs = NULL, *video_codecs = NULL;
JabberIq *result = NULL;
const gchar *xmlns = xmlnode_get_namespace(desc_element);
- gboolean video = (xmlns && !strcmp(xmlns, NS_GOOGLE_VIDEO));
+ gboolean video = (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_VIDEO));
for (; codec_element; codec_element = codec_element->next) {
const gchar *xmlns, *encoding_name, *id,
@@ -804,7 +801,7 @@
encoding_name = xmlnode_get_attrib(codec_element, "name");
id = xmlnode_get_attrib(codec_element, "id");
- if (!video || purple_strequal(xmlns, NS_GOOGLE_PHONE))
+ if (!video || purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE))
clock_rate = xmlnode_get_attrib(
codec_element, "clockrate");
else {
@@ -1080,7 +1077,7 @@
purple_debug_misc("jabber",
"Got new mail notification. Sending request for more info\n");
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY);
jabber_iq_set_callback(iq, jabber_gmail_parse, NULL);
query = xmlnode_get_child(iq->node, "query");
@@ -1114,7 +1111,7 @@
xmlnode_set_attrib(mailnotifications, "value", "true");
jabber_iq_send(iq);
- iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
+ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY);
jabber_iq_set_callback(iq, jabber_gmail_parse, NULL);
jabber_iq_send(iq);
}
@@ -1584,7 +1581,7 @@
xmlnode *packet, gpointer data)
{
xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
- GOOGLE_JINGLE_INFO_NAMESPACE);
+ NS_GOOGLE_JINGLE_INFO);
if (query)
jabber_google_jingle_info_common(js, from, type, query);
@@ -1604,7 +1601,7 @@
jabber_google_send_jingle_info(JabberStream *js)
{
JabberIq *jingle_info =
- jabber_iq_new_query(js, JABBER_IQ_GET, GOOGLE_JINGLE_INFO_NAMESPACE);
+ jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_JINGLE_INFO);
jabber_iq_set_callback(jingle_info, jabber_google_jingle_info_cb,
NULL);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/google.h
--- a/libpurple/protocols/jabber/google.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/google.h Sun Nov 29 18:53:11 2009 +0000
@@ -25,11 +25,6 @@
* such that they don't intermingle with code for the XMPP RFCs and XEPs :) */
#include "jabber.h"
-#include "media.h"
-
-#define GOOGLE_VOICE_CAP "http://www.google.com/xmpp/protocol/voice/v1"
-#define GOOGLE_VIDEO_CAP "http://www.google.com/xmpp/protocol/video/v1"
-#define GOOGLE_JINGLE_INFO_NAMESPACE "google:jingleinfo"
#define GOOGLE_GROUPCHAT_SERVER "groupchat.google.com"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/ibb.c
--- a/libpurple/protocols/jabber/ibb.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/ibb.c Sun Nov 29 18:53:11 2009 +0000
@@ -228,7 +228,7 @@
gchar block_size[10];
xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess));
- xmlnode_set_namespace(open, XEP_0047_NAMESPACE);
+ xmlnode_set_namespace(open, NS_IBB);
xmlnode_set_attrib(open, "sid", jabber_ibb_session_get_sid(sess));
g_snprintf(block_size, sizeof(block_size), "%" G_GSIZE_FORMAT,
jabber_ibb_session_get_block_size(sess));
@@ -256,7 +256,7 @@
xmlnode *close = xmlnode_new("close");
xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess));
- xmlnode_set_namespace(close, XEP_0047_NAMESPACE);
+ xmlnode_set_namespace(close, NS_IBB);
xmlnode_set_attrib(close, "sid", jabber_ibb_session_get_sid(sess));
xmlnode_insert_child(set->node, close);
jabber_iq_send(set);
@@ -333,7 +333,7 @@
g_snprintf(seq, sizeof(seq), "%u", jabber_ibb_session_get_send_seq(sess));
xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess));
- xmlnode_set_namespace(data_element, XEP_0047_NAMESPACE);
+ xmlnode_set_namespace(data_element, NS_IBB);
xmlnode_set_attrib(data_element, "sid", jabber_ibb_session_get_sid(sess));
xmlnode_set_attrib(data_element, "seq", seq);
xmlnode_insert_data(data_element, base64, -1);
@@ -361,8 +361,7 @@
xmlnode *error = xmlnode_new("error");
xmlnode *item_not_found = xmlnode_new("item-not-found");
- xmlnode_set_namespace(item_not_found,
- "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(item_not_found, NS_XMPP_STANZAS);
xmlnode_set_attrib(error, "code", "440");
xmlnode_set_attrib(error, "type", "cancel");
jabber_iq_set_id(result, id);
@@ -507,11 +506,11 @@
{
jabber_ibb_sessions = g_hash_table_new(g_str_hash, g_str_equal);
- jabber_add_feature(XEP_0047_NAMESPACE, NULL);
+ jabber_add_feature(NS_IBB, NULL);
- jabber_iq_register_handler("close", XEP_0047_NAMESPACE, jabber_ibb_parse);
- jabber_iq_register_handler("data", XEP_0047_NAMESPACE, jabber_ibb_parse);
- jabber_iq_register_handler("open", XEP_0047_NAMESPACE, jabber_ibb_parse);
+ jabber_iq_register_handler("close", NS_IBB, jabber_ibb_parse);
+ jabber_iq_register_handler("data", NS_IBB, jabber_ibb_parse);
+ jabber_iq_register_handler("open", NS_IBB, jabber_ibb_parse);
}
void
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/ibb.h
--- a/libpurple/protocols/jabber/ibb.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/ibb.h Sun Nov 29 18:53:11 2009 +0000
@@ -24,8 +24,6 @@
#include "jabber.h"
#include "iq.h"
-#define XEP_0047_NAMESPACE "http://jabber.org/protocol/ibb"
-
typedef struct _JabberIBBSession JabberIBBSession;
typedef void
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/iq.c
--- a/libpurple/protocols/jabber/iq.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/iq.c Sun Nov 29 18:53:11 2009 +0000
@@ -155,7 +155,7 @@
char *idle_time;
if(type == JABBER_IQ_GET) {
- iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:last");
+ iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY);
jabber_iq_set_id(iq, id);
if (from)
xmlnode_set_attrib(iq->node, "to", from);
@@ -190,7 +190,7 @@
xmlnode_set_attrib(iq->node, "to", from);
child = xmlnode_new_child(iq->node, child->name);
- xmlnode_set_namespace(child, "urn:xmpp:time");
+ xmlnode_set_namespace(child, NS_ENTITY_TIME);
/* -06:00 */
tm = localtime(&now_t);
@@ -200,7 +200,7 @@
/* 2006-12-19T17:58:35Z */
tm = gmtime(&now_t);
- date = purple_utf8_strftime("%FT%TZ", tm);
+ date = purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm);
utc = xmlnode_new_child(child, "utc");
xmlnode_insert_data(utc, date, -1);
@@ -332,7 +332,7 @@
error = xmlnode_new_child(iq->node, "error");
xmlnode_set_attrib(error, "type", "modify");
x = xmlnode_new_child(error, "bad-request");
- xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(x, NS_XMPP_STANZAS);
jabber_iq_send(iq);
} else
@@ -397,7 +397,7 @@
xmlnode_set_attrib(error, "type", "cancel");
xmlnode_set_attrib(error, "code", "501");
x = xmlnode_new_child(error, "feature-not-implemented");
- xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(x, NS_XMPP_STANZAS);
jabber_iq_send(iq);
}
@@ -458,21 +458,19 @@
signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
jabber_iq_register_handler("jingle", JINGLE, jingle_parse);
- jabber_iq_register_handler("mailbox", "google:mail:notify",
+ jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY,
jabber_gmail_poke);
- jabber_iq_register_handler("new-mail", "google:mail:notify",
+ jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY,
jabber_gmail_poke);
- jabber_iq_register_handler("ping", "urn:xmpp:ping", jabber_ping_parse);
- jabber_iq_register_handler("query", GOOGLE_JINGLE_INFO_NAMESPACE,
+ jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse);
+ jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO,
jabber_google_handle_jingle_info);
- jabber_iq_register_handler("query", "http://jabber.org/protocol/bytestreams",
+ jabber_iq_register_handler("query", NS_BYTESTREAMS,
jabber_bytestreams_parse);
- jabber_iq_register_handler("query", "http://jabber.org/protocol/disco#info",
- jabber_disco_info_parse);
- jabber_iq_register_handler("query", "http://jabber.org/protocol/disco#items",
- jabber_disco_items_parse);
- jabber_iq_register_handler("query", "jabber:iq:last", jabber_iq_last_parse);
- jabber_iq_register_handler("query", "jabber:iq:oob", jabber_oob_parse);
+ jabber_iq_register_handler("query", NS_DISCO_INFO, jabber_disco_info_parse);
+ jabber_iq_register_handler("query", NS_DISCO_ITEMS, jabber_disco_items_parse);
+ jabber_iq_register_handler("query", NS_LAST_ACTIVITY, jabber_iq_last_parse);
+ jabber_iq_register_handler("query", NS_OOB_IQ_DATA, jabber_oob_parse);
jabber_iq_register_handler("query", "jabber:iq:register",
jabber_register_parse);
jabber_iq_register_handler("query", "jabber:iq:roster",
@@ -480,12 +478,12 @@
jabber_iq_register_handler("query", "jabber:iq:version",
jabber_iq_version_parse);
#ifdef USE_VV
- jabber_iq_register_handler("session", "http://www.google.com/session",
+ jabber_iq_register_handler("session", NS_GOOGLE_SESSION,
jabber_google_session_parse);
#endif
- jabber_iq_register_handler("block", "urn:xmpp:blocking", jabber_blocklist_parse_push);
- jabber_iq_register_handler("unblock", "urn:xmpp:blocking", jabber_blocklist_parse_push);
- jabber_iq_register_handler("time", "urn:xmpp:time", jabber_time_parse);
+ jabber_iq_register_handler("block", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push);
+ jabber_iq_register_handler("unblock", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push);
+ jabber_iq_register_handler("time", NS_ENTITY_TIME, jabber_time_parse);
}
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c Sun Nov 29 18:53:11 2009 +0000
@@ -81,8 +81,8 @@
char *open_stream;
open_stream = g_strdup_printf("",
js->user->domain);
/* setup the parser fresh for each stream */
@@ -116,7 +116,7 @@
jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL);
session = xmlnode_new_child(iq->node, "session");
- xmlnode_set_namespace(session, "urn:ietf:params:xml:ns:xmpp-session");
+ xmlnode_set_namespace(session, NS_XMPP_SESSION);
jabber_iq_send(iq);
}
@@ -128,7 +128,7 @@
xmlnode *bind;
if (type == JABBER_IQ_RESULT &&
- (bind = xmlnode_get_child_with_namespace(packet, "bind", "urn:ietf:params:xml:ns:xmpp-bind"))) {
+ (bind = xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) {
xmlnode *jid;
char *full_jid;
if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) {
@@ -217,7 +217,7 @@
char *requested_resource;
JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
bind = xmlnode_new_child(iq->node, "bind");
- xmlnode_set_namespace(bind, "urn:ietf:params:xml:ns:xmpp-bind");
+ xmlnode_set_namespace(bind, NS_XMPP_BIND);
requested_resource = jabber_prep_resource(js->user->resource);
if (requested_resource != NULL) {
@@ -272,11 +272,11 @@
} else if(!strcmp((*packet)->name, "stream:features")) {
jabber_stream_features_parse(js, *packet);
} else if (!strcmp((*packet)->name, "features") && xmlns &&
- !strcmp(xmlns, "http://etherx.jabber.org/streams")) {
+ !strcmp(xmlns, NS_XMPP_STREAMS)) {
jabber_stream_features_parse(js, *packet);
} else if(!strcmp((*packet)->name, "stream:error") ||
(!strcmp((*packet)->name, "error") && xmlns &&
- !strcmp(xmlns, "http://etherx.jabber.org/streams")))
+ !strcmp(xmlns, NS_XMPP_STREAMS)))
{
jabber_stream_handle_error(js, *packet);
} else if(!strcmp((*packet)->name, "challenge")) {
@@ -385,7 +385,7 @@
if(js->state != JABBER_STREAM_CONNECTED &&
/* Either or ... */
(((tag_start = strstr(data, "") &&
(tag_start = strstr(tag_start, ""))))) {
@@ -476,12 +476,19 @@
if (NULL == packet)
return;
+ if (!PURPLE_CONNECTION_IS_VALID(pc))
+ return;
+
js = purple_connection_get_protocol_data(pc);
+
+ if (NULL == js)
+ return;
+
if (js->bosh)
if (g_str_equal((*packet)->name, "message") ||
g_str_equal((*packet)->name, "iq") ||
g_str_equal((*packet)->name, "presence"))
- xmlnode_set_namespace(*packet, "jabber:client");
+ xmlnode_set_namespace(*packet, NS_XMPP_CLIENT);
txt = xmlnode_to_str(*packet, &len);
jabber_send_raw(js, txt, len);
g_free(txt);
@@ -1209,7 +1216,7 @@
jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from));
return;
- } else if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:oob"))) {
+ } else if((x = xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) {
xmlnode *url;
if((url = xmlnode_get_child(x, "url"))) {
@@ -1653,7 +1660,7 @@
error = xmlnode_new_child(result->node, "error");
xmlnode_set_attrib(error, "type", "cancel");
x = xmlnode_new_child(error, "not-allowed");
- xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(x, NS_XMPP_STANZAS);
jabber_iq_send(result);
return;
@@ -1679,7 +1686,7 @@
error = xmlnode_new_child(result->node, "error");
xmlnode_set_attrib(error, "type", "modify");
x = xmlnode_new_child(error, "bad-request");
- xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(x, NS_XMPP_STANZAS);
jabber_iq_send(result);
return;
@@ -1709,7 +1716,7 @@
PurpleAccount *account;
blocklist = xmlnode_get_child_with_namespace(packet,
- "blocklist", "urn:xmpp:blocking");
+ "blocklist", NS_SIMPLE_BLOCKING);
account = purple_connection_get_account(js->gc);
if (type == JABBER_IQ_ERROR || blocklist == NULL)
@@ -1742,7 +1749,7 @@
iq = jabber_iq_new(js, JABBER_IQ_GET);
blocklist = xmlnode_new_child(iq->node, "blocklist");
- xmlnode_set_namespace(blocklist, "urn:xmpp:blocking");
+ xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING);
jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL);
@@ -1775,7 +1782,7 @@
iq = jabber_iq_new(js, JABBER_IQ_SET);
block = xmlnode_new_child(iq->node, "block");
- xmlnode_set_namespace(block, "urn:xmpp:blocking");
+ xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING);
item = xmlnode_new_child(block, "item");
xmlnode_set_attrib(item, "jid", who);
@@ -1805,7 +1812,7 @@
iq = jabber_iq_new(js, JABBER_IQ_SET);
unblock = xmlnode_new_child(iq->node, "unblock");
- xmlnode_set_namespace(unblock, "urn:xmpp:blocking");
+ xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING);
item = xmlnode_new_child(unblock, "item");
xmlnode_set_attrib(item, "jid", who);
@@ -2469,7 +2476,7 @@
} else if(xmlnode_get_child(error, "undefined-condition")) {
text = _("Unknown Error");
}
- } else if(xmlns && !strcmp(xmlns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
+ } else if(xmlns && !strcmp(xmlns, NS_XMPP_SASL)) {
/* Most common reason can be the default */
SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR);
if(xmlnode_get_child(packet, "aborted")) {
@@ -2497,7 +2504,7 @@
}
} else if(!strcmp(packet->name, "stream:error") ||
(!strcmp(packet->name, "error") && xmlns &&
- !strcmp(xmlns, "http://etherx.jabber.org/streams"))) {
+ !strcmp(xmlns, NS_XMPP_STREAMS))) {
/* Most common reason as default: */
SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR);
if(xmlnode_get_child(packet, "bad-format")) {
@@ -2853,7 +2860,7 @@
return FALSE;
}
- if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) {
+ if (jabber_resource_has_capability(jbr, NS_ATTENTION)) {
xmlnode *buzz, *msg = xmlnode_new("message");
gchar *to;
@@ -2865,7 +2872,7 @@
xmlnode_set_attrib(msg, "type", "headline");
buzz = xmlnode_new_child(msg, "attention");
- xmlnode_set_namespace(buzz, XEP_0224_NAMESPACE);
+ xmlnode_set_namespace(buzz, NS_ATTENTION);
jabber_send(js, msg);
xmlnode_free(msg);
@@ -3203,10 +3210,9 @@
caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION |
PURPLE_MEDIA_CAPS_CHANGE_DIRECTION;
}
- if (jabber_resource_has_capability(jbr, GOOGLE_VOICE_CAP)) {
+ if (jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) {
caps |= PURPLE_MEDIA_CAPS_AUDIO;
- if (jabber_resource_has_capability(jbr,
- GOOGLE_VIDEO_CAP))
+ if (jabber_resource_has_capability(jbr, NS_GOOGLE_VIDEO))
caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO;
}
return caps;
@@ -3283,9 +3289,8 @@
if (jabber_resource_has_capability(jbr,
"http://jabber.org/protocol/si/profile/file-transfer")
&& (jabber_resource_has_capability(jbr,
- "http://jabber.org/protocol/bytestreams")
- || jabber_resource_has_capability(jbr,
- XEP_0047_NAMESPACE))) {
+ NS_BYTESTREAMS)
+ || jabber_resource_has_capability(jbr, NS_IBB))) {
return TRUE;
}
}
@@ -3496,38 +3501,38 @@
jabber_add_identity("client", type, NULL, ui_name);
/* initialize jabber_features list */
- jabber_add_feature("jabber:iq:last", 0);
- jabber_add_feature("jabber:iq:oob", 0);
- jabber_add_feature("urn:xmpp:time", 0);
+ jabber_add_feature(NS_LAST_ACTIVITY, 0);
+ jabber_add_feature(NS_OOB_IQ_DATA, 0);
+ jabber_add_feature(NS_ENTITY_TIME, 0);
jabber_add_feature("jabber:iq:version", 0);
jabber_add_feature("jabber:x:conference", 0);
- jabber_add_feature("http://jabber.org/protocol/bytestreams", 0);
+ jabber_add_feature(NS_BYTESTREAMS, 0);
jabber_add_feature("http://jabber.org/protocol/caps", 0);
jabber_add_feature("http://jabber.org/protocol/chatstates", 0);
- jabber_add_feature("http://jabber.org/protocol/disco#info", 0);
- jabber_add_feature("http://jabber.org/protocol/disco#items", 0);
- jabber_add_feature("http://jabber.org/protocol/ibb", 0);
+ jabber_add_feature(NS_DISCO_INFO, 0);
+ jabber_add_feature(NS_DISCO_ITEMS, 0);
+ jabber_add_feature(NS_IBB, 0);
jabber_add_feature("http://jabber.org/protocol/muc", 0);
jabber_add_feature("http://jabber.org/protocol/muc#user", 0);
jabber_add_feature("http://jabber.org/protocol/si", 0);
jabber_add_feature("http://jabber.org/protocol/si/profile/file-transfer", 0);
- jabber_add_feature("http://jabber.org/protocol/xhtml-im", 0);
- jabber_add_feature("urn:xmpp:ping", 0);
+ jabber_add_feature(NS_XHTML_IM, 0);
+ jabber_add_feature(NS_PING, 0);
/* Buzz/Attention */
- jabber_add_feature(XEP_0224_NAMESPACE, jabber_buzz_isenabled);
+ jabber_add_feature(NS_ATTENTION, jabber_buzz_isenabled);
/* Bits Of Binary */
- jabber_add_feature(XEP_0231_NAMESPACE, 0);
+ jabber_add_feature(NS_BOB, 0);
/* Jingle features! */
jabber_add_feature(JINGLE, 0);
#ifdef USE_VV
- jabber_add_feature("http://www.google.com/xmpp/protocol/session", jabber_audio_enabled);
- jabber_add_feature("http://www.google.com/xmpp/protocol/voice/v1", jabber_audio_enabled);
- jabber_add_feature("http://www.google.com/xmpp/protocol/video/v1", jabber_video_enabled);
- jabber_add_feature("http://www.google.com/xmpp/protocol/camera/v1", jabber_video_enabled);
+ jabber_add_feature(NS_GOOGLE_PROTOCOL_SESSION, jabber_audio_enabled);
+ jabber_add_feature(NS_GOOGLE_VOICE, jabber_audio_enabled);
+ jabber_add_feature(NS_GOOGLE_VIDEO, jabber_video_enabled);
+ jabber_add_feature(NS_GOOGLE_CAMERA, jabber_video_enabled);
jabber_add_feature(JINGLE_APP_RTP, 0);
jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled);
jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/jabber.h
--- a/libpurple/protocols/jabber/jabber.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.h Sun Nov 29 18:53:11 2009 +0000
@@ -64,6 +64,8 @@
#include "roomlist.h"
#include "sslconn.h"
+#include "namespaces.h"
+
#include "iq.h"
#include "jutil.h"
#include "xmlnode.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/jingle/session.c
--- a/libpurple/protocols/jabber/jingle/session.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/session.c Sun Nov 29 18:53:11 2009 +0000
@@ -360,11 +360,15 @@
JingleSession *
jingle_session_find_by_sid(JabberStream *js, const gchar *sid)
{
+ JingleSession *session = NULL;
+
+ if (js->sessions)
+ session = g_hash_table_lookup(js->sessions, sid);
+
purple_debug_info("jingle", "find_by_id %s\n", sid);
- purple_debug_info("jingle", "lookup: %p\n", (js->sessions) ?
- g_hash_table_lookup(js->sessions, sid) : NULL);
- return (JingleSession *) (js->sessions) ?
- g_hash_table_lookup(js->sessions, sid) : NULL;
+ purple_debug_info("jingle", "lookup: %p\n", session);
+
+ return session;
}
#if GLIB_CHECK_VERSION(2,4,0)
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/message.c Sun Nov 29 18:53:11 2009 +0000
@@ -178,7 +178,7 @@
for(etc = jm->etc; etc; etc = etc->next) {
xmlnode *x = etc->data;
const char *xmlns = xmlnode_get_namespace(x);
- if(xmlns && !strcmp(xmlns, "jabber:x:oob")) {
+ if(xmlns && !strcmp(xmlns, NS_OOB_X_DATA)) {
xmlnode *url, *desc;
char *urltxt, *desctxt;
@@ -460,7 +460,7 @@
jabber_message_add_remote_smileys(const xmlnode *message)
{
xmlnode *data_tag;
- for (data_tag = xmlnode_get_child_with_namespace(message, "data", XEP_0231_NAMESPACE) ;
+ for (data_tag = xmlnode_get_child_with_namespace(message, "data", NS_BOB) ;
data_tag ;
data_tag = xmlnode_get_next_twin(data_tag)) {
const gchar *cid = xmlnode_get_attrib(data_tag, "cid");
@@ -611,22 +611,22 @@
jm->etc = g_list_append(jm->etc, child);
/* The following tests expect xmlns != NULL */
continue;
- } else if(!strcmp(child->name, "subject") && !strcmp(xmlns,"jabber:client")) {
+ } else if(!strcmp(child->name, "subject") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
if(!jm->subject) {
jm->subject = xmlnode_get_data(child);
if(!jm->subject)
jm->subject = g_strdup("");
}
- } else if(!strcmp(child->name, "thread") && !strcmp(xmlns,"jabber:client")) {
+ } else if(!strcmp(child->name, "thread") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
if(!jm->thread_id)
jm->thread_id = xmlnode_get_data(child);
- } else if(!strcmp(child->name, "body") && !strcmp(xmlns,"jabber:client")) {
+ } else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
if(!jm->body) {
char *msg = xmlnode_to_str(child, NULL);
jm->body = purple_strdup_withhtml(msg);
g_free(msg);
}
- } else if(!strcmp(child->name, "html") && !strcmp(xmlns,"http://jabber.org/protocol/xhtml-im")) {
+ } else if(!strcmp(child->name, "html") && !strcmp(xmlns, NS_XHTML_IM)) {
if(!jm->xhtml && xmlnode_get_child(child, "body")) {
char *c;
@@ -740,15 +740,15 @@
jm->type = JABBER_MESSAGE_EVENT;
for(items = xmlnode_get_child(child,"items"); items; items = items->next)
jm->eventitems = g_list_append(jm->eventitems, items);
- } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, XEP_0224_NAMESPACE)) {
+ } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, NS_ATTENTION)) {
jm->hasBuzz = TRUE;
- } else if(!strcmp(child->name, "delay") && !strcmp(xmlns,"urn:xmpp:delay")) {
+ } else if(!strcmp(child->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) {
const char *timestamp = xmlnode_get_attrib(child, "stamp");
jm->delayed = TRUE;
if(timestamp)
jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL);
} else if(!strcmp(child->name, "x")) {
- if(!strcmp(xmlns, "jabber:x:delay")) {
+ if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) {
const char *timestamp = xmlnode_get_attrib(child, "stamp");
jm->delayed = TRUE;
if(timestamp)
@@ -800,7 +800,7 @@
}
} else if (g_str_equal(child->name, "query")) {
const char *node = xmlnode_get_attrib(child, "node");
- if (purple_strequal(xmlns, "http://jabber.org/protocol/disco#items")
+ if (purple_strequal(xmlns, NS_DISCO_ITEMS)
&& purple_strequal(node, "http://jabber.org/protocol/commands")) {
jabber_adhoc_got_list(js, jm->from, child);
}
@@ -946,7 +946,7 @@
case PURPLE_CONV_TYPE_IM:
jb = jabber_buddy_find(js, who, FALSE);
if (jb) {
- return jabber_buddy_has_capability(jb, XEP_0231_NAMESPACE);
+ return jabber_buddy_has_capability(jb, NS_BOB);
} else {
return FALSE;
}
@@ -958,7 +958,7 @@
10 people, to avoid getting too many BoB requests */
return jabber_chat_get_num_participants(chat) <= 10 &&
jabber_chat_all_participants_have_capability(chat,
- XEP_0231_NAMESPACE);
+ NS_BOB);
} else {
return FALSE;
}
@@ -1204,9 +1204,9 @@
* the user's roster, allow sending XHTML-IM markup.
*/
if (!jbr || !jbr->caps.info ||
- jabber_resource_has_capability(jbr, "http://jabber.org/protocol/xhtml-im")) {
+ jabber_resource_has_capability(jbr, NS_XHTML_IM)) {
if (!jabber_xhtml_plain_equal(xhtml, jm->body))
- jm->xhtml = g_strdup_printf("%s", xhtml);
+ jm->xhtml = g_strdup_printf("%s", xhtml);
}
g_free(xhtml);
@@ -1249,7 +1249,7 @@
}
if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body))
- jm->xhtml = g_strdup_printf("%s", xhtml);
+ jm->xhtml = g_strdup_printf("%s", xhtml);
g_free(xhtml);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/message.h
--- a/libpurple/protocols/jabber/message.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/message.h Sun Nov 29 18:53:11 2009 +0000
@@ -28,8 +28,6 @@
#include "jabber.h"
#include "xmlnode.h"
-#define XEP_0224_NAMESPACE "urn:xmpp:attention:0"
-
typedef struct _JabberMessage {
JabberStream *js;
enum {
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/namespaces.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/jabber/namespaces.h Sun Nov 29 18:53:11 2009 +0000
@@ -0,0 +1,101 @@
+/*
+ * purple - Jabber Protocol Plugin
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ *
+ */
+
+#ifndef PURPLE_JABBER_NAMESPACES_H_
+#define PURPLE_JABBER_NAMESPACES_H_
+
+#define NS_XMPP_BIND "urn:ietf:params:xml:ns:xmpp-bind"
+#define NS_XMPP_CLIENT "jabber:client"
+#define NS_XMPP_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
+#define NS_XMPP_SESSION "urn:ietf:params:xml:ns:xmpp-session"
+#define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas"
+#define NS_XMPP_STREAMS "http://etherx.jabber.org/streams"
+
+/* XEP-0012 Last Activity (and XEP-0256 Last Activity in Presence) */
+#define NS_LAST_ACTIVITY "jabber:iq:last"
+
+/* XEP-0030 Service Discovery */
+#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info"
+#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items"
+
+/* XEP-0047 IBB (In-band bytestreams) */
+#define NS_IBB "http://jabber.org/protocol/ibb"
+
+/* XEP-0065 SOCKS5 Bytestreams */
+#define NS_BYTESTREAMS "http://jabber.org/protocol/bytestreams"
+
+/* XEP-0066 Out of Band Data (OOB) */
+#define NS_OOB_IQ_DATA "jabber:iq:oob"
+#define NS_OOB_X_DATA "jabber:x:oob"
+
+/* XEP-0071 XHTML-IM (rich-text messages) */
+#define NS_XHTML_IM "http://jabber.org/protocol/xhtml-im"
+#define NS_XHTML "http://www.w3.org/1999/xhtml"
+
+/* XEP-0084 v0.12 User Avatar */
+#define NS_AVATAR_0_12_DATA "http://www.xmpp.org/extensions/xep-0084.html#ns-data"
+#define NS_AVATAR_0_12_METADATA "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata"
+
+/* XEP-0084 v1.1 User Avatar */
+#define NS_AVATAR_1_1_DATA "urn:xmpp:avatar:data"
+#define NS_AVATAR_1_1_METADATA "urn:xmpp:avatar:metadata"
+
+/* XEP-0124 Bidirectional-streams Over Synchronous HTTP (BOSH) */
+#define NS_BOSH "http://jabber.org/protocol/httpbind"
+
+/* XEP-0191 Simple Communications Blocking */
+#define NS_SIMPLE_BLOCKING "urn:xmpp:blocking"
+
+/* XEP-0199 Ping */
+#define NS_PING "urn:xmpp:ping"
+
+/* XEP-0202 Entity Time */
+#define NS_ENTITY_TIME "urn:xmpp:time"
+
+/* XEP-0203 Delayed Delivery (and legacy delayed delivery) */
+#define NS_DELAYED_DELIVERY "urn:xmpp:delay"
+#define NS_DELAYED_DELIVERY_LEGACY "jabber:x:delay"
+
+/* XEP-0206 XMPP over BOSH */
+#define NS_XMPP_BOSH "urn:xmpp:xbosh"
+
+/* XEP-0224 Attention */
+#define NS_ATTENTION "urn:xmpp:attention:0"
+
+/* XEP-0231 BoB (Bits of Binary) */
+#define NS_BOB "urn:xmpp:bob"
+
+/* Google extensions */
+#define NS_GOOGLE_CAMERA "http://www.google.com/xmpp/protocol/camera/v1"
+#define NS_GOOGLE_VIDEO "http://www.google.com/xmpp/protocol/video/v1"
+#define NS_GOOGLE_VOICE "http://www.google.com/xmpp/protocol/voice/v1"
+#define NS_GOOGLE_JINGLE_INFO "google:jingleinfo"
+
+#define NS_GOOGLE_MAIL_NOTIFY "google:mail:notify"
+
+#define NS_GOOGLE_PROTOCOL_SESSION "http://www.google.com/xmpp/protocol/session"
+#define NS_GOOGLE_SESSION "http://www.google.com/session"
+#define NS_GOOGLE_SESSION_PHONE "http://www.google.com/session/phone"
+#define NS_GOOGLE_SESSION_VIDEO "http://www.google.com/session/video"
+
+#endif /* PURPLE_JABBER_NAMESPACES_H_ */
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/oob.c
--- a/libpurple/protocols/jabber/oob.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/oob.c Sun Nov 29 18:53:11 2009 +0000
@@ -170,11 +170,11 @@
if(!strcmp(code, "406")) {
z = xmlnode_new_child(y, "not-acceptable");
xmlnode_set_attrib(y, "type", "modify");
- xmlnode_set_namespace(z, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(z, NS_XMPP_STANZAS);
} else if(!strcmp(code, "404")) {
z = xmlnode_new_child(y, "not-found");
xmlnode_set_attrib(y, "type", "cancel");
- xmlnode_set_namespace(z, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(z, NS_XMPP_STANZAS);
}
jabber_iq_send(iq);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/parser.c
--- a/libpurple/protocols/jabber/parser.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/parser.c Sun Nov 29 18:53:11 2009 +0000
@@ -152,6 +152,15 @@
*/
return;
+ if (error->level == XML_ERR_FATAL && error->message != NULL
+ && strcmp(error->message, "Extra content at the end of the document\n") == 0)
+ /*
+ * This is probably more annoying than the vcard-temp error; it occurs
+ * because we disconnect in most cases without waiting for the receiving
+ * (limitations of libpurple)
+ */
+ return;
+
purple_debug_error("jabber", "XML parser error for JabberStream %p: "
"Domain %i, code %i, level %i: %s",
js,
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/ping.c
--- a/libpurple/protocols/jabber/ping.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/ping.c Sun Nov 29 18:53:11 2009 +0000
@@ -74,7 +74,7 @@
iq = jabber_iq_new(js, JABBER_IQ_GET);
ping = xmlnode_new_child(iq->node, "ping");
- xmlnode_set_namespace(ping, "urn:xmpp:ping");
+ xmlnode_set_namespace(ping, NS_PING);
jabber_iq_set_callback(iq, jabber_keepalive_pong_cb, NULL);
jabber_iq_send(iq);
@@ -90,7 +90,7 @@
xmlnode_set_attrib(iq->node, "to", jid);
ping = xmlnode_new_child(iq->node, "ping");
- xmlnode_set_namespace(ping, "urn:xmpp:ping");
+ xmlnode_set_namespace(ping, NS_PING);
jabber_iq_set_callback(iq, jabber_ping_result_cb, NULL);
jabber_iq_send(iq);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c Sun Nov 29 18:53:11 2009 +0000
@@ -297,7 +297,7 @@
gchar seconds[10];
g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle));
- xmlnode_set_namespace(query, "jabber:iq:last");
+ xmlnode_set_namespace(query, NS_LAST_ACTIVITY);
xmlnode_set_attrib(query, "seconds", seconds);
}
@@ -462,8 +462,8 @@
goto out;
if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) {
- JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
- xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", "http://jabber.org/protocol/disco#items");
+ JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS);
+ xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS);
xmlnode_set_attrib(iq->node, "to", userdata->from);
xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
@@ -633,7 +633,7 @@
} else if(xmlns == NULL) {
/* The rest of the cases used to check xmlns individually. */
continue;
- } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) {
+ } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) {
/* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */
delayed = TRUE;
stamp = xmlnode_get_attrib(y, "stamp");
@@ -642,7 +642,7 @@
} else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) {
nickname = xmlnode_get_data(y);
} else if(!strcmp(y->name, "x")) {
- if(!strcmp(xmlns, "jabber:x:delay")) {
+ if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) {
/* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */
delayed = TRUE;
stamp = xmlnode_get_attrib(y, "stamp");
@@ -655,7 +655,7 @@
}
}
} else if (!strcmp(y->name, "query") &&
- !strcmp(xmlnode_get_namespace(y), "jabber:iq:last")) {
+ !strcmp(xmlnode_get_namespace(y), NS_LAST_ACTIVITY)) {
/* resource has specified idle */
const gchar *seconds = xmlnode_get_attrib(y, "seconds");
if (seconds) {
@@ -957,7 +957,7 @@
buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
jid->node ? "@" : "", jid->domain);
if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) {
- if(!jid->node || strcmp(jid->node,js->user->node) || strcmp(jid->domain,js->user->domain)) {
+ if (jb != js->user_jb) {
purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n",
buddy_name, purple_account_get_username(js->gc->account), js->gc->account);
jabber_id_free(jid);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/si.c
--- a/libpurple/protocols/jabber/si.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/si.c Sun Nov 29 18:53:11 2009 +0000
@@ -144,7 +144,7 @@
if(xfer->type == PURPLE_XFER_SEND)
{
xmlnode *activate;
- iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, "http://jabber.org/protocol/bytestreams");
+ iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS);
xmlnode_set_attrib(iq->node, "to", streamhost->jid);
query = xmlnode_get_child(iq->node, "query");
xmlnode_set_attrib(query, "sid", jsx->stream_id);
@@ -155,7 +155,7 @@
}
else
{
- iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, "http://jabber.org/protocol/bytestreams");
+ iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS);
xmlnode_set_attrib(iq->node, "to", xfer->who);
jabber_iq_set_id(iq, jsx->iq_id);
query = xmlnode_get_child(iq->node, "query");
@@ -232,7 +232,7 @@
xmlnode_set_attrib(error, "code", "404");
xmlnode_set_attrib(error, "type", "cancel");
inf = xmlnode_new_child(error, "item-not-found");
- xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(inf, NS_XMPP_STANZAS);
jabber_iq_send(iq);
@@ -843,8 +843,7 @@
purple_xfer_unref(xfer);
- iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET,
- "http://jabber.org/protocol/bytestreams");
+ iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS);
xmlnode_set_attrib(iq->node, "to", xfer->who);
query = xmlnode_get_child(iq->node, "query");
@@ -1206,11 +1205,11 @@
if(var && !strcmp(var, "stream-method")) {
if((value = xmlnode_get_child(field, "value"))) {
char *val = xmlnode_get_data(value);
- if(val && !strcmp(val, "http://jabber.org/protocol/bytestreams")) {
+ if(val && !strcmp(val, NS_BYTESTREAMS)) {
jabber_si_xfer_bytestreams_send_init(xfer);
jsx->stream_method |= STREAM_METHOD_BYTESTREAMS;
found_method = TRUE;
- } else if (val && !strcmp(val, XEP_0047_NAMESPACE)) {
+ } else if (val && !strcmp(val, NS_IBB)) {
jsx->stream_method |= STREAM_METHOD_IBB;
if (!found_method) {
/* we haven't tried to init a bytestream session, yet
@@ -1268,10 +1267,10 @@
behind troublesome firewalls */
option = xmlnode_new_child(field, "option");
value = xmlnode_new_child(option, "value");
- xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1);
+ xmlnode_insert_data(value, NS_BYTESTREAMS, -1);
option = xmlnode_new_child(field, "option");
value = xmlnode_new_child(option, "value");
- xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1);
+ xmlnode_insert_data(value, NS_IBB, -1);
jabber_iq_set_callback(iq, jabber_si_xfer_send_method_cb, xfer);
@@ -1372,9 +1371,9 @@
error = xmlnode_new_child(iq->node, "error");
xmlnode_set_attrib(error, "type", "cancel");
child = xmlnode_new_child(error, "forbidden");
- xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(child, NS_XMPP_STANZAS);
child = xmlnode_new_child(error, "text");
- xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas");
+ xmlnode_set_namespace(child, NS_XMPP_STANZAS);
xmlnode_insert_data(child, "Offer Declined", -1);
jabber_iq_send(iq);
@@ -1452,7 +1451,7 @@
if (jbr) {
char *msg;
- if (jabber_resource_has_capability(jbr, XEP_0047_NAMESPACE))
+ if (jabber_resource_has_capability(jbr, NS_IBB))
jsx->stream_method |= STREAM_METHOD_IBB;
if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/si/profile/file-transfer")) {
jabber_si_xfer_send_request(xfer);
@@ -1580,10 +1579,10 @@
for people who know their firewalls are very restrictive */
if (jsx->stream_method & STREAM_METHOD_BYTESTREAMS) {
value = xmlnode_new_child(field, "value");
- xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1);
+ xmlnode_insert_data(value, NS_BYTESTREAMS, -1);
} else if(jsx->stream_method & STREAM_METHOD_IBB) {
value = xmlnode_new_child(field, "value");
- xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1);
+ xmlnode_insert_data(value, NS_IBB, -1);
}
jabber_iq_send(iq);
@@ -1687,9 +1686,9 @@
if((value = xmlnode_get_child(option, "value"))) {
char *val;
if((val = xmlnode_get_data(value))) {
- if(!strcmp(val, "http://jabber.org/protocol/bytestreams")) {
+ if(!strcmp(val, NS_BYTESTREAMS)) {
jsx->stream_method |= STREAM_METHOD_BYTESTREAMS;
- } else if(!strcmp(val, "http://jabber.org/protocol/ibb")) {
+ } else if(!strcmp(val, NS_IBB)) {
jsx->stream_method |= STREAM_METHOD_IBB;
}
g_free(val);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/jabber/useravatar.h
--- a/libpurple/protocols/jabber/useravatar.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/jabber/useravatar.h Sun Nov 29 18:53:11 2009 +0000
@@ -29,12 +29,6 @@
/* Implementation of XEP-0084 */
-#define NS_AVATAR_0_12_DATA "http://www.xmpp.org/extensions/xep-0084.html#ns-data"
-#define NS_AVATAR_0_12_METADATA "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata"
-
-#define NS_AVATAR_1_1_DATA "urn:xmpp:avatar:data"
-#define NS_AVATAR_1_1_METADATA "urn:xmpp:avatar:metadata"
-
void jabber_avatar_init(void);
void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img);
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/msn/contact.c
--- a/libpurple/protocols/msn/contact.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/msn/contact.c Sun Nov 29 18:53:11 2009 +0000
@@ -702,12 +702,15 @@
type = xmlnode_get_data(contactType);
/*setup the Display Name*/
- if (type && !strcmp(type, "Me")){
- char *friendly = NULL;
- if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
- friendly = xmlnode_get_data(displayName);
- purple_connection_set_display_name(session->account->gc, friendly ? purple_url_decode(friendly) : NULL);
- g_free(friendly);
+ if (type && !strcmp(type, "Me")) {
+ if (purple_connection_get_display_name(pc) == NULL) {
+ char *friendly = NULL;
+ if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
+ friendly = xmlnode_get_data(displayName);
+ purple_connection_set_display_name(pc,
+ friendly ? purple_url_decode(friendly) : NULL);
+ g_free(friendly);
+ }
continue; /* Not adding own account as buddy to buddylist */
}
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/msn/msn.c Sun Nov 29 18:53:11 2009 +0000
@@ -23,8 +23,6 @@
*/
#define PHOTO_SUPPORT 1
-#include
-
#include "msn.h"
#include "accountopt.h"
#include "contact.h"
@@ -1064,6 +1062,9 @@
if (strcmp(username, purple_account_get_username(account)))
purple_account_set_username(account, username);
+ username = purple_account_get_string(account, "display-name", NULL);
+ purple_connection_set_display_name(gc, username);
+
if (!msn_session_connect(session, host, port, http_method))
purple_connection_error_reason(gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/msn/notification.c
--- a/libpurple/protocols/msn/notification.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/msn/notification.c Sun Nov 29 18:53:11 2009 +0000
@@ -1408,6 +1408,7 @@
purple_connection_set_display_name(
purple_account_get_connection(session->account),
friendlyname);
+ purple_account_set_string(session->account, "display-name", friendlyname);
}
}
}
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/msn/object.c
--- a/libpurple/protocols/msn/object.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/msn/object.c Sun Nov 29 18:53:11 2009 +0000
@@ -21,6 +21,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+
+#include "msn.h"
#include "object.h"
#include "debug.h"
/* Sha1 stuff */
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/chunk.c
--- a/libpurple/protocols/mxit/chunk.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/chunk.c Sun Nov 29 18:53:11 2009 +0000
@@ -576,18 +576,17 @@
/* parse the resource chunks */
while ( chunklen > 0 ) {
- struct raw_chunk* chunkhdr = ( struct raw_chunk * ) &chunkdata[pos];
- chunkhdr->length = ntohl( chunkhdr->length ); /* host byte-order */
+ gchar* chunk = &chunkdata[pos];
/* start of chunk data */
- pos += sizeof( struct raw_chunk );
+ pos += MXIT_CHUNK_HEADER_SIZE;
- switch ( chunkhdr->type ) {
+ switch ( chunk_type( chunk ) ) {
case CP_CHUNK_SPLASH : /* splash image */
{
struct splash_chunk* splash = g_new0( struct splash_chunk, 1 );
- mxit_chunk_parse_splash( &chunkdata[pos], chunkhdr->length, splash );
+ mxit_chunk_parse_splash( &chunkdata[pos], chunk_length( chunk ), splash );
cr->resources = g_list_append( cr->resources, splash );
break;
@@ -600,12 +599,12 @@
break;
}
default:
- purple_debug_info( MXIT_PLUGIN_ID, "Unsupported custom resource chunk received (%i)\n", chunkhdr->type );
+ purple_debug_info( MXIT_PLUGIN_ID, "Unsupported custom resource chunk received (%i)\n", chunk_type( chunk) );
}
/* skip over data to next resource chunk */
- pos += chunkhdr->length;
- chunklen -= ( sizeof( struct raw_chunk ) + chunkhdr->length );
+ pos += chunk_length( chunk );
+ chunklen -= ( MXIT_CHUNK_HEADER_SIZE + chunk_length( chunk ) );
}
}
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/chunk.h
--- a/libpurple/protocols/mxit/chunk.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/chunk.h Sun Nov 29 18:53:11 2009 +0000
@@ -31,6 +31,8 @@
#define MXIT_CHUNK_FILEID_LEN 8 /* bytes */
+#define MXIT_CHUNK_HEADER_SIZE 5 /* type (1 byte) + length (4 bytes) */
+
/* Multimedia chunk types */
#define CP_CHUNK_NONE 0x00 /* (0) no chunk */
@@ -68,13 +70,35 @@
#define REJECT_BAD_RECIPIENT 4
/*
- * a Chunk header
+ * Chunk header manipulation functions
*/
-struct raw_chunk {
- guint8 type;
- guint32 length;
- gchar data[0];
-} __attribute__ ((packed));
+static inline guint chunk_type( gchar* chunkheader )
+{
+ return *chunkheader;
+}
+
+static inline void set_chunk_type( gchar* chunkheader, guint type )
+{
+ *chunkheader = type;
+}
+
+static inline guint32 chunk_length( gchar* chunkheader )
+{
+ guint32 length = *( (const guint32*) &chunkheader[1] );
+ return htonl( length );
+}
+
+static inline void set_chunk_length( gchar* chunkheader, guint32 size )
+{
+ size = htonl( size );
+ memcpy( &chunkheader[1], &size, sizeof( guint32 ) );
+}
+
+static inline gchar* chunk_data( gchar* chunkheader )
+{
+ return &chunkheader[MXIT_CHUNK_HEADER_SIZE];
+}
+
struct offerfile_chunk {
char fileid[MXIT_CHUNK_FILEID_LEN];
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/formcmds.c
--- a/libpurple/protocols/mxit/formcmds.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/formcmds.c Sun Nov 29 18:53:11 2009 +0000
@@ -239,12 +239,10 @@
replymsg = g_hash_table_lookup(hash, "replymsg"); /* find the reply message */
if ((selmsg) && (replymsg)) {
gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
- gchar* replytext = g_markup_escape_text(purple_url_decode(replymsg), -1);
- mxit_add_html_link( mx, replytext, seltext );
+ mxit_add_html_link( mx, purple_url_decode(replymsg), seltext );
g_free(seltext);
- g_free(replytext);
}
}
@@ -345,7 +343,6 @@
* @param message The message text
* @return The length of the command
*/
-//void mxit_command_received(struct MXitSession* session, const char* from, char* message, time_t timestamp)
int mxit_parse_command(struct RXMsgData* mx, char* message)
{
GHashTable* hash = NULL;
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/markup.c
--- a/libpurple/protocols/mxit/markup.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/markup.c Sun Nov 29 18:53:11 2009 +0000
@@ -416,7 +416,6 @@
}
else if ( mx->chatid < 0 ) {
/* normal chat message */
- //serv_got_im( mx->session->con, mx->from, mx->msg->str, mx->flags, mx->timestamp );
mxit_show_split_message( mx );
}
else {
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/mxit.c
--- a/libpurple/protocols/mxit/mxit.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/mxit.c Sun Nov 29 18:53:11 2009 +0000
@@ -689,9 +689,6 @@
option = purple_account_option_bool_new( _( "Enable splash-screen popup" ), MXIT_CONFIG_SPLASHPOPUP, FALSE );
proto_info.protocol_options = g_list_append( proto_info.protocol_options, option );
-
- if ( sizeof( struct raw_chunk ) != 5 )
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "sizeof(struct raw_chunk) != 5! MXit probably won't work!\n");
}
PURPLE_INIT_PLUGIN( mxit, init_plugin, plugin_info );
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/mxit.h
--- a/libpurple/protocols/mxit/mxit.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/mxit.h Sun Nov 29 18:53:11 2009 +0000
@@ -61,7 +61,7 @@
/* Plugin details */
#define MXIT_PLUGIN_ID "prpl-loubserp-mxit"
#define MXIT_PLUGIN_NAME "MXit"
-#define MXIT_PLUGIN_VERSION "2.2.0"
+#define MXIT_PLUGIN_VERSION "2.3.0"
#define MXIT_PLUGIN_EMAIL "Pieter Loubser "
#define MXIT_PLUGIN_WWW "http://www.mxit.com"
#define MXIT_PLUGIN_SUMMARY "MXit Protocol Plugin"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/protocol.c
--- a/libpurple/protocols/mxit/protocol.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/protocol.c Sun Nov 29 18:53:11 2009 +0000
@@ -1035,7 +1035,7 @@
{
char data[CP_MAX_PACKET];
int datalen = 0;
- struct raw_chunk* chunk;
+ gchar* chunk;
int size;
purple_debug_info( MXIT_PLUGIN_ID, "SENDING FILE '%s' of %i bytes to user '%s'\n", filename, buflen, username );
@@ -1044,17 +1044,17 @@
datalen = sprintf( data, "ms=" );
/* map chunk header over data buffer */
- chunk = (struct raw_chunk *) &data[datalen];
-
- size = mxit_chunk_create_senddirect( chunk->data, username, filename, buf, buflen );
+ chunk = &data[datalen];
+
+ size = mxit_chunk_create_senddirect( chunk_data( chunk ), username, filename, buf, buflen );
if ( size < 0 ) {
purple_debug_error( MXIT_PLUGIN_ID, "Error creating senddirect chunk (%i)\n", size );
return;
}
- chunk->type = CP_CHUNK_DIRECT_SND;
- chunk->length = htonl( size );
- datalen += sizeof( struct raw_chunk ) + size;
+ set_chunk_type( chunk, CP_CHUNK_DIRECT_SND );
+ set_chunk_length( chunk, size );
+ datalen += MXIT_CHUNK_HEADER_SIZE + size;
/* send the byte stream to the mxit server */
mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA );
@@ -1071,7 +1071,7 @@
{
char data[CP_MAX_PACKET];
int datalen = 0;
- struct raw_chunk* chunk;
+ gchar* chunk;
int size;
purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_reject\n" );
@@ -1080,17 +1080,17 @@
datalen = sprintf( data, "ms=" );
/* map chunk header over data buffer */
- chunk = (struct raw_chunk *) &data[datalen];
-
- size = mxit_chunk_create_reject( chunk->data, fileid );
+ chunk = &data[datalen];
+
+ size = mxit_chunk_create_reject( chunk_data( chunk ), fileid );
if ( size < 0 ) {
purple_debug_error( MXIT_PLUGIN_ID, "Error creating reject chunk (%i)\n", size );
return;
}
- chunk->type = CP_CHUNK_REJECT;
- chunk->length = htonl( size );
- datalen += sizeof( struct raw_chunk ) + size;
+ set_chunk_type( chunk, CP_CHUNK_REJECT );
+ set_chunk_length( chunk, size );
+ datalen += MXIT_CHUNK_HEADER_SIZE + size;
/* send the byte stream to the mxit server */
mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA );
@@ -1109,7 +1109,7 @@
{
char data[CP_MAX_PACKET];
int datalen = 0;
- struct raw_chunk* chunk;
+ gchar* chunk;
int size;
purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_accept\n" );
@@ -1118,17 +1118,17 @@
datalen = sprintf( data, "ms=" );
/* map chunk header over data buffer */
- chunk = (struct raw_chunk *) &data[datalen];
-
- size = mxit_chunk_create_get( chunk->data, fileid, filesize, offset );
+ chunk = &data[datalen];
+
+ size = mxit_chunk_create_get( chunk_data(chunk), fileid, filesize, offset );
if ( size < 0 ) {
purple_debug_error( MXIT_PLUGIN_ID, "Error creating getfile chunk (%i)\n", size );
return;
}
- chunk->type = CP_CHUNK_GET;
- chunk->length = htonl( size );
- datalen += sizeof( struct raw_chunk ) + size;
+ set_chunk_type( chunk, CP_CHUNK_GET );
+ set_chunk_length( chunk, size );
+ datalen += MXIT_CHUNK_HEADER_SIZE + size;
/* send the byte stream to the mxit server */
mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA );
@@ -1145,7 +1145,7 @@
{
char data[CP_MAX_PACKET];
int datalen = 0;
- struct raw_chunk* chunk;
+ gchar* chunk;
int size;
purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_received\n" );
@@ -1154,17 +1154,17 @@
datalen = sprintf( data, "ms=" );
/* map chunk header over data buffer */
- chunk = (struct raw_chunk *) &data[datalen];
-
- size = mxit_chunk_create_received( chunk->data, fileid, status );
+ chunk = &data[datalen];
+
+ size = mxit_chunk_create_received( chunk_data(chunk), fileid, status );
if ( size < 0 ) {
purple_debug_error( MXIT_PLUGIN_ID, "Error creating received chunk (%i)\n", size );
return;
}
- chunk->type = CP_CHUNK_RECIEVED;
- chunk->length = htonl( size );
- datalen += sizeof( struct raw_chunk ) + size;
+ set_chunk_type( chunk, CP_CHUNK_RECIEVED );
+ set_chunk_length( chunk, size );
+ datalen += MXIT_CHUNK_HEADER_SIZE + size;
/* send the byte stream to the mxit server */
mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA );
@@ -1182,7 +1182,7 @@
{
char data[CP_MAX_PACKET];
int datalen = 0;
- struct raw_chunk* chunk;
+ gchar* chunk;
int size;
purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_avatar: %i bytes\n", avatarlen );
@@ -1191,17 +1191,17 @@
datalen = sprintf( data, "ms=" );
/* map chunk header over data buffer */
- chunk = (struct raw_chunk *) &data[datalen];
-
- size = mxit_chunk_create_set_avatar( chunk->data, avatar, avatarlen );
+ chunk = &data[datalen];
+
+ size = mxit_chunk_create_set_avatar( chunk_data(chunk), avatar, avatarlen );
if ( size < 0 ) {
purple_debug_error( MXIT_PLUGIN_ID, "Error creating set avatar chunk (%i)\n", size );
return;
}
- chunk->type = CP_CHUNK_SET_AVATAR;
- chunk->length = htonl( size );
- datalen += sizeof( struct raw_chunk ) + size;
+ set_chunk_type( chunk, CP_CHUNK_SET_AVATAR );
+ set_chunk_length( chunk, size );
+ datalen += MXIT_CHUNK_HEADER_SIZE + size;
/* send the byte stream to the mxit server */
mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA );
@@ -1221,7 +1221,7 @@
{
char data[CP_MAX_PACKET];
int datalen = 0;
- struct raw_chunk* chunk;
+ gchar* chunk;
int size;
purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_avatar: %s\n", mxitId );
@@ -1230,17 +1230,17 @@
datalen = sprintf( data, "ms=" );
/* map chunk header over data buffer */
- chunk = (struct raw_chunk *) &data[datalen];
-
- size = mxit_chunk_create_get_avatar( chunk->data, mxitId, avatarId, MXIT_AVATAR_SIZE );
+ chunk = &data[datalen];
+
+ size = mxit_chunk_create_get_avatar( chunk_data(chunk), mxitId, avatarId, MXIT_AVATAR_SIZE );
if ( size < 0 ) {
purple_debug_error( MXIT_PLUGIN_ID, "Error creating get avatar chunk (%i)\n", size );
return;
}
- chunk->type = CP_CHUNK_GET_AVATAR;
- chunk->length = htonl( size );
- datalen += sizeof( struct raw_chunk ) + size;
+ set_chunk_type( chunk, CP_CHUNK_GET_AVATAR );
+ set_chunk_length( chunk, size );
+ datalen += MXIT_CHUNK_HEADER_SIZE + size;
/* send the byte stream to the mxit server */
mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA );
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/roster.c
--- a/libpurple/protocols/mxit/roster.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/roster.c Sun Nov 29 18:53:11 2009 +0000
@@ -53,11 +53,11 @@
const char* name;
} const mxit_statuses[] = {
/* primative, no, id, name */
- { PURPLE_STATUS_OFFLINE, MXIT_PRESENCE_OFFLINE, "offline", NULL }, /* 0 */
- { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_ONLINE, "online", NULL }, /* 1 */
- { PURPLE_STATUS_AWAY, MXIT_PRESENCE_AWAY, "away", NULL }, /* 2 */
- { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_AVAILABLE, "chat", N_( "Chatty" ) }, /* 3 */
- { PURPLE_STATUS_UNAVAILABLE, MXIT_PRESENCE_DND, "dnd", NULL } /* 4 */
+ { PURPLE_STATUS_OFFLINE, MXIT_PRESENCE_OFFLINE, "offline", N_( "Offline" ) }, /* 0 */
+ { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_ONLINE, "online", N_( "Available" ) }, /* 1 */
+ { PURPLE_STATUS_AWAY, MXIT_PRESENCE_AWAY, "away", N_( "Away" ) }, /* 2 */
+ { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_AVAILABLE, "chat", N_( "Chatty" ) }, /* 3 */
+ { PURPLE_STATUS_UNAVAILABLE, MXIT_PRESENCE_DND, "dnd", N_( "Do Not Disturb" ) } /* 4 */
};
@@ -398,7 +398,7 @@
contact->statusMsg = NULL;
}
if ( statusMsg[0] != '\0' )
- contact->statusMsg = g_strdup( statusMsg );
+ contact->statusMsg = g_markup_escape_text( statusMsg, -1 );
/* update avatarId */
if ( ( contact->avatarId ) && ( g_ascii_strcasecmp( contact->avatarId, avatarId ) == 0 ) ) {
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/mxit/splashscreen.c
--- a/libpurple/protocols/mxit/splashscreen.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/mxit/splashscreen.c Sun Nov 29 18:53:11 2009 +0000
@@ -43,10 +43,10 @@
{
const char* splashId = purple_account_get_string(session->acc, MXIT_CONFIG_SPLASHID, NULL);
- purple_debug_info(MXIT_PLUGIN_ID, "Current splashId: '%s'\n", splashId);
-
- if ((splashId != NULL) && (*splashId != '\0'))
+ if ((splashId != NULL) && (*splashId != '\0')) {
+ purple_debug_info(MXIT_PLUGIN_ID, "Current splashId: '%s'\n", splashId);
return splashId;
+ }
else
return NULL;
}
@@ -149,7 +149,7 @@
/* Get current splash ID */
splashId = splash_current(session);
- if (!splashId)
+ if (splashId == NULL) /* no splash-screen */
return;
/* if is clickable, then send click event */
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/myspace/myspace.h
--- a/libpurple/protocols/myspace/myspace.h Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/myspace/myspace.h Sun Nov 29 18:53:11 2009 +0000
@@ -20,6 +20,8 @@
#ifndef _MYSPACE_MYSPACE_H
#define _MYSPACE_MYSPACE_H
+#include "internal.h"
+
/* Other includes */
#include
#include /* for EAGAIN */
@@ -36,8 +38,6 @@
#include
#endif
-#include "internal.h"
-
#include "notify.h"
#include "plugin.h"
#include "accountopt.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/novell/nmuser.c
--- a/libpurple/protocols/novell/nmuser.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/novell/nmuser.c Sun Nov 29 18:53:11 2009 +0000
@@ -18,9 +18,8 @@
*
*/
-#include
+#include "internal.h"
#include
-#include "internal.h"
#include "nmfield.h"
#include "nmuser.h"
#include "nmconn.h"
diff -r 0b5520bf1fe3 -r cb8b53a6f238 libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c Mon Nov 23 21:32:39 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.c Sun Nov 29 18:53:11 2009 +0000
@@ -2461,42 +2461,81 @@
*/
if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
{
+ int len;
+ char *tmp2, *body;
const char *ichattextcolor, *ichatballooncolor;
- const char *start2, *end2;
+ const char *slash_body_start, *slash_body_end = NULL; /*
but not !\n");
+ /* Take everything after */
+ body = g_strdup(start);
+ }
ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor");
if (ichattextcolor != NULL)
{
- gchar *tmp2;
- tmp2 = g_strdup_printf("%s", ichattextcolor, tmp);
- g_free(tmp);
- tmp = tmp2;
+ tmp2 = g_strdup_printf("%s", ichattextcolor, body);
+ g_free(body);
+ body = tmp2;
}
ichatballooncolor = g_datalist_get_data(&attribs, "ichatballooncolor");
if (ichatballooncolor != NULL)
{
- gchar *tmp2;
- tmp2 = g_strdup_printf("%s", ichatballooncolor, tmp);
- g_free(tmp);
- tmp = tmp2;
+ tmp2 = g_strdup_printf("%s", ichatballooncolor, body);
+ g_free(body);
+ body = tmp2;
}
g_datalist_clear(&attribs);
+
+ len = start - tmp;
+ tmp2 = g_strdup_printf("%.*s%s%s", len, tmp, body, slash_body_end ? slash_body_end + 1: "");
+ g_free(tmp);
+ g_free(body);
+
+ tmp = tmp2;
+ }
+
+ /*
+ * Are there