[Adium-commits] adium 2070:a511a056b91b: Mostly from libpurple, display "Not Aut...

adium-commits at adiumx.com adium-commits at adiumx.com
Sat May 2 20:25:41 UTC 2009


details:	http://hg.adiumx.com/adium/rev/a511a056b91b
revision:	2070:a511a056b91b
author:		Zachary West <zacw at adiumx.com>
date:		Sat May 02 16:25:36 2009 -0400

Mostly from libpurple, display "Not Authorized" as the status message of Jabber contacts when appropriate.

diffstat:

 ChangeLogs/Changes.txt                         |   1 +
 Plugins/Purple Service/ESPurpleJabberAccount.m |  32 ++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diffs (53 lines):

diff -r 1346acdb9a2b -r a511a056b91b ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt	Sat May 02 16:16:26 2009 -0400
+++ b/ChangeLogs/Changes.txt	Sat May 02 16:25:36 2009 -0400
@@ -119,6 +119,7 @@
  * Fixed receiving colors and fonts from iChat. (#1323)
  * Enabled support for custom emoticons as an account option defaulting to on.
  * Fixed joining a group chat from an xmpp URL. (#11785)
+ * "Not Authorized" is now displayed for contacts for whom you need to request authoriation.
 
 MSN
  * Possibly fixed a crash on connect. (#11508)
diff -r 1346acdb9a2b -r a511a056b91b Plugins/Purple Service/ESPurpleJabberAccount.m
--- a/Plugins/Purple Service/ESPurpleJabberAccount.m	Sat May 02 16:16:26 2009 -0400
+++ b/Plugins/Purple Service/ESPurpleJabberAccount.m	Sat May 02 16:25:36 2009 -0400
@@ -476,6 +476,38 @@
 }
 
 #pragma mark Status Messages
+- (NSAttributedString *)statusMessageForPurpleBuddy:(PurpleBuddy *)b
+{
+	NSAttributedString *statusMessage = nil;
+	
+	JabberBuddy *jb = NULL;
+	PurpleConnection *gc = purple_account_get_connection(account);
+	const char *msg = NULL;
+	
+	if (gc && gc->proto_data) {
+		jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE);
+	
+		if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
+			msg = _("Not Authorized");
+		} else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) {
+			msg = jb->error_msg;
+		}
+	}
+	
+	if (msg) {
+		NSString *statusMessageString = [NSString stringWithUTF8String:msg];
+		
+		if (statusMessageString.length) {
+			statusMessage = [NSAttributedString stringWithString:statusMessageString];
+		}
+		
+	} else {
+		statusMessage = [super statusMessageForPurpleBuddy:b];
+	}
+	
+	return statusMessage;
+}
+
 - (NSString *)statusNameForPurpleBuddy:(PurpleBuddy *)buddy
 {
 	NSString		*statusName = nil;




More information about the commits mailing list