# HG changeset patch # User William Bowling # Date 1284469974 -36000 # Node ID 6f80a3305e99e0579048b6f1f6e6c525fc5b858c # Parent 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f Refs #13748, #13054 Initial Facebook XMPP service for testing diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Adium.xcodeproj/project.pbxproj --- a/Adium.xcodeproj/project.pbxproj Sun Sep 12 12:35:22 2010 +1000 +++ b/Adium.xcodeproj/project.pbxproj Tue Sep 14 23:12:54 2010 +1000 @@ -1528,6 +1528,13 @@ 9ECB03E909F2A9D900996F44 /* AIXMLAppender.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ECB03E509F2A9D800996F44 /* AIXMLAppender.m */; }; 9EF0DBFA09D944C200FBCC1E /* Resources/block.png in Resources */ = {isa = PBXBuildFile; fileRef = 9EF0DBF309D944A300FBCC1E /* Resources/block.png */; }; 9EF0DBFB09D944C200FBCC1E /* Resources/unblock.png in Resources */ = {isa = PBXBuildFile; fileRef = 9EF0DBF409D944A300FBCC1E /* Resources/unblock.png */; }; + BE355F9C123E588B00BC66EE /* PurpleDefaultsFacebookXMPP.plist in Resources */ = {isa = PBXBuildFile; fileRef = BE355F93123E588B00BC66EE /* PurpleDefaultsFacebookXMPP.plist */; }; + BE355F9F123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE355F96123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.m */; }; + BE355FA0123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BE355F97123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.h */; }; + BE355FA1123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = BE355F98123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.m */; }; + BE355FA2123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.h in Headers */ = {isa = PBXBuildFile; fileRef = BE355F99123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.h */; }; + BE355FA3123E588B00BC66EE /* AIFacebookXMPPService.m in Sources */ = {isa = PBXBuildFile; fileRef = BE355F9A123E588B00BC66EE /* AIFacebookXMPPService.m */; }; + BE355FA4123E588B00BC66EE /* AIFacebookXMPPService.h in Headers */ = {isa = PBXBuildFile; fileRef = BE355F9B123E588B00BC66EE /* AIFacebookXMPPService.h */; }; C44BA7830AAB696400C7504F /* SetupAssistantBoxBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = C44BA7810AAB696400C7504F /* SetupAssistantBoxBackgroundView.m */; }; C4D29CC40C3C2E3C001545A2 /* BGICImportController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D29CC00C3C2E3C001545A2 /* BGICImportController.m */; }; C4D29CC60C3C2E3C001545A2 /* BGICLogImportController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D29CC20C3C2E3C001545A2 /* BGICLogImportController.m */; }; @@ -4845,6 +4852,13 @@ A3C0431E08D74D3100B48CE1 /* AIPurpleGTalkAccountViewController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIPurpleGTalkAccountViewController.m; path = "Plugins/Purple Service/AIPurpleGTalkAccountViewController.m"; sourceTree = ""; }; A3C0431F08D74D3100B48CE1 /* AIGTalkService.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIGTalkService.h; path = "Plugins/Purple Service/AIGTalkService.h"; sourceTree = ""; }; A3C0432008D74D3100B48CE1 /* AIGTalkService.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIGTalkService.m; path = "Plugins/Purple Service/AIGTalkService.m"; sourceTree = ""; }; + BE355F93123E588B00BC66EE /* PurpleDefaultsFacebookXMPP.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PurpleDefaultsFacebookXMPP.plist; path = "Plugins/Purple Service/PurpleDefaultsFacebookXMPP.plist"; sourceTree = ""; }; + BE355F96123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIPurpleFacebookXMPPAccountViewController.m; path = "Plugins/Purple Service/AIPurpleFacebookXMPPAccountViewController.m"; sourceTree = ""; }; + BE355F97123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIPurpleFacebookXMPPAccountViewController.h; path = "Plugins/Purple Service/AIPurpleFacebookXMPPAccountViewController.h"; sourceTree = ""; }; + BE355F98123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIPurpleFacebookXMPPAccount.m; path = "Plugins/Purple Service/AIPurpleFacebookXMPPAccount.m"; sourceTree = ""; }; + BE355F99123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIPurpleFacebookXMPPAccount.h; path = "Plugins/Purple Service/AIPurpleFacebookXMPPAccount.h"; sourceTree = ""; }; + BE355F9A123E588B00BC66EE /* AIFacebookXMPPService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIFacebookXMPPService.m; path = "Plugins/Purple Service/AIFacebookXMPPService.m"; sourceTree = ""; }; + BE355F9B123E588B00BC66EE /* AIFacebookXMPPService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIFacebookXMPPService.h; path = "Plugins/Purple Service/AIFacebookXMPPService.h"; sourceTree = ""; }; C4243C920638E4EA007AD2D9 /* BGEmoticonMenuPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = BGEmoticonMenuPlugin.h; path = Source/BGEmoticonMenuPlugin.h; sourceTree = ""; }; C4243C930638E4EA007AD2D9 /* BGEmoticonMenuPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = BGEmoticonMenuPlugin.m; path = Source/BGEmoticonMenuPlugin.m; sourceTree = ""; }; C44BA7800AAB696300C7504F /* SetupAssistantBoxBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SetupAssistantBoxBackgroundView.h; path = Source/SetupAssistantBoxBackgroundView.h; sourceTree = ""; }; @@ -5687,6 +5701,7 @@ 34416053059FC2270019246B /* Jabber */ = { isa = PBXGroup; children = ( + BE355F7C123E56A900BC66EE /* FacebookXMPP */, 34416171059FC55A0019246B /* ESJabberService.h */, 34416172059FC55A0019246B /* ESJabberService.m */, 344160C3059FC3080019246B /* ESPurpleJabberAccount.h */, @@ -8732,6 +8747,20 @@ path = Source; sourceTree = ""; }; + BE355F7C123E56A900BC66EE /* FacebookXMPP */ = { + isa = PBXGroup; + children = ( + BE355F93123E588B00BC66EE /* PurpleDefaultsFacebookXMPP.plist */, + BE355F96123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.m */, + BE355F97123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.h */, + BE355F98123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.m */, + BE355F99123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.h */, + BE355F9A123E588B00BC66EE /* AIFacebookXMPPService.m */, + BE355F9B123E588B00BC66EE /* AIFacebookXMPPService.h */, + ); + name = FacebookXMPP; + sourceTree = ""; + }; C4D29C9D0C3C2D90001545A2 /* iChat Importer */ = { isa = PBXGroup; children = ( @@ -9280,6 +9309,9 @@ 34064D110F21B34200AA6FE3 /* PurpleFacebookAccountViewController.h in Headers */, 113E06AF10D0ABE3005D5B9A /* adiumPurpleMedia.h in Headers */, 1181981310D0B17C003E8ECA /* adiumPurpleMedia.h in Headers */, + BE355FA0123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.h in Headers */, + BE355FA2123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.h in Headers */, + BE355FA4123E588B00BC66EE /* AIFacebookXMPPService.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9896,6 +9928,7 @@ 345D689A0F1FD56B002F2D01 /* facebook-small.png in Resources */, 1150A9960FBE48D600E0BD31 /* ESIRCAccountView.nib in Resources */, 1125DD3C0FF5A5D600544B92 /* PurpleFacebookAccountView.nib in Resources */, + BE355F9C123E588B00BC66EE /* PurpleDefaultsFacebookXMPP.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -10463,6 +10496,9 @@ 345D68A30F1FD59F002F2D01 /* PurpleFacebookService.m in Sources */, 345D68A90F1FD5AA002F2D01 /* PurpleFacebookAccount.m in Sources */, 34064D100F21B34200AA6FE3 /* PurpleFacebookAccountViewController.m in Sources */, + BE355F9F123E588B00BC66EE /* AIPurpleFacebookXMPPAccountViewController.m in Sources */, + BE355FA1123E588B00BC66EE /* AIPurpleFacebookXMPPAccount.m in Sources */, + BE355FA3123E588B00BC66EE /* AIFacebookXMPPService.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/AIFacebookXMPPService.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/AIFacebookXMPPService.h Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,23 @@ +/* + * Adium is the legal property of its developers, whose names are listed in the copyright file included + * with this source distribution. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "ESJabberService.h" + +@interface AIFacebookXMPPService : ESJabberService { + +} + +@end diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/AIFacebookXMPPService.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/AIFacebookXMPPService.m Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,110 @@ +/* + * Adium is the legal property of its developers, whose names are listed in the copyright file included + * with this source distribution. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "AIFacebookXMPPService.h" +#import "AIPurpleFacebookXMPPAccount.h" +#import "AIPurpleFacebookXMPPAccountViewController.h" +#import + +@implementation AIFacebookXMPPService + +//Account Creation +- (Class)accountClass{ + return [AIPurpleFacebookXMPPAccount class]; +} + +- (AIAccountViewController *)accountViewController{ + return [AIPurpleFacebookXMPPAccountViewController accountViewController]; +} + + +//Service Description +- (NSString *)serviceCodeUniqueID{ + return @"libpurple-jabber-facebook"; +} +- (NSString *)serviceID{ + return @"FacebookXMPP"; +} +- (NSString *)shortDescription{ + return @"Facebook"; +} +- (NSString *)longDescription{ + return @"Facebook XMPP"; +} +- (NSCharacterSet *)ignoredCharacters{ + return [NSCharacterSet characterSetWithCharactersInString:@" "]; +} +- (BOOL)caseSensitive{ + return NO; +} +- (BOOL)canRegisterNewAccounts{ + return NO; +} +- (AIServiceImportance)serviceImportance{ + return AIServiceSecondary; +} +/*! + * @brief Placeholder string for the UID field + */ +- (NSString *)UIDPlaceholder +{ + return AILocalizedString(@"username@chat.facebook.com","Sample name and server for new facebook accounts"); +} +- (NSString *)userNameLabel{ + return AILocalizedString(@"Facebook Username",nil); +} + +/*! + * @brief Default icon + * + * Service Icon packs should always include images for all the built-in Adium services. This method allows external + * service plugins to specify an image which will be used when the service icon pack does not specify one. It will + * also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist + * which do not yet have an image for this service. If the active Service Icon pack provides an image for this service, + * this method will not be called. + * + * The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects. + * + * @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon. + * @return NSImage to use for this service by default + */ +- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType +{ + if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) { + return [NSImage imageNamed:@"facebook-small" forClass:[self class] loadLazily:YES]; + } else { + return [NSImage imageNamed:@"facebook" forClass:[self class] loadLazily:YES]; + } +} + +/*! + * @brief Path for default icon + * + * For use in message views, this is the path to a default icon as described above. + * + * @param iconType The AIServiceIconType of the icon to return. + * @return The path to the image, otherwise nil. + */ +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType +{ + if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) { + return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook-small"]; + } else { + return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook"]; + } +} + +@end diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/AIPurpleFacebookXMPPAccount.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/AIPurpleFacebookXMPPAccount.h Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,26 @@ +/* + * Adium is the legal property of its developers, whose names are listed in the copyright file included + * with this source distribution. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "ESPurpleJabberAccount.h" + +@interface AIPurpleFacebookXMPPAccount : ESPurpleJabberAccount { + +} + +- (void)viewFacebookProfile:(NSMenuItem *)menuItem; +- (void)viewFacebookCompose:(NSMenuItem *)menuItem; +- (NSString *) formatUid:(NSString *)uid; +@end diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/AIPurpleFacebookXMPPAccount.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/AIPurpleFacebookXMPPAccount.m Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,175 @@ +/* + * Adium is the legal property of its developers, whose names are listed in the copyright file included + * with this source distribution. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "AIPurpleFacebookXMPPAccount.h" +#import +#import +#import + +@implementation AIPurpleFacebookXMPPAccount + +- (const char *)purpleAccountName +{ + NSString *userNameWithChatFacebookDotCom = nil; + + /* + * Purple stores the username in the format username@server/resource. We need to pass it a username in this format + * + * Append @gmail.com if no domain is specified. + * Valid domains include gmail.com, googlemail.com, and google-hosted domains like e.co.za. + */ + if ([UID rangeOfString:@"@"].location == NSNotFound) { + userNameWithChatFacebookDotCom = [UID stringByAppendingString:@"@chat.facebook.com"]; + } else { + userNameWithChatFacebookDotCom = UID; + } + + NSString *completeUserName = [NSString stringWithFormat:@"%@/%@",userNameWithChatFacebookDotCom, [self resourceName]]; + + return [completeUserName UTF8String]; +} + +- (NSString *)serverSuffix +{ + return @"@chat.facebook.com"; +} + +/*! + * @brief Allow a file transfer with an object? + * + */ +- (BOOL)allowFileTransferWithListObject:(AIListObject *)inListObject +{ + return NO; +} + +- (AIReconnectDelayType)shouldAttemptReconnectAfterDisconnectionError:(NSString **)disconnectionError +{ + AIReconnectDelayType shouldAttemptReconnect = [super shouldAttemptReconnectAfterDisconnectionError:disconnectionError]; + + if (disconnectionError && *disconnectionError) { + if (([*disconnectionError rangeOfString:@"401"].location != NSNotFound) || + ([*disconnectionError rangeOfString:@"Authentication Failure"].location != NSNotFound) || + ([*disconnectionError rangeOfString:@"Not Authorized"].location != NSNotFound)) { + [self setLastDisconnectionError:AILocalizedString(@"Incorrect username or password","Error message displayed when the server reports username or password as being incorrect.")]; + [self serverReportedInvalidPassword]; + shouldAttemptReconnect = AIReconnectImmediately; + } + } + + return shouldAttemptReconnect; +} + +- (void)configurePurpleAccount +{ + [super configurePurpleAccount]; + + // force connect server + purple_account_set_string(account, "connect_server", "chat.facebook.com"); +} + +- (BOOL)allowAccountUnregistrationIfSupportedByLibpurple +{ + return NO; +} + +#pragma mark Menu Items +/*! + * @brief Menu items for contact + * + * Returns an array of menu items for a contact on this account. This is the best place to add protocol-specific + * actions that aren't otherwise supported by Adium. + * @param inContact AIListContact for menu items + * @return NSArray of NSMenuItem instances for the passed contact + */ +- (NSArray *)menuItemsForContact:(AIListContact *)inContact +{ + NSMutableArray *menuItemArray = [NSMutableArray array]; + + //Fill with any items supplied by libpurple + [menuItemArray addObjectsFromArray:[super menuItemsForContact:inContact]]; + + + //Add a new menu item with the facebook icon to view the contacts profile + NSMenuItem *menuItem; + NSImage *serviceIcon = [AIServiceIcons serviceIconForService:self.service + type:AIServiceIconSmall + direction:AIIconNormal]; + + menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:[NSString stringWithFormat:AILocalizedString(@"View %@'s Facebook profile", nil), inContact.displayName] + target:self + action:@selector(viewFacebookProfile:) + keyEquivalent:@""] autorelease]; + [menuItem setImage:serviceIcon]; + [menuItem setRepresentedObject:inContact]; + [menuItemArray addObject:menuItem]; + + //Add a new menu item with the facebook icon to send a message + NSMenuItem *menuItem2; + + menuItem2 = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:[NSString stringWithFormat:AILocalizedString(@"Send a Facebook Message to %@", nil), inContact.displayName] + target:self + action:@selector(viewFacebookCompose:) + keyEquivalent:@""] autorelease]; + [menuItem2 setImage:serviceIcon]; + [menuItem2 setRepresentedObject:inContact]; + [menuItemArray addObject:menuItem2]; + + //Don't return an empty array + if (![menuItemArray count]) menuItemArray = nil; + + return menuItemArray; +} + + +/*! + * @brief Open Facebook Profile + * + * Opens the selected contacts or chats facebook profile in the default web browser + */ +- (void)viewFacebookProfile:(NSMenuItem *)menuItem +{ + NSString *uid = [self formatUid:[(AIListContact *)menuItem.representedObject UID]]; + NSString *url = [NSString stringWithFormat:@"http://www.facebook.com/profile.php?id=%@", uid]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; +} + +- (void)viewFacebookCompose:(NSMenuItem *)menuItem +{ + NSString *uid = [self formatUid:[(AIListContact *)menuItem.representedObject UID]]; + + NSString *url = [NSString stringWithFormat:@"http://www.facebook.com/inbox/?compose=1&id=%@",uid]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; +} + +- (NSString *)formatUid:(NSString *)uid +{ + NSString *formattedUid; + NSRange atSign = [uid rangeOfString:@"@"]; + if (atSign.location != NSNotFound) + { + formattedUid = [uid substringToIndex:atSign.location]; + } + + if ([formattedUid hasPrefix:@"-"]) + { + formattedUid = [formattedUid substringFromIndex:1]; + } + + return formattedUid; +} + +@end diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/AIPurpleFacebookXMPPAccountViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/AIPurpleFacebookXMPPAccountViewController.h Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,23 @@ +/* + * Adium is the legal property of its developers, whose names are listed in the copyright file included + * with this source distribution. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "ESPurpleJabberAccountViewController.h" + +@interface AIPurpleFacebookXMPPAccountViewController : ESPurpleJabberAccountViewController { + +} + +@end diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/AIPurpleFacebookXMPPAccountViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/AIPurpleFacebookXMPPAccountViewController.m Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,31 @@ +/* + * Adium is the legal property of its developers, whose names are listed in the copyright file included + * with this source distribution. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "AIPurpleFacebookXMPPAccountViewController.h" + + +@implementation AIPurpleFacebookXMPPAccountViewController + +- (void)configureForAccount:(AIAccount *)inAccount +{ + [super configureForAccount:inAccount]; + [textField_connectServer setStringValue:@"chat.facebook.com"]; + [textField_connectServer setEditable:NO]; + [textField_connectServer setBordered:NO]; + [textField_connectServer setDrawsBackground:NO]; +} + +@end diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/CBPurpleServicePlugin.m --- a/Plugins/Purple Service/CBPurpleServicePlugin.m Sun Sep 12 12:35:22 2010 +1000 +++ b/Plugins/Purple Service/CBPurpleServicePlugin.m Tue Sep 14 23:12:54 2010 +1000 @@ -46,6 +46,7 @@ [PurpleFacebookService registerService]; [ESGaduGaduService registerService]; [AIGTalkService registerService]; + [AIFacebookXMPPService registerService]; [ESIRCService registerService]; [AILiveJournalService registerService]; [ESMSNService registerService]; diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/ESPurpleJabberAccount.m --- a/Plugins/Purple Service/ESPurpleJabberAccount.m Sun Sep 12 12:35:22 2010 +1000 +++ b/Plugins/Purple Service/ESPurpleJabberAccount.m Tue Sep 14 23:12:54 2010 +1000 @@ -290,6 +290,9 @@ } else if([contactUID hasSuffix:@"@livejournal.com"]){ contactServiceID = @"libpurple-jabber-livejournal"; + } else if([contactUID hasSuffix:@"@chat.facebook.com"]){ + contactServiceID = @"libpurple-jabber-facebook"; + } else { contactServiceID = @"libpurple-Jabber"; } diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/PurpleDefaultsFacebookXMPP.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/Purple Service/PurpleDefaultsFacebookXMPP.plist Tue Sep 14 23:12:54 2010 +1000 @@ -0,0 +1,14 @@ + + + + + Connect Port + 5222 + Jabber:Connect Server + chat.facebook.com + Jabber:Resource + Adium + Display Custom Emoticons + + + diff -r 5a9ea297960556dff5bf10f76e0afbe63f2bfc3f -r 6f80a3305e99e0579048b6f1f6e6c525fc5b858c Plugins/Purple Service/PurpleServices.h --- a/Plugins/Purple Service/PurpleServices.h Sun Sep 12 12:35:22 2010 +1000 +++ b/Plugins/Purple Service/PurpleServices.h Tue Sep 14 23:12:54 2010 +1000 @@ -21,6 +21,7 @@ #import "PurpleFacebookService.h" #import "ESGaduGaduService.h" #import "AIGTalkService.h" +#import "AIFacebookXMPPService.h" #import "ESIRCService.h" #import "AILiveJournalService.h" #import "ESJabberService.h"