# HG changeset patch
# User Paul Aurich
# Date 1259549043 0
# Node ID eb4081c68c573cec802c81331721f01347529059
# Parent cea22db36ffc701210b815fd22043ee9b886458c# Parent f043c5a07042e6876686ac5ba6d40f8743fcd0ce
propagate from branch 'im.pidgin.pidgin' (head bd56a115b35ba5922e5f9c93840d0868a4978b09)
to branch 'im.pidgin.cpw.darkrain42.xmpp.scram' (head 3e55931996c480c5fbf5df7ebd49bfd35ee5f8ee)
diff -r cea22db36ffc -r eb4081c68c57 ChangeLog
--- a/ChangeLog Fri Nov 27 20:41:22 2009 +0000
+++ b/ChangeLog Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/dbus-server.c
--- a/libpurple/dbus-server.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/dbus-server.c Mon Nov 30 02:44:03 2009 +0000
@@ -25,16 +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"
diff -r cea22db36ffc -r eb4081c68c57 libpurple/ft.c
--- a/libpurple/ft.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/ft.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/jabber/bosh.c
--- a/libpurple/protocols/jabber/bosh.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/jabber/bosh.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/jabber/iq.c
--- a/libpurple/protocols/jabber/iq.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/jabber/iq.c Mon Nov 30 02:44:03 2009 +0000
@@ -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);
diff -r cea22db36ffc -r eb4081c68c57 libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/jabber/message.c Mon Nov 30 02:44:03 2009 +0000
@@ -742,13 +742,13 @@
jm->eventitems = g_list_append(jm->eventitems, items);
} 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)
diff -r cea22db36ffc -r eb4081c68c57 libpurple/protocols/jabber/namespaces.h
--- a/libpurple/protocols/jabber/namespaces.h Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/jabber/namespaces.h Mon Nov 30 02:44:03 2009 +0000
@@ -60,6 +60,9 @@
#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"
@@ -69,6 +72,13 @@
/* 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"
diff -r cea22db36ffc -r eb4081c68c57 libpurple/protocols/jabber/parser.c
--- a/libpurple/protocols/jabber/parser.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/jabber/parser.c Mon Nov 30 02:44:03 2009 +0000
@@ -145,13 +145,22 @@
JabberStream *js = user_data;
if (error->level == XML_ERR_WARNING && error->message != NULL
- && strcmp(error->message, "xmlns: URI vcard-temp is not absolute\n") == 0)
+ && g_str_equal(error->message, "xmlns: URI vcard-temp is not absolute\n"))
/*
* This message happens when parsing vcards, and is normal, so don't
* bother logging it because people scare easily.
*/
return;
+ if (error->level == XML_ERR_FATAL && error->message != NULL
+ && g_str_equal(error->message, "Extra content at the end of the document\n"))
+ /*
+ * 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c Mon Nov 30 02:44:03 2009 +0000
@@ -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");
@@ -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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/msn/contact.c
--- a/libpurple/protocols/msn/contact.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/msn/contact.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/msn/msn.c Mon Nov 30 02:44:03 2009 +0000
@@ -1062,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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/msn/notification.c
--- a/libpurple/protocols/msn/notification.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/msn/notification.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/chunk.c
--- a/libpurple/protocols/mxit/chunk.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/chunk.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/chunk.h
--- a/libpurple/protocols/mxit/chunk.h Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/chunk.h Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/formcmds.c
--- a/libpurple/protocols/mxit/formcmds.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/formcmds.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/markup.c
--- a/libpurple/protocols/mxit/markup.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/markup.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/mxit.c
--- a/libpurple/protocols/mxit/mxit.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/mxit.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/mxit.h
--- a/libpurple/protocols/mxit/mxit.h Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/mxit.h Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/protocol.c
--- a/libpurple/protocols/mxit/protocol.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/protocol.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/roster.c
--- a/libpurple/protocols/mxit/roster.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/roster.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/mxit/splashscreen.c
--- a/libpurple/protocols/mxit/splashscreen.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/mxit/splashscreen.c Mon Nov 30 02:44:03 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 cea22db36ffc -r eb4081c68c57 libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c Fri Nov 27 20:41:22 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.c Mon Nov 30 02:44:03 2009 +0000
@@ -896,10 +896,14 @@
(userinfo && (userinfo->flags & AIM_FLAG_AWAY)));
if (strip_html_tags) {
- /* Away messges are HTML, but available messages were originally plain text.
+ /* Away messages are HTML, but available messages were originally plain text.
* We therefore need to strip away messages but not available messages if we're asked to remove HTML tags.
*/
- if (is_away && message) {
+ /*
+ * It seems like the above comment no longer applies. All messages need
+ * to be escaped.
+ */
+ if (message) {
gchar *tmp2;
tmp = purple_markup_strip_html(message);
g_free(message);
@@ -918,7 +922,7 @@
}
g_free(itmsurl);
- if (is_away && message) {
+ if (message) {
tmp = purple_str_sub_away_formatters(message, purple_account_get_username(account));
g_free(message);
message = tmp;
@@ -2461,42 +2465,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