adium 4038:9df931e22bfe: Reconstuct the chat creation dictionary...
commits at adium.im
commits at adium.im
Tue Jul 5 14:54:07 UTC 2011
details: http://hg.adium.im/adium/rev/9df931e22bfe
revision: 4038:9df931e22bfe
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Tue Jul 05 16:50:38 2011 +0200
Reconstuct the chat creation dictionary when joining an XMPP MUC from libpurple (e.g.: /join). Show an error when trying to rejoin a bookmark which is missing its chat creation dictionary.
Fixes #15187
(transplanted from bd81099c15d67cc9e68fe53dddbc5f8a62d1abed)
diffs (70 lines):
diff -r ec92ca1d3d06 -r 9df931e22bfe Frameworks/Adium Framework/Source/AIListBookmark.m
--- a/Frameworks/Adium Framework/Source/AIListBookmark.m Sat Jul 02 15:07:45 2011 -0700
+++ b/Frameworks/Adium Framework/Source/AIListBookmark.m Tue Jul 05 16:50:38 2011 +0200
@@ -276,6 +276,10 @@
{
AIChat *chat = [self openChatWithoutActivating];
+ if (!chat) {
+ return nil;
+ }
+
if(!chat.isOpen) {
[adium.interfaceController openChat:chat];
}
@@ -293,6 +297,13 @@
*/
- (AIChat *)openChatWithoutActivating
{
+ if (!self.chatCreationDictionary) {
+ NSRunAlertPanel(AILocalizedString(@"Joining Bookmark Failed!", nil),
+ AILocalizedString(@"There was a problem joining the bookmark %@. Please remove and add the bookmark again.", nil),
+ AILocalizedString(@"OK", nil), nil, nil, [self displayName]);
+ return nil;
+ }
+
AIChat *chat = [adium.chatController existingChatWithName:self.name
onAccount:self.account];
diff -r ec92ca1d3d06 -r 9df931e22bfe Plugins/Purple Service/ESPurpleJabberAccount.m
--- a/Plugins/Purple Service/ESPurpleJabberAccount.m Sat Jul 02 15:07:45 2011 -0700
+++ b/Plugins/Purple Service/ESPurpleJabberAccount.m Tue Jul 05 16:50:38 2011 +0200
@@ -371,6 +371,38 @@
}
}
+/*!
+ * @brief Re-create the chat's join options.
+ */
+- (NSDictionary *)extractChatCreationDictionaryFromConversation:(PurpleConversation *)conv
+{
+ NSString *jid = [NSString stringWithUTF8String:purple_conversation_get_title(conv)];
+ NSArray *components = [jid componentsSeparatedByString:@"@"];
+
+ if ([components count] != 2) return nil;
+
+ NSString *channel = [components objectAtIndex:0];
+ NSString *host = [components objectAtIndex:1];
+
+ PurpleConnection *gc = purple_account_get_connection([self purpleAccount]);
+ JabberStream *js = purple_connection_get_protocol_data(gc);
+
+ // jabber_chat_find_by_conv will fail as chat->id isn't set yet
+ JabberChat *chat = jabber_chat_find(js, [channel UTF8String], [host UTF8String]);
+
+ if (!chat) {
+ AILogWithSignature(@"Could not find chat: %@@%@", channel, host);
+ return nil;
+ }
+
+ NSMutableDictionary *dict = [NSMutableDictionary dictionary];
+ [dict setObject:channel forKey:@"room"];
+ [dict setObject:host forKey:@"server"];
+ [dict setObject:[NSString stringWithUTF8String:g_hash_table_lookup(chat->components, "handle")] forKey:@"handle"];
+
+ return dict;
+}
+
#pragma mark Status
- (NSString *)encodedAttributedString:(NSAttributedString *)inAttributedString forListObject:(AIListObject *)inListObject
More information about the commits
mailing list