[Adium-commits] adium 1956:fe470f38b994: Change the default (and Oscar—the onl...
adium-commits at adiumx.com
adium-commits at adiumx.com
Thu Apr 23 20:35:25 UTC 2009
details: http://hg.adiumx.com/adium/rev/fe470f38b994
revision: 1956:fe470f38b994
author: Zachary West <zacw at adiumx.com>
date: Thu Apr 23 16:35:17 2009 -0400
Change the default (and Oscar—the only thing that overlodas it) service to lowercase a chat name when normalizing it. Save the normalized name as the AIChat's name, not whatever the user entered. This fixes creating a second AIChat when joining any chat whose case may differ on the server (or spaces are present in Oscar names), as well as bookmarking or rejoining said chats.
diffstat:
Frameworks/Adium Framework/Source/AIListBookmark.m | 3 +++
Frameworks/Adium Framework/Source/AIService.m | 4 ++--
Plugins/Purple Service/CBOscarService.m | 2 +-
Source/AIChatController.m | 17 ++++++++++-------
4 files changed, 16 insertions(+), 10 deletions(-)
diffs (88 lines):
diff -r daddd4cef7ac -r fe470f38b994 Frameworks/Adium Framework/Source/AIListBookmark.m
--- a/Frameworks/Adium Framework/Source/AIListBookmark.m Thu Apr 23 12:56:39 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIListBookmark.m Thu Apr 23 16:35:17 2009 -0400
@@ -59,6 +59,9 @@
selector:@selector(chatDidOpen:)
name:Chat_DidOpen
object:nil];
+
+ AILog(@"Created %@", self);
+
}
return self;
diff -r daddd4cef7ac -r fe470f38b994 Frameworks/Adium Framework/Source/AIService.m
--- a/Frameworks/Adium Framework/Source/AIService.m Thu Apr 23 12:56:39 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIService.m Thu Apr 23 16:35:17 2009 -0400
@@ -488,11 +488,11 @@
/*!
* @brief Normalize a chat name
*
- * The default implementation makes no changes
+ * The default implementation only lowercases the name.
*/
- (NSString *)normalizeChatName:(NSString *)inChatName
{
- return inChatName;
+ return [inChatName lowercaseString];
}
/*!
diff -r daddd4cef7ac -r fe470f38b994 Plugins/Purple Service/CBOscarService.m
--- a/Plugins/Purple Service/CBOscarService.m Thu Apr 23 12:56:39 2009 -0400
+++ b/Plugins/Purple Service/CBOscarService.m Thu Apr 23 16:35:17 2009 -0400
@@ -67,7 +67,7 @@
- (NSString *)normalizeChatName:(NSString *)inChatName
{
- return [inChatName compactedString];
+ return [[inChatName compactedString] lowercaseString];
}
#pragma mark Statuses
diff -r daddd4cef7ac -r fe470f38b994 Source/AIChatController.m
--- a/Source/AIChatController.m Thu Apr 23 12:56:39 2009 -0400
+++ b/Source/AIChatController.m Thu Apr 23 16:35:17 2009 -0400
@@ -384,9 +384,11 @@
if (identifier) {
chat = [self existingChatWithIdentifier:identifier onAccount:account];
+
if (!chat) {
//See if a chat was made with this name but which doesn't yet have an identifier. If so, take ownership!
chat = [self existingChatWithName:name onAccount:account];
+
if (chat && ![chat identifier])
[chat setIdentifier:identifier];
// If existingChatWithName:onAccount: finds a chat, make sure it has the right identifier.
@@ -403,14 +405,16 @@
if (!chat) {
//Create a new chat
chat = [AIChat chatForAccount:account];
- [chat setName:name];
- [chat setIdentifier:identifier];
- [chat setIsGroupChat:YES];
- [chat setChatCreationDictionary:chatCreationInfo];
+
+ chat.name = [account.service normalizeChatName:name];
+ chat.displayName = name;
+ chat.identifier = identifier;
+ chat.isGroupChat = YES;
+ chat.chatCreationDictionary = chatCreationInfo;
[openChats addObject:chat];
- AILog(@"chatWithName:%@ identifier:%@ onAccount:%@ added <<%@>> [%@]",name,identifier,account,chat,openChats);
-
+
+ AILog(@"chatWithName:%@ identifier:%@ onAccount:%@ added <<%@>> [%@] [%@]",name,identifier,account,chat,openChats,chatCreationInfo);
//Inform the account of its creation
if (![account openChat:chat]) {
@@ -434,7 +438,6 @@
AIChat *chat = nil;
name = [account.service normalizeChatName:name];
-
for (chat in openChats) {
if ((chat.account == account) &&
More information about the commits
mailing list