changeset 26943:516c4a8b7658

merge of '074c5aedf9bbc512331f0d3130f076190b290676' and '97fbf033d9afea69a6eabaac94698b3c051584cf'
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sun, 24 May 2009 03:55:27 +0000
parents 3fd5f2bccd68 (current diff) 7957a5ed53bb (diff)
children 5cc86a255aba
files
diffstat 3 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jutil.c	Sat May 23 10:44:39 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.c	Sun May 24 03:55:27 2009 +0000
@@ -223,6 +223,50 @@
 	return buf;
 }
 
+gboolean
+jabber_is_own_server(JabberStream *js, const char *str)
+{
+	JabberID *jid;
+	gboolean equal;
+
+	if (str == NULL)
+		return FALSE;
+
+	g_return_val_if_fail(*str != '\0', FALSE);
+
+	jid = jabber_id_new(str);
+	if (!jid)
+		return FALSE;
+
+	equal = (jid->node == NULL &&
+	         g_str_equal(jid->domain, js->user->domain) &&
+	         jid->resource == NULL);
+	jabber_id_free(jid);
+	return equal;
+}
+
+gboolean
+jabber_is_own_account(JabberStream *js, const char *str)
+{
+	JabberID *jid;
+	gboolean equal;
+
+	if (str == NULL)
+		return TRUE;
+
+	g_return_val_if_fail(*str != '\0', FALSE);
+
+	jid = jabber_id_new(str);
+	if (!jid)
+		return FALSE;
+
+	equal = (g_str_equal(jid->node, js->user->node) &&
+	         g_str_equal(jid->domain, js->user->domain) &&
+	         jid->resource == NULL);
+	jabber_id_free(jid);
+	return equal;
+}
+
 PurpleConversation *
 jabber_find_unnormalized_conv(const char *name, PurpleAccount *account)
 {
--- a/libpurple/protocols/jabber/jutil.h	Sat May 23 10:44:39 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.h	Sun May 24 03:55:27 2009 +0000
@@ -36,6 +36,12 @@
 
 const char *jabber_normalize(const PurpleAccount *account, const char *in);
 
+/* Returns true if JID is the bare JID of our server. */
+gboolean jabber_is_own_server(JabberStream *js, const char *jid);
+
+/* Returns true if JID is the bare JID of our account. */
+gboolean jabber_is_own_account(JabberStream *js, const char *jid);
+
 gboolean jabber_nodeprep_validate(const char *);
 gboolean jabber_nameprep_validate(const char *);
 gboolean jabber_resourceprep_validate(const char *);
--- a/libpurple/protocols/oscar/oscar.c	Sat May 23 10:44:39 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Sun May 24 03:55:27 2009 +0000
@@ -3566,7 +3566,8 @@
 	alerturl  = va_arg(ap, char *);
 	va_end(ap);
 
-	if (account != NULL && emailinfo != NULL && emailinfo->unread && havenewmail) {
+	if (account != NULL && emailinfo != NULL && purple_account_get_check_mail(account) &&
+			emailinfo->unread && havenewmail) {
 		gchar *to = g_strdup_printf("%s%s%s",
 				purple_account_get_username(account),
 				emailinfo->domain ? "@" : "",