adium-1.4 3400:f5bd2f3b50a5: A little cleanup and adding #pragma...
commits at adium.im
commits at adium.im
Wed Mar 9 15:07:13 UTC 2011
details: http://hg.adium.im/adium-1.4/rev/f5bd2f3b50a5
revision: 3400:f5bd2f3b50a5
branch: facebook-xmpp
author: Evan Schoenberg
date: Wed Mar 09 08:53:26 2011 -0600
A little cleanup and adding #pragma marks
Subject: adium-1.4 3401:840423f53d49: The facebook JID is not useful to 99.9% of our users. We could include the Facebook User ID in the Get Info window's info. Treat the person's name as their formatted UID so that we don't show the JID. Fixes #15040
details: http://hg.adium.im/adium-1.4/rev/840423f53d49
revision: 3401:840423f53d49
branch: facebook-xmpp
author: Evan Schoenberg
date: Wed Mar 09 08:59:35 2011 -0600
The facebook JID is not useful to 99.9% of our users. We could include the Facebook User ID in the Get Info window's info. Treat the person's name as their formatted UID so that we don't show the JID. Fixes #15040
Subject: adium-1.4 3402:d35bd7b6949f: Include the Facebook ID in the get info window. Refs #15040
details: http://hg.adium.im/adium-1.4/rev/d35bd7b6949f
revision: 3402:d35bd7b6949f
branch: facebook-xmpp
author: Evan Schoenberg
date: Wed Mar 09 09:06:41 2011 -0600
Include the Facebook ID in the get info window. Refs #15040
diffs (108 lines):
diff -r 92acd521a497 -r d35bd7b6949f Plugins/Purple Service/AIFacebookXMPPAccount.m
--- a/Plugins/Purple Service/AIFacebookXMPPAccount.m Wed Mar 09 00:07:47 2011 -0600
+++ b/Plugins/Purple Service/AIFacebookXMPPAccount.m Wed Mar 09 09:06:41 2011 -0600
@@ -9,6 +9,7 @@
#import "AIFacebookXMPPAccount.h"
#import <Adium/AIStatus.h>
#import <Adium/AIStatusControllerProtocol.h>
+#import <Adium/AIListContact.h>
#import "adiumPurpleCore.h"
#import <libpurple/jabber.h>
#import "ESPurpleJabberAccount.h"
@@ -17,23 +18,13 @@
@implementation AIFacebookXMPPAccount
-- (void)connect
-{
- AILog(@"trying to connect");
- [super connect];
-}
+#pragma mark Connectivitiy
- (const char*)protocolPlugin
{
return "prpl-jabber";
}
-- (void)didConnect
-{
- [super didConnect];
- NSLog(@"connected");
-}
-
- (NSString *)serverSuffix
{
return @"@chat.facebook.com";
@@ -73,6 +64,13 @@
return [completeUserName UTF8String];
}
+- (BOOL)encrypted
+{
+ return NO;
+}
+
+#pragma mark Status
+
- (const char *)purpleStatusIDForStatus:(AIStatus *)statusState
arguments:(NSMutableDictionary *)arguments
{
@@ -128,12 +126,7 @@
return statusID;
}
-- (BOOL)encrypted
-{
- return NO;
-}
-
-#pragma mark -
+#pragma mark Account configuration
- (void)setName:(NSString *)name UID:(NSString *)inUID
{
@@ -142,4 +135,43 @@
[self setFormattedUID:name notify:NotifyNever];
}
+#pragma mark Contacts
+
+/*!
+ * @brief Set an alias for a contact
+ *
+ * Normally, we consider the name a 'serverside alias' unless it matches the UID's characters
+ * However, the UID in facebook should never be presented to the user if possible; it's for internal use
+ * only. We'll therefore consider any alias a formatted UID such that it will replace the UID when displayed
+ * in Adium.
+ */
+- (void)updateContact:(AIListContact *)theContact toAlias:(NSString *)purpleAlias
+{
+ if (![purpleAlias isEqualToString:theContact.formattedUID] &&
+ ![purpleAlias isEqualToString:theContact.UID]) {
+ [theContact setFormattedUID:purpleAlias
+ notify:NotifyLater];
+
+ //Apply any changes
+ [theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
+ }
+}
+
+- (NSMutableArray *)arrayOfDictionariesFromPurpleNotifyUserInfo:(PurpleNotifyUserInfo *)user_info forContact:(AIListContact *)contact
+{
+ NSMutableArray *array = [super arrayOfDictionariesFromPurpleNotifyUserInfo:user_info forContact:contact];
+
+ NSString *displayUID = contact.UID;
+ displayUID = [displayUID stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"-"]];
+ if ([displayUID hasSuffix:@"@chat.facebook.com"])
+ displayUID = [displayUID substringToIndex:displayUID.length - @"@chat.facebook.com".length];
+
+ [array addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ AILocalizedString(@"Facebook ID", nil), KEY_KEY,
+ displayUID, KEY_VALUE,
+ nil]];
+
+ return array;
+}
+
@end
More information about the commits
mailing list