propagate from branch 'im.pidgin.pidgin' (head 614a3ef8e92c4e93d2a0b58a00d72465aa951963) cpw.darkrain42.xmpp.scram

Thu, 03 Dec 2009 05:39:00 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Thu, 03 Dec 2009 05:39:00 +0000
branch
cpw.darkrain42.xmpp.scram
changeset 29085
b2ddb2f7bfb9
parent 29072
614a3ef8e92c (diff)
parent 29084
3a821d391ac0 (current diff)
child 29086
4733547c4fdd

propagate from branch 'im.pidgin.pidgin' (head 614a3ef8e92c4e93d2a0b58a00d72465aa951963)
to branch 'im.pidgin.cpw.darkrain42.xmpp.scram' (head 3a821d391ac0e016d1283ecf0e0a197479a503a5)

configure.ac file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/jabber.c file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/jutil.c file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/jutil.h file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/parser.c file | annotate | diff | comparison | revisions
--- a/ChangeLog	Tue Dec 01 07:32:53 2009 +0000
+++ b/ChangeLog	Thu Dec 03 05:39:00 2009 +0000
@@ -1,15 +1,20 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 2.6.5 (??/??/20??):
+	General:
+	* Build-time fixes for Solaris.  (Paul Townsend)
+
+	XMPP:
+	* When getting info on a domain-only (server) JID, show uptime
+	  (when given by the result of the "last query") and don't show status as
+	  offline.
+	* Do not crash when attempting to register for a new account on Windows.
 
 version 2.6.4 (11/29/2009):
 	libpurple:
 	* Actually emit the hold signal for media calls.
 	* Fix building the GnuTLS plugin with older versions of GnuTLS.
 	* Fix DNS TXT query resolution.
-	* 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.)
 
--- a/configure.ac	Tue Dec 01 07:32:53 2009 +0000
+++ b/configure.ac	Thu Dec 03 05:39:00 2009 +0000
@@ -1470,7 +1470,7 @@
 		AC_CHECK_LIB(pthread, pthread_create, )
 		AC_CHECK_LIB(util, openpty, )
 		AC_CHECK_LIB(db, dbopen, )
-		PY_LIBS="-lpython$PY_VERSION -L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
+		PY_LIBS="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config -lpython$PY_VERSION"
 		PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
 		AC_DEFINE(USE_PYTHON, [1], [Define if python headers are available.])
 		AC_MSG_RESULT(ok)
--- a/libpurple/protocols/jabber/buddy.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Thu Dec 03 05:39:00 2009 +0000
@@ -815,19 +815,29 @@
 
 	if (!jbi->jb->resources) {
 		/* the buddy is offline */
+		gboolean is_domain = jabber_jid_is_domain(jbi->jid);
 		gchar *status =
 			g_strdup_printf("%s%s%s",	_("Offline"),
 			                jbi->last_message ? ": " : "",
 			                jbi->last_message ? jbi->last_message : "");
 		if (jbi->last_seconds > 0) {
 			char *last = purple_str_seconds_to_string(jbi->last_seconds);
-			gchar *message = g_strdup_printf(_("%s ago"), last);
-			purple_notify_user_info_prepend_pair(user_info,
-				_("Logged Off"), message);
+			gchar *message = NULL;
+			const gchar *title = NULL;
+			if (is_domain) {
+				title = _("Uptime");
+				message = g_strdup_printf(_("%s"), last);
+			} else {
+				title = _("Logged Off");
+				message = g_strdup_printf(_("%s ago"), last);
+			}
+			purple_notify_user_info_prepend_pair(user_info, title, message);
 			g_free(last);
 			g_free(message);
 		}
-		purple_notify_user_info_prepend_pair(user_info, _("Status"), status);
+
+		if (!is_domain)
+			purple_notify_user_info_prepend_pair(user_info, _("Status"), status);
 		g_free(status);
 	}
 
@@ -1860,8 +1870,10 @@
 	 * However, since the gateway might appear offline to us, we cannot get that information. Therefore, I just assume
 	 * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since
 	 * people don't tend to have a server or other service there.
+	 *
+	 * TODO: Use disco#info...
 	 */
-	if (g_utf8_strchr(name, -1, '@') == NULL) {
+	if (strchr(name, '@') == NULL) {
 		act = purple_menu_action_new(_("Log In"),
 									 PURPLE_CALLBACK(jabber_buddy_login),
 									 NULL, NULL);
--- a/libpurple/protocols/jabber/chat.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/chat.c	Thu Dec 03 05:39:00 2009 +0000
@@ -927,7 +927,7 @@
 	jcm = g_hash_table_lookup(chat->members, who);
 	if (jcm && jcm->jid)
 		jid = jcm->jid;
-	else if (g_utf8_strchr(who, -1, '@') != NULL)
+	else if (strchr(who, '@') != NULL)
 		jid = who;
 	else
 		return FALSE;
@@ -964,7 +964,7 @@
 	jcm = g_hash_table_lookup(chat->members, who);
 	if (jcm && jcm->jid)
 		jid = jcm->jid;
-	else if (g_utf8_strchr(who, -1, '@') != NULL)
+	else if (strchr(who, '@') != NULL)
 		jid = who;
 	else
 		return FALSE;
--- a/libpurple/protocols/jabber/jabber.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Thu Dec 03 05:39:00 2009 +0000
@@ -1116,7 +1116,8 @@
 
 	if(cbdata->js->registration) {
 		username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain,
-			cbdata->js->user->resource ? "/" : "", cbdata->js->user->resource);
+			cbdata->js->user->resource ? "/" : "",
+			cbdata->js->user->resource ? cbdata->js->user->resource : "");
 		purple_account_set_username(cbdata->js->gc->account, username);
 		g_free(username);
 	}
--- a/libpurple/protocols/jabber/jingle/session.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/session.c	Thu Dec 03 05:39:00 2009 +0000
@@ -377,7 +377,7 @@
 {
 	JingleSession *session = (JingleSession *)value;
 	const gchar *jid = user_data;
-	gboolean use_bare = g_utf8_strchr(jid, -1, '/') == NULL;
+	gboolean use_bare = strchr(jid, '/') == NULL;
 	gchar *remote_jid = jingle_session_get_remote_jid(session);
 	gchar *cmp_jid = use_bare ? jabber_get_bare_jid(remote_jid)
 				  : g_strdup(remote_jid);
@@ -438,7 +438,7 @@
 
 	data.jid = jid;
 	data.ret = NULL;
-	data.use_bare = g_utf8_strchr(jid, -1, '/') == NULL;
+	data.use_bare = strchr(jid, '/') == NULL;
 
 	g_hash_table_foreach(js->sessions, find_by_jid_ghr, &data);
 	return data.ret;
--- a/libpurple/protocols/jabber/jutil.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.c	Thu Dec 03 05:39:00 2009 +0000
@@ -509,6 +509,19 @@
 	}
 }
 
+char *jabber_get_domain(const char *in)
+{
+	JabberID *jid = jabber_id_new(in);
+	char *out;
+
+	if (!jid)
+		return NULL;
+
+	out = g_strdup(jid->domain);
+	jabber_id_free(jid);
+
+	return out;
+}
 
 char *jabber_get_resource(const char *in)
 {
@@ -549,6 +562,17 @@
 	                   NULL);
 }
 
+gboolean
+jabber_jid_is_domain(const char *jid)
+{
+	char *domain = jabber_get_domain(jid);
+	gboolean is_domain = purple_strequal(jid, domain);
+
+	g_free(domain);
+	return is_domain;
+}
+
+
 JabberID *
 jabber_id_new(const char *str)
 {
--- a/libpurple/protocols/jabber/jutil.h	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.h	Thu Dec 03 05:39:00 2009 +0000
@@ -35,10 +35,13 @@
 JabberID* jabber_id_new(const char *str);
 void jabber_id_free(JabberID *jid);
 
+char *jabber_get_domain(const char *jid);
 char *jabber_get_resource(const char *jid);
 char *jabber_get_bare_jid(const char *jid);
 char *jabber_id_get_bare_jid(const JabberID *jid);
 
+gboolean jabber_jid_is_domain(const char *jid);
+
 const char *jabber_normalize(const PurpleAccount *account, const char *in);
 
 /* Returns true if JID is the bare JID of our server. */
--- a/libpurple/protocols/jabber/parser.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/parser.c	Thu Dec 03 05:39:00 2009 +0000
@@ -47,9 +47,7 @@
 		js->protocol_version = JABBER_PROTO_0_9;
 		for(i=0; i < nb_attributes * 5; i += 5) {
 			int attrib_len = attributes[i+4] - attributes[i+3];
-			char *attrib = g_malloc(attrib_len + 1);
-			memcpy(attrib, attributes[i+3], attrib_len);
-			attrib[attrib_len] = '\0';
+			char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len);
 
 			if(!xmlStrcmp(attributes[i], (xmlChar*) "version")
 					&& !strcmp(attrib, "1.0")) {
@@ -88,10 +86,7 @@
 			const char *attrib_ns = (const char *)attributes[i+2];
 			char *txt;
 			int attrib_len = attributes[i+4] - attributes[i+3];
-			char *attrib = g_malloc(attrib_len + 1);
-
-			memcpy(attrib, attributes[i+3], attrib_len);
-			attrib[attrib_len] = '\0';
+			char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len);
 
 			txt = attrib;
 			attrib = purple_unescape_html(txt);
@@ -152,8 +147,7 @@
 		 */
 		return;
 
-	if (error->level == XML_ERR_FATAL && error->message != NULL
-			&& g_str_equal(error->message, "Extra content at the end of the document\n"))
+	if (error->level == XML_ERR_FATAL && error->code == XML_ERR_DOCUMENT_END)
 		/*
 		 * This is probably more annoying than the vcard-temp error; it occurs
 		 * because we disconnect in most cases without waiting for the receiving
--- a/libpurple/protocols/jabber/presence.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Thu Dec 03 05:39:00 2009 +0000
@@ -433,7 +433,7 @@
                                  JabberPresenceCapabilities *userdata)
 {
 	JabberBuddyResource *jbr;
-	char *resource = g_utf8_strchr(userdata->from, -1, '/');
+	char *resource = strchr(userdata->from, '/');
 
 	if (resource)
 		resource += 1;
--- a/libpurple/protocols/oscar/clientlogin.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/protocols/oscar/clientlogin.c	Thu Dec 03 05:39:00 2009 +0000
@@ -275,13 +275,20 @@
 	char *query_string, *signature, *url;
 	gboolean use_tls = purple_account_get_bool(purple_connection_get_account(od->gc), "use_ssl", OSCAR_DEFAULT_USE_SSL);
 
-	/* Construct the GET parameters */
+	/*
+	 * Construct the GET parameters.  0x00000611 is the distid given to
+	 * us by AOL for use as the default libpurple distid.
+	 */
 	query_string = g_strdup_printf("a=%s"
+			"&distId=%d"
 			"&f=xml"
 			"&k=%s"
 			"&ts=%" PURPLE_TIME_T_MODIFIER
 			"&useTLS=%d",
-			purple_url_encode(token), get_client_key(od), hosttime, use_tls);
+			purple_url_encode(token),
+			oscar_get_ui_info_int(od->icq ? "prpl-icq-distid"
+					: "prpl-aim-distid", 0x00000611),
+			get_client_key(od), hosttime, use_tls);
 	signature = generate_signature("GET", URL_START_OSCAR_SESSION,
 			query_string, session_key);
 	url = g_strdup_printf(URL_START_OSCAR_SESSION "?%s&sig_sha256=%s",
--- a/libpurple/proxy.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/proxy.c	Thu Dec 03 05:39:00 2009 +0000
@@ -1088,7 +1088,6 @@
 static void
 http_start_connect_tunneling(PurpleProxyConnectData *connect_data) {
 	GString *request;
-	int ret;
 
 	purple_debug_info("proxy", "Using CONNECT tunneling for %s:%d\n",
 		connect_data->host, connect_data->port);
--- a/libpurple/xmlnode.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/libpurple/xmlnode.c	Thu Dec 03 05:39:00 2009 +0000
@@ -588,9 +588,7 @@
 			const char *prefix = (const char *)attributes[i+1];
 			char *txt;
 			int attrib_len = attributes[i+4] - attributes[i+3];
-			char *attrib = g_malloc(attrib_len + 1);
-			memcpy(attrib, attributes[i+3], attrib_len);
-			attrib[attrib_len] = '\0';
+			char *attrib = g_strndup((const char *)attributes[i+3], attrib_len);
 			txt = attrib;
 			attrib = purple_unescape_html(txt);
 			g_free(txt);
--- a/pidgin/plugins/disco/gtkdisco.c	Tue Dec 01 07:32:53 2009 +0000
+++ b/pidgin/plugins/disco/gtkdisco.c	Thu Dec 03 05:39:00 2009 +0000
@@ -225,8 +225,8 @@
 		gtk_widget_set_sensitive(dialog->account_widget, FALSE);
 
 	username = purple_account_get_username(dialog->account);
-	at = g_utf8_strchr(username, -1, '@');
-	slash = g_utf8_strchr(username, -1, '/');
+	at = strchr(username, '@');
+	slash = strchr(username, '/');
 	if (at && !slash) {
 		server = g_strdup_printf("%s", at + 1);
 	} else if (at && slash && at + 1 < slash) {

mercurial