Plugins/Purple Service/CBPurpleAccount.m
author Patrick Steinhardt <steinhardt.p@me.com>
Wed, 04 May 2011 10:23:27 +0200
changeset 3899 b737e71520e4
parent 3782 e660e9081fb6
child 3951 983d9c761506
permissions -rw-r--r--
Fixed broken percentage reflecting connection progress in Accounts.

r=xnyhps. Fixes #15163
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     1
/* 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     2
 * Adium is the legal property of its developers, whose names are listed in the copyright file included
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     3
 * with this source distribution.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     4
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     6
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     7
 * or (at your option) any later version.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     8
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    10
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    11
 * Public License for more details.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    12
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    13
 * You should have received a copy of the GNU General Public License along with this program; if not,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    14
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    15
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    16
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    17
#import "CBPurpleAccount.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    18
1509
eda9596a5c05 Remove CBPurpleAccount's knowledge of MSN.
Zachary West <zacw@adiumx.com>
parents: 1508
diff changeset
    19
#import "PurpleService.h"
eda9596a5c05 Remove CBPurpleAccount's knowledge of MSN.
Zachary West <zacw@adiumx.com>
parents: 1508
diff changeset
    20
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    21
#import <libpurple/notify.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    22
#import <libpurple/cmds.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    23
#import <AdiumLibpurple/SLPurpleCocoaAdapter.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    24
#import <Adium/AIAccount.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    25
#import <Adium/AIChat.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    26
#import <Adium/AIContentMessage.h>
1292
761b05dfd208 Add a Topic template for message styles, which gets added into a <div> with id "topic" in group chats. Authors should do something like: <div contentEditable>%message%</div> (or span, or whatever) so that (in a future commit) topics can be edited. The substitutions are the same for AIContentMessages. %sender% could be nil, however, on initial join.
Zachary West <zacw@adiumx.com>
parents: 1267
diff changeset
    27
#import <Adium/AIContentTopic.h>
1305
864bf7dbd8f6 Kill most uses of AIContentStatus, instead use AIContentEvent in their place. AIContentStatus is exclusively used to log/display contact status changes, which made it pretty confusing to the rest of Adium (mostly logging) about their use. Now, those that aren't marked explicitly not to, AIContentEvents are logged.
Zachary West <zacw@adiumx.com>
parents: 1301
diff changeset
    28
#import <Adium/AIContentEvent.h>
1346
def250c299ee For persistent jabber chats?jabber chats where history is accumulated when not in the chat room?do not trigger events and display the message as context. Fixes #6787.
Zachary West <zacw@adiumx.com>
parents: 1306
diff changeset
    29
#import <Adium/AIContentContext.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    30
#import <Adium/AIContentNotification.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    31
#import <Adium/AIHTMLDecoder.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    32
#import <Adium/AIListContact.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    33
#import <Adium/AIListGroup.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    34
#import <Adium/AIListObject.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    35
#import <Adium/AIMetaContact.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    36
#import <Adium/AIService.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    37
#import <Adium/AIServiceIcons.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    38
#import <Adium/AIStatus.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    39
#import <Adium/ESFileTransfer.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    40
#import <Adium/AIWindowController.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    41
#import <Adium/AIEmoticon.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    42
#import <Adium/AIAccountControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    43
#import <Adium/AIChatControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    44
#import <Adium/AIContactControllerProtocol.h>
14
87a0626c35de Oops. That was supposed to be the whole working copy, not the adium framework source...
David Smith
parents: 12
diff changeset
    45
#import <Adium/AIContactObserverManager.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    46
#import <Adium/AIContentControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    47
#import <Adium/AIInterfaceControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    48
#import <Adium/AIStatusControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    49
#import <AIUtilities/AIAttributedStringAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    50
#import <AIUtilities/AIDictionaryAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    51
#import <AIUtilities/AIMenuAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    52
#import <AIUtilities/AIMutableOwnerArray.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    53
#import <AIUtilities/AIStringAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    54
#import <AIUtilities/AIApplicationAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    55
#import <AIUtilities/AIObjectAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    56
#import <AIUtilities/AIImageAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    57
#import <AIUtilities/AIImageDrawingAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    58
#import <AIUtilities/AIMutableStringAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    59
#import <AIUtilities/AISystemNetworkDefaults.h>
36
de925d247264 Indirecting through the contact controller did allow us to keep the auth stuff in Adium while using it in Adium.framework, but I am unconvinced that it is worth having yet another unrelated ivar and passthrough method in AIContactController. This moves it to Adium.framework and makes it static
David Smith
parents: 26
diff changeset
    60
#import <Adium/AdiumAuthorization.h>
3039
5da4ba3a19c3 Store protocol info in the AIMedia itself; the protocol's job is to manage it. Adds some AIAccount methods to handle media events that it might need to handle.
Zachary West <zacw@adium.im>
parents: 2938
diff changeset
    61
#import <Adium/AIMedia.h>
5da4ba3a19c3 Store protocol info in the AIMedia itself; the protocol's job is to manage it. Adds some AIAccount methods to handle media events that it might need to handle.
Zachary West <zacw@adium.im>
parents: 2938
diff changeset
    62
#import <Adium/AIMediaControllerProtocol.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    63
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    64
#import "ESiTunesPlugin.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    65
#import "AMPurpleTuneTooltip.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    66
#import "adiumPurpleRequest.h"
3045
96c2441aa3a3 Remove a whole bunch of GTK stuff, filling it with absolutely nothing useful.
Zachary West <zacw@adium.im>
parents: 3040
diff changeset
    67
#import "adiumPurpleMedia.h"
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    68
#import "AIDualWindowInterfacePlugin.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    69
998
007fa5209e9c Generalize the "show server certificate" logic from Purple Jabber accounts to all Purple accounts. Can now view the AIM certificate when connected. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 893
diff changeset
    70
#ifdef HAVE_CDSA
007fa5209e9c Generalize the "show server certificate" logic from Purple Jabber accounts to all Purple accounts. Can now view the AIM certificate when connected. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 893
diff changeset
    71
#import "AIPurpleCertificateViewer.h"
007fa5209e9c Generalize the "show server certificate" logic from Purple Jabber accounts to all Purple accounts. Can now view the AIM certificate when connected. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 893
diff changeset
    72
#endif
007fa5209e9c Generalize the "show server certificate" logic from Purple Jabber accounts to all Purple accounts. Can now view the AIM certificate when connected. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 893
diff changeset
    73
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    74
#define NO_GROUP						@"__NoGroup__"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    75
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    76
#define	PREF_GROUP_ALIASES			@"Aliases"		//Preference group to store aliases in
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    77
#define NEW_ACCOUNT_DISPLAY_TEXT		AILocalizedString(@"<New Account>", "Placeholder displayed as the name of a new account")
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    78
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    79
#define	KEY_PRIVACY_OPTION	@"Privacy Option"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    80
84
3b5f51e77592 Switch all of our private method categories over to the new objc way of doing it (documented at http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_5.html#//apple_ref/doc/uid/TP30001163-CH20-SW2). This enforces having implementations for them, and in the process turned up a vast number of methods we had deleted the impl for but not the declaration. loc -= 198;
David Smith
parents: 82
diff changeset
    81
@interface CBPurpleAccount ()
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    82
- (NSString *)_mapIncomingGroupName:(NSString *)name;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    83
- (NSString *)_mapOutgoingGroupName:(NSString *)name;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    84
- (void)setTypingFlagOfChat:(AIChat *)inChat to:(NSNumber *)typingState;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    85
- (void)_receivedMessage:(NSAttributedString *)attributedMessage inChat:(AIChat *)chat fromListContact:(AIListContact *)sourceContact flags:(PurpleMessageFlags)flags date:(NSDate *)date;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    86
- (NSNumber *)shouldCheckMail;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    87
- (void)configurePurpleAccountNotifyingTarget:(id)target selector:(SEL)selector;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    88
- (void)continueConnectWithConfiguredProxy;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    89
- (void)continueRegisterWithConfiguredPurpleAccount;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    90
- (void)promptForHostBeforeConnecting;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    91
- (void)setAccountProfileTo:(NSAttributedString *)profile configurePurpleAccountContext:(NSInvocation *)inInvocation;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    92
- (void)performAccountMenuAction:(NSMenuItem *)sender;
998
007fa5209e9c Generalize the "show server certificate" logic from Purple Jabber accounts to all Purple accounts. Can now view the AIM certificate when connected. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 893
diff changeset
    93
999
efbe8d59cebc Add {{{-secureConnection}}} to CBPurpleAccount.h, correct the private method definition.
Zachary West <zacw@adiumx.com>
parents: 998
diff changeset
    94
- (void)showServerCertificate;
3080
416cc16104a3 Declare previously undeclared selectors in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
    95
416cc16104a3 Declare previously undeclared selectors in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
    96
- (void)retrievedProxyConfiguration:(NSDictionary *)proxyConfig context:(NSInvocation *)invocation;
416cc16104a3 Declare previously undeclared selectors in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
    97
- (void)iTunesDidUpdate:(NSNotification *)notification;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    98
@end
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    99
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   100
@implementation CBPurpleAccount
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   101
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   102
static SLPurpleCocoaAdapter *purpleAdapter = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   103
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   104
// The PurpleAccount currently associated with this Adium account
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   105
- (PurpleAccount*)purpleAccount
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   106
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   107
	//Create a purple account if one does not already exist
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   108
	if (!account) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   109
		[self createNewPurpleAccount];
427
1f3c6cb9b8d7 A bunch more converted
David Smith
parents: 426
diff changeset
   110
		AILog(@"Created PurpleAccount 0x%x with UID %@, protocolPlugin %s", account, self.UID, [self protocolPlugin]);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   111
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   112
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   113
    return account;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   114
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   115
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   116
- (SLPurpleCocoaAdapter *)purpleAdapter
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   117
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   118
	if (!purpleAdapter) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   119
		purpleAdapter = [[SLPurpleCocoaAdapter sharedInstance] retain];	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   120
	}	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   121
	return purpleAdapter;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   122
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   123
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   124
// Subclasses must override this
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   125
- (const char*)protocolPlugin { return NULL; }
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   126
2329
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   127
- (PurplePluginProtocolInfo *)protocolInfo
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   128
{
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   129
	PurplePlugin				*prpl;
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   130
	
2330
2913fda0125b Okay, this just looked silly.
Zachary West <zacw@adium.im>
parents: 2329
diff changeset
   131
	if ((prpl = purple_find_prpl(purple_account_get_protocol_id(account)))) {
2329
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   132
		return PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   133
	}
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   134
	
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   135
	return NULL;
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   136
}
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   137
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   138
// Contacts ------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   139
#pragma mark Contacts
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   140
- (void)newContact:(AIListContact *)theContact withName:(NSString *)inName
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   141
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   142
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   143
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   144
702
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   145
- (void)addContact:(AIListContact *)theContact toGroupName:(NSString *)groupName contactName:(NSString *)contactName
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   146
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   147
	//When a new contact is created, if we aren't already silent and delayed, set it  a second to cover our initial
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   148
	//status updates
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   149
	if (!silentAndDelayed) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   150
		[self silenceAllContactUpdatesForInterval:2.0];
14
87a0626c35de Oops. That was supposed to be the whole working copy, not the adium framework source...
David Smith
parents: 12
diff changeset
   151
		[[AIContactObserverManager sharedManager] delayListObjectNotificationsUntilInactivity];		
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   152
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   153
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   154
	//If the name we were passed differs from the current formatted UID of the contact, it's itself a formatted UID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   155
	//This is important since we may get an alias ("Evan Schoenberg") from the server but also want the formatted name
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   156
	if (![contactName isEqualToString:theContact.formattedUID] && ![contactName isEqualToString:theContact.UID]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   157
		[theContact setValue:contactName
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   158
							 forProperty:@"formattedUID"
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   159
							 notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   160
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   161
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   162
	if (groupName && [groupName isEqualToString:@PURPLE_ORPHANS_GROUP_NAME]) {
589
eda916639c74 Another step towards contacts in multiple groups
David Smith
parents: 537
diff changeset
   163
		[theContact addRemoteGroupName:AILocalizedString(@"Orphans","Name for the orphans group")];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   164
	} else if (groupName && [groupName length] != 0) {
589
eda916639c74 Another step towards contacts in multiple groups
David Smith
parents: 537
diff changeset
   165
		[theContact addRemoteGroupName:[self _mapIncomingGroupName:groupName]];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   166
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   167
		AILog(@"Got a nil group for %@",theContact);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   168
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   169
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   170
	[self gotGroupForContact:theContact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   171
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   172
702
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   173
- (void)removeContact:(AIListContact *)theContact fromGroupName:(NSString *)groupName
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   174
{
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   175
	NSParameterAssert(groupName != nil); //is this always true?
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   176
	NSParameterAssert(theContact != nil);
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   177
	[theContact removeRemoteGroupName:[self _mapIncomingGroupName:groupName]];
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   178
}
86cb151c6821 Hook up the removed buddy signal, since adding a group and moving to a new group no longer mean the same thing
David Smith
parents: 677
diff changeset
   179
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   180
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   181
 * @brief Change the UID of a contact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   182
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   183
 * If we're just passed a formatted version of the current UID, don't change the UID but instead use the information
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   184
 * as the FormattedUID.  For example, we get sent this when an AIM contact's name formatting changes; we always want
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   185
 * to use a lowercase and space-free version for the UID, however.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   186
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   187
- (void)renameContact:(AIListContact *)theContact toUID:(NSString *)newUID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   188
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   189
	//If the name we were passed differs from the current formatted UID of the contact, it's itself a formatted UID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   190
	//This is important since we may get an alias ("Evan Schoenberg") from the server but also want the formatted name
427
1f3c6cb9b8d7 A bunch more converted
David Smith
parents: 426
diff changeset
   191
	NSString	*normalizedUID = [self.service normalizeUID:newUID removeIgnoredCharacters:YES];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   192
	
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   193
	if ([normalizedUID isEqualToString:theContact.UID]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   194
		[theContact setValue:newUID
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   195
							 forProperty:@"formattedUID"
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   196
							 notify:NotifyLater];		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   197
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   198
		[theContact setUID:newUID];		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   199
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   200
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   201
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   202
- (void)updateContact:(AIListContact *)theContact toAlias:(NSString *)purpleAlias
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   203
{
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   204
	if (![[purpleAlias compactedString] isEqualToString:[theContact.UID compactedString]]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   205
		//Store this alias as the serverside display name so long as it isn't identical when unformatted to the UID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   206
		[theContact setServersideAlias:purpleAlias
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   207
							  silently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   208
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   209
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   210
		//If it's the same characters as the UID, apply it as a formatted UID
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   211
		if (![purpleAlias isEqualToString:theContact.formattedUID] && 
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   212
			![purpleAlias isEqualToString:theContact.UID]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   213
			[theContact setFormattedUID:purpleAlias
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   214
								 notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   215
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   216
			//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   217
			[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   218
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   219
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   220
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   221
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   222
- (void)updateContact:(AIListContact *)theContact forEvent:(NSNumber *)event
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   223
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   224
}		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   225
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   226
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   227
//Signed online
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   228
- (void)updateSignon:(AIListContact *)theContact withData:(void *)data
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   229
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   230
	[theContact setOnline:YES
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   231
				   notify:NotifyLater
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   232
				 silently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   233
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   234
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   235
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   236
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   237
//Signed offline
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   238
- (void)updateSignoff:(AIListContact *)theContact withData:(void *)data
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   239
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   240
	[theContact setOnline:NO
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   241
				   notify:NotifyLater
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   242
				 silently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   243
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   244
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   245
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   246
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   247
//Signon Time
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   248
- (void)updateSignonTime:(AIListContact *)theContact withData:(NSDate *)signonDate
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   249
{	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   250
	[theContact setSignonDate:signonDate
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   251
					   notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   252
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   253
	//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   254
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   255
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   256
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   257
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   258
 * @brief Status name to use for a Purple buddy
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   259
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   260
- (NSString *)statusNameForPurpleBuddy:(PurpleBuddy *)buddy
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   261
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   262
	return nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   263
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   264
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   265
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   266
 * @brief Status message for a contact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   267
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   268
- (NSAttributedString *)statusMessageForPurpleBuddy:(PurpleBuddy *)buddy
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   269
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   270
	PurplePresence		*presence = purple_buddy_get_presence(buddy);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   271
	PurpleStatus		*status = (presence ? purple_presence_get_active_status(presence) : NULL);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   272
	const char			*message = (status ? purple_status_get_attr_string(status, "message") : NULL);
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   273
	NSString			*buddyStatusMessage = nil;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   274
	
2110
50283739d46c Abstraction++; When a buddy doesn't have a status message, grab the status text the prpl specifies for it.
Zachary West <zacw@adium.im>
parents: 2085
diff changeset
   275
	// Get the plugin's status message for this buddy if they don't have a status message
50283739d46c Abstraction++; When a buddy doesn't have a status message, grab the status text the prpl specifies for it.
Zachary West <zacw@adium.im>
parents: 2085
diff changeset
   276
	if (!message) {
2329
6df78055375a Simplify fetching the protocol's UI ops.
Zachary West <zacw@adium.im>
parents: 2319
diff changeset
   277
		PurplePluginProtocolInfo  *prpl_info = self.protocolInfo;
2110
50283739d46c Abstraction++; When a buddy doesn't have a status message, grab the status text the prpl specifies for it.
Zachary West <zacw@adium.im>
parents: 2085
diff changeset
   278
		
50283739d46c Abstraction++; When a buddy doesn't have a status message, grab the status text the prpl specifies for it.
Zachary West <zacw@adium.im>
parents: 2085
diff changeset
   279
		if (prpl_info && prpl_info->status_text) {
2227
4410488f13d0 Avoid leaking protocol-status_text messages.
Zachary West <zacw@adium.im>
parents: 2221
diff changeset
   280
			char *status_text = (prpl_info->status_text)(buddy);
2120
e98c5ea528e3 Don't allow an "Offline" status text to be shown for a contact.
Zachary West <zacw@adium.im>
parents: 2110
diff changeset
   281
			
e98c5ea528e3 Don't allow an "Offline" status text to be shown for a contact.
Zachary West <zacw@adium.im>
parents: 2110
diff changeset
   282
			// Don't display "Offline" as a status message.
2227
4410488f13d0 Avoid leaking protocol-status_text messages.
Zachary West <zacw@adium.im>
parents: 2221
diff changeset
   283
			if (status_text && strcmp(status_text, _("Offline")) != 0) {
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   284
				buddyStatusMessage = [NSString stringWithUTF8String:status_text];				
2120
e98c5ea528e3 Don't allow an "Offline" status text to be shown for a contact.
Zachary West <zacw@adium.im>
parents: 2110
diff changeset
   285
			}
2227
4410488f13d0 Avoid leaking protocol-status_text messages.
Zachary West <zacw@adium.im>
parents: 2221
diff changeset
   286
			
4410488f13d0 Avoid leaking protocol-status_text messages.
Zachary West <zacw@adium.im>
parents: 2221
diff changeset
   287
			g_free(status_text);
2110
50283739d46c Abstraction++; When a buddy doesn't have a status message, grab the status text the prpl specifies for it.
Zachary West <zacw@adium.im>
parents: 2085
diff changeset
   288
		}
2227
4410488f13d0 Avoid leaking protocol-status_text messages.
Zachary West <zacw@adium.im>
parents: 2221
diff changeset
   289
	} else {
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   290
		buddyStatusMessage = [NSString stringWithUTF8String:message];
2110
50283739d46c Abstraction++; When a buddy doesn't have a status message, grab the status text the prpl specifies for it.
Zachary West <zacw@adium.im>
parents: 2085
diff changeset
   291
	}
2221
aec584787c0f We *do* need to HTML decode these status messages.
Zachary West <zacw@adium.im>
parents: 2131
diff changeset
   292
	
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   293
	return buddyStatusMessage ? [AIHTMLDecoder decodeHTML:buddyStatusMessage] : nil;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   294
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   295
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   296
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   297
 * @brief Update the status message and away state of the contact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   298
 */
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   299
- (void)updateStatusForContact:(AIListContact *)theContact toStatusType:(NSNumber *)statusTypeNumber statusName:(NSString *)statusName statusMessage:(NSAttributedString *)inStatusMessage isMobile:(BOOL)isMobile
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   300
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   301
	[theContact setStatusWithName:statusName
3078
1b883db24823 Resolve implicit 64->32 bit castings in AdiumLibpurple.framework. Add asserts to ensure sanity where needed.
Stephen Holt <sholt@adium.im>
parents: 3045
diff changeset
   302
					   statusType:[statusTypeNumber intValue]
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   303
						   notify:NotifyLater];
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   304
	[theContact setStatusMessage:inStatusMessage
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   305
						  notify:NotifyLater];
153
640a1705a59a We don't need a separate method for setting isMobile
Evan Schoenberg
parents: 100
diff changeset
   306
	[theContact setIsMobile:isMobile notify:NotifyLater];
640a1705a59a We don't need a separate method for setting isMobile
Evan Schoenberg
parents: 100
diff changeset
   307
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   308
	//Apply the change
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   309
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   310
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   311
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   312
//Idle time
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   313
- (void)updateWentIdle:(AIListContact *)theContact withData:(NSDate *)idleSinceDate
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   314
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   315
	[theContact setIdle:YES sinceDate:idleSinceDate notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   316
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   317
	//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   318
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   319
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   320
- (void)updateIdleReturn:(AIListContact *)theContact withData:(void *)data
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   321
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   322
	[theContact setIdle:NO
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   323
			  sinceDate:nil
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   324
				 notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   325
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   326
	//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   327
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   328
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   329
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   330
//Evil level (warning level)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   331
- (void)updateEvil:(AIListContact *)theContact withData:(NSNumber *)evilNumber
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   332
{
2693
4bcad311909f Some new type fixes for 64bit in our libpurple connector. Should fix some odd issues, like crashing when initiating an OTR session.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   333
	[theContact setWarningLevel:[evilNumber integerValue]
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   334
						 notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   335
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   336
	//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   337
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   338
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   339
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   340
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   341
- (void)clearIconForContact:(AIListContact *)theContact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   342
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   343
	[theContact setServersideIconData:nil
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   344
							   notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   345
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   346
	//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   347
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   348
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   349
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   350
//Buddy Icon
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   351
- (void)updateIcon:(AIListContact *)theContact withData:(NSData *)userIconData
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   352
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   353
	[NSObject cancelPreviousPerformRequestsWithTarget:self
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   354
											 selector:@selector(clearIconForContact:)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   355
											   object:theContact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   356
	if (userIconData) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   357
		[theContact setServersideIconData:userIconData
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   358
								   notify:NotifyLater];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   359
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   360
		//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   361
		[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   362
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   363
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   364
		/* We may receive an empty icon update just before an actual change. We don't want to flicker through no-icon.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   365
		 * We therefore cancel empty icon updates when we receive a new icon, and we do the actual clearing on a delay in case
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   366
		 * this is what is about to happen.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   367
		 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   368
		[self performSelector:@selector(clearIconForContact:)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   369
				   withObject:theContact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   370
				   afterDelay:10.0];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   371
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   372
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   373
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   374
- (NSString *)processedIncomingUserInfo:(NSString *)inString
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   375
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   376
	NSMutableString *returnString = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   377
	if ([inString rangeOfString:@"Purple could not find any information in the user's profile. The user most likely does not exist."].location != NSNotFound) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   378
		returnString = [[inString mutableCopy] autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   379
		[returnString replaceOccurrencesOfString:@"Purple could not find any information in the user's profile. The user most likely does not exist."
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   380
									  withString:AILocalizedString(@"Adium could not find any information in the user's profile. This may not be a registered name.", "Message shown when a contact's profile can't be found")
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   381
										 options:NSLiteralSearch
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   382
										   range:NSMakeRange(0, [returnString length])];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   383
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   384
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   385
	return (returnString ? returnString : inString);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   386
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   387
660
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   388
- (NSString *)webProfileStringForContact:(AIListContact *)contact
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   389
{
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   390
	return [NSString stringWithFormat:NSLocalizedString(@"View %@'s %@ web profile", nil), 
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   391
			contact.formattedUID, [contact.service shortDescription]];
660
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   392
}
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   393
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   394
- (NSMutableArray *)arrayOfDictionariesFromPurpleNotifyUserInfo:(PurpleNotifyUserInfo *)user_info forContact:(AIListContact *)contact
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   395
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   396
	GList *l;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   397
	NSMutableArray *array = [NSMutableArray array];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   398
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   399
	for (l = purple_notify_user_info_get_entries(user_info); l != NULL; l = l->next) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   400
		PurpleNotifyUserInfoEntry *user_info_entry = l->data;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   401
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   402
		switch (purple_notify_user_info_entry_get_type(user_info_entry)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   403
			case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   404
				[array addObject:[NSDictionary dictionaryWithObjectsAndKeys:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   405
								  [NSString stringWithUTF8String:purple_notify_user_info_entry_get_label(user_info_entry)], KEY_KEY,
2693
4bcad311909f Some new type fixes for 64bit in our libpurple connector. Should fix some odd issues, like crashing when initiating an OTR session.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   406
								  [NSNumber numberWithInteger:AIUserInfoSectionHeader], KEY_TYPE,
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   407
								  nil]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   408
				
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   409
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   410
			case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   411
				[array addObject:[NSDictionary dictionaryWithObjectsAndKeys:
2693
4bcad311909f Some new type fixes for 64bit in our libpurple connector. Should fix some odd issues, like crashing when initiating an OTR session.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   412
								  [NSNumber numberWithInteger:AIUserInfoSectionBreak], KEY_TYPE,
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   413
								  nil]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   414
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   415
				
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   416
			case PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   417
			{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   418
				if (purple_notify_user_info_entry_get_label(user_info_entry) && purple_notify_user_info_entry_get_value(user_info_entry)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   419
					[array addObject:[NSDictionary dictionaryWithObjectsAndKeys:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   420
									  [NSString stringWithUTF8String:purple_notify_user_info_entry_get_label(user_info_entry)], KEY_KEY,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   421
									  processPurpleImages([NSString stringWithUTF8String:purple_notify_user_info_entry_get_value(user_info_entry)], self), KEY_VALUE,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   422
									  nil]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   423
					
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   424
				} else if (purple_notify_user_info_entry_get_label(user_info_entry)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   425
					[array addObject:[NSDictionary dictionaryWithObject:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   426
									  [NSString stringWithUTF8String:purple_notify_user_info_entry_get_label(user_info_entry)]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   427
																 forKey:KEY_KEY]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   428
				} else if (purple_notify_user_info_entry_get_value(user_info_entry)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   429
					NSMutableString	*value = [processPurpleImages([NSString stringWithUTF8String:purple_notify_user_info_entry_get_value(user_info_entry)],
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   430
																  self) mutableCopy];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   431
					[value replaceOccurrencesOfString:@"<br>" withString:@"<br/>" options:(NSCaseInsensitiveSearch | NSLiteralSearch)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   432
					[value replaceOccurrencesOfString:@"<br />" withString:@"<br/>" options:(NSCaseInsensitiveSearch | NSLiteralSearch)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   433
					[value replaceOccurrencesOfString:@"<B>" withString:@"<b>" options:NSLiteralSearch];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   434
166
a43b4310ef2a Updated most of our enumerations to fast enumerations, and did some paramaterization.
Evan Schoenberg
parents: 153
diff changeset
   435
					for (NSString *valuePair in [value componentsSeparatedByString:@"<br/><b>"]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   436
						NSRange	firstStartBold = [valuePair rangeOfString:@"<b>"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   437
						NSRange	firstEndBold = [valuePair rangeOfString:@"</b>"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   438
						
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   439
						if (firstEndBold.length > 0) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   440
							// Chop off <b> from the beginning and :</b> from the end. The extra -1 is for the colon.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   441
							[array addObject:[NSDictionary dictionaryWithObjectsAndKeys:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   442
											  [valuePair substringWithRange:NSMakeRange(firstStartBold.length, firstEndBold.location-firstStartBold.length-1)], KEY_KEY,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   443
											  [valuePair substringFromIndex:NSMaxRange(firstEndBold)], KEY_VALUE,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   444
											  nil]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   445
						} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   446
							[array addObject:[NSDictionary dictionaryWithObject:valuePair
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   447
																		forKey:KEY_VALUE]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   448
						}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   449
					}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   450
					[value release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   451
				}	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   452
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   453
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   454
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   455
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   456
660
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   457
	NSString *webProfileValue = [NSString stringWithFormat:@"%s</a>", _("View web profile")];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   458
	
2693
4bcad311909f Some new type fixes for 64bit in our libpurple connector. Should fix some odd issues, like crashing when initiating an OTR session.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   459
	NSInteger i;
4bcad311909f Some new type fixes for 64bit in our libpurple connector. Should fix some odd issues, like crashing when initiating an OTR session.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   460
	NSUInteger count = [array count];
660
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   461
	for (i = 0; i < count; i++) {
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   462
		NSDictionary *dict = [array objectAtIndex:i];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   463
		NSString *value = [dict objectForKey:KEY_VALUE];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   464
		if (value &&
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   465
			[value rangeOfString:webProfileValue options:(NSBackwardsSearch | NSAnchoredSearch | NSLiteralSearch)].location != NSNotFound) {
1660
81bf0bd727e8 More static analyzer leaks
David Smith
parents: 1649
diff changeset
   466
			NSMutableString *newValue = [[value mutableCopy] autorelease];
660
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   467
			[newValue replaceOccurrencesOfString:webProfileValue
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   468
									  withString:[self webProfileStringForContact:contact]
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   469
										 options:(NSBackwardsSearch | NSAnchoredSearch | NSLiteralSearch)];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   470
			
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   471
			NSMutableDictionary *replacementDict = [dict mutableCopy];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   472
			[replacementDict setObject:newValue forKey:KEY_VALUE];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   473
			[array replaceObjectAtIndex:i withObject:replacementDict];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   474
			[replacementDict release];
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   475
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   476
			/* There will only be 1 (at most) web profile link */
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   477
			break;
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   478
		}
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   479
	}
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   480
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   481
	return array;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   482
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   483
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   484
- (void)updateUserInfo:(AIListContact *)theContact withData:(PurpleNotifyUserInfo *)user_info
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   485
{
660
b913d00c0879 Removed the Facebook Service plugin. Added a libpurple-based Facebook service which uses pidgin-facebook (which is now compiled into our libpurple.framework).
Evan Schoenberg
parents: 638
diff changeset
   486
	NSArray		*profileContents = [self arrayOfDictionariesFromPurpleNotifyUserInfo:user_info forContact:theContact];
1435
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   487
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   488
	[theContact setProfileArray:profileContents
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   489
					notify:NotifyLater];
1400
b4a7a4c31d07 When getting a userinfo notify, open the info inspector for the contact. I can't think of any cases where this would be a bad thing. Fixes #10665.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   490
	
1435
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   491
	[self openInspectorForContactInfo:theContact];
1409
4eafbe86d2fd For Jabber contact signons, we pull the user info to get a user icon update. For this particular user info pull, don't open the info inspector.
Zachary West <zacw@adiumx.com>
parents: 1406
diff changeset
   492
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   493
	//Apply any changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   494
	[theContact notifyOfChangedPropertiesSilently:silentAndDelayed];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   495
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   496
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   497
/*!
1435
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   498
 * @brief Open the info inspector when getting info
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   499
 */
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   500
- (void)openInspectorForContactInfo:(AIListContact *)theContact
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   501
{
1899
e46392bb972c When a delayed status update occurs, do nothing by default. For IRC, open the contact info.
Zachary West <zacw@adiumx.com>
parents: 1821
diff changeset
   502
1435
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   503
}
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   504
bc2544061267 Make opening the inspector as the result of a user info pull an option for the account. By default, we open it. Jabber, however, overrides this to do nothing since it abuses the system.
Zachary West <zacw@adiumx.com>
parents: 1426
diff changeset
   505
/*!
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   506
 * @brief Purple removed a contact from the local blist
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   507
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   508
 * This can happen in many situations:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   509
 *	- For every contact on an account when the account signs off
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   510
 *	- For a contact as it is deleted by the user
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   511
 *	- For a contact as it is deleted by Purple (e.g. when Sametime refuses an addition because it is known to be invalid)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   512
 *	- In the middle of the move process as a contact moves from one group to another
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   513
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   514
 * We need not take any action; we'll be notified of changes by Purple as necessary.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   515
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   516
- (void)removeContact:(AIListContact *)theContact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   517
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   518
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   519
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   520
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   521
//To allow root level buddies on protocols which don't support them, we map any buddies in a group
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   522
//named after this account's UID to the root group.  These functions handle the mapping.  Group names should
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   523
//be filtered through incoming before being sent to Adium - and group names from Adium should be filtered through
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   524
//outgoing before being used.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   525
- (NSString *)_mapIncomingGroupName:(NSString *)name
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   526
{
427
1f3c6cb9b8d7 A bunch more converted
David Smith
parents: 426
diff changeset
   527
	if (!name || ([[name compactedString] caseInsensitiveCompare:self.UID] == NSOrderedSame)) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   528
		return ADIUM_ROOT_GROUP_NAME;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   529
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   530
		return name;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   531
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   532
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   533
- (NSString *)_mapOutgoingGroupName:(NSString *)name
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   534
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   535
	if ([[name compactedString] caseInsensitiveCompare:ADIUM_ROOT_GROUP_NAME] == NSOrderedSame) {
427
1f3c6cb9b8d7 A bunch more converted
David Smith
parents: 426
diff changeset
   536
		return self.UID;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   537
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   538
		return name;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   539
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   540
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   541
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   542
//Update the status of a contact (Request their profile)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   543
- (void)delayedUpdateContactStatus:(AIListContact *)inContact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   544
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   545
    //Request profile
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   546
	[purpleAdapter getInfoFor:inContact.UID onAccount:self];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   547
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   548
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   549
- (void)requestAddContactWithUID:(NSString *)contactUID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   550
{
89
a9e58c43be6c Propertyize, synthesize, and use fast enumeration in a few places
David Smith
parents: 84
diff changeset
   551
	[adium.contactController requestAddContactWithUID:contactUID
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   552
												service:[self _serviceForUID:contactUID]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   553
												account:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   554
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   555
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   556
- (AIService *)_serviceForUID:(NSString *)contactUID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   557
{
427
1f3c6cb9b8d7 A bunch more converted
David Smith
parents: 426
diff changeset
   558
	return self.service;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   559
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   560
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   561
- (void)gotGroupForContact:(AIListContact *)listContact {};
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   562
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   563
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   564
 * @brief Return the serverside icon for a contact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   565
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   566
- (NSData *)serversideIconDataForContact:(AIListContact *)contact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   567
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   568
	PurpleBuddy		*buddy;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   569
	NSData			*data = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   570
427
1f3c6cb9b8d7 A bunch more converted
David Smith
parents: 426
diff changeset
   571
	if (self.purpleAccount &&
715
13cd227e6284 Propertyize a bunch of stuff, and remove some API on AIListObject that was just a passthrough to AIService
David Smith
parents: 714
diff changeset
   572
		(buddy = purple_find_buddy(account, [contact.UID UTF8String]))) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   573
		PurpleBuddyIcon *buddyIcon;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   574
		BOOL			shouldUnref = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   575
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   576
		/* First, try to get a current buddy icon from the PurpleBuddy */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   577
		buddyIcon = purple_buddy_get_icon(buddy);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   578
		if (!buddyIcon) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   579
			/* Failing that, load one from the cache. We'll need to unreference the returned PurpleBuddyIcon
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   580
			 * when we're done.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   581
			 */
715
13cd227e6284 Propertyize a bunch of stuff, and remove some API on AIListObject that was just a passthrough to AIService
David Smith
parents: 714
diff changeset
   582
			buddyIcon = purple_buddy_icons_find(account, [contact.UID UTF8String]);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   583
			shouldUnref = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   584
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   585
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   586
		if (buddyIcon) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   587
			const guchar	*iconData;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   588
			size_t			len;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   589
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   590
			iconData = purple_buddy_icon_get_data(buddyIcon, &len);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   591
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   592
			if (iconData && len) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   593
				data = [NSData dataWithBytes:iconData length:len];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   594
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   595
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   596
			if (shouldUnref)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   597
				purple_buddy_icon_unref(buddyIcon);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   598
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   599
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   600
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   601
		AILogWithSignature(@"Could not get serverside icon data for %@. account is %p", contact, account);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   602
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   603
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   604
	return data;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   605
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   606
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   607
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   608
 * @brief Libpurple manages a contact icon cache; we don't need to duplicate it.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   609
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   610
- (BOOL)managesOwnContactIconCache
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   611
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   612
	return YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   613
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   614
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   615
/*********************/
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   616
/* AIAccount_Handles */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   617
/*********************/
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   618
#pragma mark Contact List Editing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   619
2131
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2128
diff changeset
   620
- (void)removeContacts:(NSArray *)objects fromGroups:(NSArray *)groups
82
b32643c4cf53 Simplify and compact
David Smith
parents: 79
diff changeset
   621
{	
2131
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2128
diff changeset
   622
	for (AIListGroup *group in groups) {
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2128
diff changeset
   623
		NSString *groupName = [self _mapOutgoingGroupName:group.UID];
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2128
diff changeset
   624
	
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2128
diff changeset
   625
		for (AIListContact *object in objects) {
714
2b8014f97fd4 Remove the -remoteGroupName property from AIListContact, fix another place to be multigroups-aware
David Smith
parents: 709
diff changeset
   626
			//Have the purple thread perform the serverside actions
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   627
			[purpleAdapter removeUID:object.UID onAccount:self fromGroup:groupName];
714
2b8014f97fd4 Remove the -remoteGroupName property from AIListContact, fix another place to be multigroups-aware
David Smith
parents: 709
diff changeset
   628
			
2b8014f97fd4 Remove the -remoteGroupName property from AIListContact, fix another place to be multigroups-aware
David Smith
parents: 709
diff changeset
   629
			//Remove it from Adium's list
2b8014f97fd4 Remove the -remoteGroupName property from AIListContact, fix another place to be multigroups-aware
David Smith
parents: 709
diff changeset
   630
			[object removeRemoteGroupName:groupName];
2b8014f97fd4 Remove the -remoteGroupName property from AIListContact, fix another place to be multigroups-aware
David Smith
parents: 709
diff changeset
   631
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   632
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   633
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   634
199
9f83e8b1e299 Remove -addContacts:toGroup: from AIContactController, and change -addContacts:toGroup: on AIAccount to -addContact:toGroup:. This reflects the fact that almost all callsites were creating temporary one-object arrays.
David Smith
parents: 166
diff changeset
   635
- (void)addContact:(AIListContact *)contact toGroup:(AIListGroup *)group
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   636
{
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   637
	NSString		*groupName = [self _mapOutgoingGroupName:group.UID];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   638
	
199
9f83e8b1e299 Remove -addContacts:toGroup: from AIContactController, and change -addContacts:toGroup: on AIAccount to -addContact:toGroup:. This reflects the fact that almost all callsites were creating temporary one-object arrays.
David Smith
parents: 166
diff changeset
   639
	if(![group containsObject:contact]) {
9f83e8b1e299 Remove -addContacts:toGroup: from AIContactController, and change -addContacts:toGroup: on AIAccount to -addContact:toGroup:. This reflects the fact that almost all callsites were creating temporary one-object arrays.
David Smith
parents: 166
diff changeset
   640
		AILogWithSignature(@"%@ adding %@ to %@", self, [self _UIDForAddingObject:contact], groupName);
9f83e8b1e299 Remove -addContacts:toGroup: from AIContactController, and change -addContacts:toGroup: on AIAccount to -addContact:toGroup:. This reflects the fact that almost all callsites were creating temporary one-object arrays.
David Smith
parents: 166
diff changeset
   641
		
2249
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   642
		NSString *alias = [contact.parentContact preferenceForKey:@"Alias"
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   643
						   group:PREF_GROUP_ALIASES];
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   644
		
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   645
		[purpleAdapter addUID:[self _UIDForAddingObject:contact] onAccount:self toGroup:groupName withAlias:alias];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   646
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   647
		//Add it to Adium's list
703
513718f7615d Fix some left out stuff in the last commit
David Smith
parents: 702
diff changeset
   648
		[contact addRemoteGroupName:group.UID]; //Use the non-mapped group name locally
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   649
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   650
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   651
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   652
- (NSString *)_UIDForAddingObject:(AIListContact *)object
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   653
{
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   654
	return object.UID;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   655
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   656
2128
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   657
- (NSSet *)mappedGroupNamesFromGroups:(NSSet *)groups
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   658
{
2128
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   659
	NSMutableSet *mappedNames = [NSMutableSet set];
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   660
	
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   661
	for (AIListGroup *group in groups) {
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   662
		[mappedNames addObject:[self _mapOutgoingGroupName:group.UID]];
709
0ef6a63599ec More scary multigroups changes. It was actually working at one point, but then I broke it again. Progress though :)
David Smith
parents: 703
diff changeset
   663
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   664
	
2128
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   665
	return mappedNames;
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   666
}
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   667
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   668
- (void)moveListObjects:(NSArray *)objects fromGroups:(NSSet *)oldGroups toGroups:(NSSet *)groups
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   669
{
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   670
	NSSet *sourceMappedNames = [self mappedGroupNamesFromGroups:oldGroups];
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   671
	NSSet *destinationMappedNames = [self mappedGroupNamesFromGroups:groups];
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   672
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   673
	//Move the objects to it
893
702958601fe6 I think this fixes a lot of groups stuff. Also simplifies a good bit of AIContactController
David Smith
parents: 837
diff changeset
   674
	for (AIListContact *contact in objects) {
2266
2ff64a5667c2 Fix a few multiple-containers issues with meta contacts.
Zachary West <zacw@adium.im>
parents: 2249
diff changeset
   675
		if (![contact.remoteGroups intersectsSet:oldGroups] && oldGroups.count) {
2ff64a5667c2 Fix a few multiple-containers issues with meta contacts.
Zachary West <zacw@adium.im>
parents: 2249
diff changeset
   676
			continue;
2ff64a5667c2 Fix a few multiple-containers issues with meta contacts.
Zachary West <zacw@adium.im>
parents: 2249
diff changeset
   677
		}
2ff64a5667c2 Fix a few multiple-containers issues with meta contacts.
Zachary West <zacw@adium.im>
parents: 2249
diff changeset
   678
		
2249
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   679
		NSString *alias = [contact.parentContact preferenceForKey:@"Alias"
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   680
						   group:PREF_GROUP_ALIASES];
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   681
		
893
702958601fe6 I think this fixes a lot of groups stuff. Also simplifies a good bit of AIContactController
David Smith
parents: 837
diff changeset
   682
		//Tell the purple thread to perform the serverside operation
2249
4e4e0005bbc2 Set the PurpleBuddy's alias when adding to the buddy list, which is how Pidgin operates.
Zachary West <zacw@adium.im>
parents: 2231
diff changeset
   683
		[purpleAdapter moveUID:contact.UID onAccount:self fromGroups:sourceMappedNames toGroups:destinationMappedNames withAlias:alias];
2128
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   684
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   685
		for (AIListGroup *group in oldGroups) {
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   686
			[contact removeRemoteGroupName:group.UID];
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   687
		}
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   688
		
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   689
		for (AIListGroup *group in groups) {
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   690
			[contact addRemoteGroupName:group.UID];
9992255c5007 Contact list support for moving contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 2120
diff changeset
   691
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   692
	}		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   693
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   694
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   695
- (void)renameGroup:(AIListGroup *)inGroup to:(NSString *)newName
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   696
{
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   697
	NSString		*groupName = [self _mapOutgoingGroupName:inGroup.UID];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   698
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   699
	//Tell the purple thread to perform the serverside operation	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   700
	[purpleAdapter renameGroup:groupName onAccount:self to:newName];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   701
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   702
	//We must also update the remote grouping of all our contacts in that group
531
c5efcf10adf7 Privatize some methods and remove unused args. Also, r25558 was supposed to say @end not .m
David Smith
parents: 428
diff changeset
   703
	for (AIListContact *contact in [adium.contactController allContactsInObject:inGroup onAccount:self]) {
893
702958601fe6 I think this fixes a lot of groups stuff. Also simplifies a good bit of AIContactController
David Smith
parents: 837
diff changeset
   704
		[contact removeRemoteGroupName:groupName];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   705
		//Evan: should we use groupName or newName here?
589
eda916639c74 Another step towards contacts in multiple groups
David Smith
parents: 537
diff changeset
   706
		[contact addRemoteGroupName:newName];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   707
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   708
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   709
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   710
- (void)deleteGroup:(AIListGroup *)inGroup
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   711
{
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 718
diff changeset
   712
	NSString		*groupName = [self _mapOutgoingGroupName:inGroup.UID];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   713
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   714
	[purpleAdapter deleteGroup:groupName onAccount:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   715
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   716
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   717
// Return YES if the contact list is editable
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   718
- (BOOL)contactListEditable
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   719
{
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   720
    return self.online;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   721
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   722
1257
5073dd49befd Instead of creating a window for every authorization requests, create a central "Authorization Requests" window. This has a few toolbar items: Authorize, Authorize & Add, and Deny. Their icons are currently the SSL image, because I suck at art and I needed a placeholder. Another commit is going to add get info buttons, deny and block, and a few other things.
Zachary West <zacw@adiumx.com>
parents: 1158
diff changeset
   723
- (id)authorizationRequestWithDict:(NSDictionary*)dict
5073dd49befd Instead of creating a window for every authorization requests, create a central "Authorization Requests" window. This has a few toolbar items: Authorize, Authorize & Add, and Deny. Their icons are currently the SSL image, because I suck at art and I needed a placeholder. Another commit is going to add get info buttons, deny and block, and a few other things.
Zachary West <zacw@adiumx.com>
parents: 1158
diff changeset
   724
{
5073dd49befd Instead of creating a window for every authorization requests, create a central "Authorization Requests" window. This has a few toolbar items: Authorize, Authorize & Add, and Deny. Their icons are currently the SSL image, because I suck at art and I needed a placeholder. Another commit is going to add get info buttons, deny and block, and a few other things.
Zachary West <zacw@adiumx.com>
parents: 1158
diff changeset
   725
	// We retain this in case libpurple wants to close the request early. It is freed below.
36
de925d247264 Indirecting through the contact controller did allow us to keep the auth stuff in Adium while using it in Adium.framework, but I am unconvinced that it is worth having yet another unrelated ivar and passthrough method in AIContactController. This moves it to Adium.framework and makes it static
David Smith
parents: 26
diff changeset
   726
	return [[AdiumAuthorization showAuthorizationRequestWithDict:dict forAccount:self] retain];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   727
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   728
1257
5073dd49befd Instead of creating a window for every authorization requests, create a central "Authorization Requests" window. This has a few toolbar items: Authorize, Authorize & Add, and Deny. Their icons are currently the SSL image, because I suck at art and I needed a placeholder. Another commit is going to add get info buttons, deny and block, and a few other things.
Zachary West <zacw@adiumx.com>
parents: 1158
diff changeset
   729
- (void)authorizationWithDict:(NSDictionary *)infoDict response:(AIAuthorizationResponse)authorizationResponse
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   730
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   731
	if (account) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   732
		NSValue	*callback = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   733
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   734
		switch (authorizationResponse) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   735
			case AIAuthorizationAllowed:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   736
				callback = [[[infoDict objectForKey:@"authorizeCB"] retain] autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   737
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   738
			case AIAuthorizationDenied:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   739
				callback = [[[infoDict objectForKey:@"denyCB"] retain] autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   740
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   741
			case AIAuthorizationNoResponse:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   742
				callback = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   743
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   744
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   745
		
1267
9c625b506b7f Don't open the auth request window just because the shared controller was instantiated; open it when we have added an actual request. Don't make it key, just bring it to front.
Zachary West <zacw@adiumx.com>
parents: 1257
diff changeset
   746
		//libpurple will remove its reference to the handle for this request, which is inDict, in response to this callback invocation
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   747
		if (callback) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   748
			[purpleAdapter doAuthRequestCbValue:callback withUserDataValue:[[[infoDict objectForKey:@"userData"] retain] autorelease]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   749
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   750
			/* Retained in -[self authorizationRequestWithDict:].  We kept it around before now in case libpurle wanted us to close it early, such as because the
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   751
			 * account disconnected.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   752
			 */
1257
5073dd49befd Instead of creating a window for every authorization requests, create a central "Authorization Requests" window. This has a few toolbar items: Authorize, Authorize & Add, and Deny. Their icons are currently the SSL image, because I suck at art and I needed a placeholder. Another commit is going to add get info buttons, deny and block, and a few other things.
Zachary West <zacw@adiumx.com>
parents: 1158
diff changeset
   753
			[infoDict release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   754
		} else {
1257
5073dd49befd Instead of creating a window for every authorization requests, create a central "Authorization Requests" window. This has a few toolbar items: Authorize, Authorize & Add, and Deny. Their icons are currently the SSL image, because I suck at art and I needed a placeholder. Another commit is going to add get info buttons, deny and block, and a few other things.
Zachary West <zacw@adiumx.com>
parents: 1158
diff changeset
   755
			[purpleAdapter closeAuthRequestWithHandle:infoDict];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   756
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   757
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   758
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   759
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   760
1442
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   761
#pragma mark Group chat ignore
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   762
- (BOOL)accountManagesGroupChatIgnore
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   763
{
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   764
	return YES;
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   765
}
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   766
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   767
- (BOOL)contact:(AIListContact *)inContact isIgnoredInChat:(AIChat *)chat
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   768
{
1649
1983f4b03ca5 I think fix a crash I just saw where we were disconnected and asked for ignore status.
Zachary West <zacw@adiumx.com>
parents: 1609
diff changeset
   769
	if (self.online && chat.isGroupChat) {
1442
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   770
		return [purpleAdapter contact:inContact isIgnoredInChat:chat];
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   771
	} else {
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   772
		return NO;
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   773
	}
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   774
}
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   775
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   776
- (void)setContact:(AIListContact *)inContact ignored:(BOOL)inIgnored inChat:(AIChat *)chat
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   777
{
1649
1983f4b03ca5 I think fix a crash I just saw where we were disconnected and asked for ignore status.
Zachary West <zacw@adiumx.com>
parents: 1609
diff changeset
   778
	if (self.online && chat.isGroupChat) {
1442
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   779
		[purpleAdapter setContact:inContact ignored:inIgnored inChat:chat];
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   780
	}
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   781
}
ff2195a718c9 For libpurple group chats, use its ignore handling so we don't even come near to parsing the data. For others, maintain the same old "ignored participants list" code.
Zachary West <zacw@adiumx.com>
parents: 1435
diff changeset
   782
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   783
//Chats ------------------------------------------------------------
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   784
#pragma mark Chats
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   785
- (void)removeUser:(NSString *)contactName fromChat:(AIChat *)chat
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   786
{
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   787
	if (!chat)
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   788
		return;
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   789
	
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   790
	AIListContact *contact = [self contactWithUID:contactName];
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   791
	[chat removeObject:contact];
2412
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   792
	
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   793
	if (contact.isStranger && 
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   794
		![adium.chatController allGroupChatsContainingContact:contact.parentContact].count &&
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   795
		[adium.chatController existingChatWithContact:contact.parentContact]) {
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   796
		// The contact is a stranger, not in any more group chats, but we have a message with them open.
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   797
		// Set their status to unknown.
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   798
		
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   799
		[contact setStatusWithName:nil
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   800
						statusType:AIUnknownStatus
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   801
							notify:NotifyLater];
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   802
		
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   803
		[contact setValue:nil
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   804
			  forProperty:@"isOnline"
2412
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   805
				   notify:NotifyLater];
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   806
		
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   807
		[contact notifyOfChangedPropertiesSilently:NO];
8f5459ece588 When removing a participant from a group chat, if they aren't in any more group chats, and we have a chat open with them, reset their status to completely unknown.
Zachary West <zacw@adium.im>
parents: 2330
diff changeset
   808
	}
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   809
}
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   810
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   811
- (void)removeUsersArray:(NSArray *)usersArray fromChat:(AIChat *)chat
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   812
{
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   813
	for (NSString *contactName in usersArray) {
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   814
		[self removeUser:contactName fromChat:chat];
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   815
	}
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   816
}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   817
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   818
- (void)updateUserListForChat:(AIChat *)chat users:(NSArray *)users newlyAdded:(BOOL)newlyAdded
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   819
{
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   820
	NSMutableArray *newListObjects = [NSMutableArray array];
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   821
	
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   822
	for (NSDictionary *user in users) {
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   823
		AIListContact *contact = [self contactWithUID:[user objectForKey:@"UID"]];
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   824
		
3331
a9c6a2d66e7b Add a useful debug line for room joins.
Zachary West <zacw@adium.im>
parents: 3329
diff changeset
   825
		AILogWithSignature(@"%@ join %@", chat, contact);
a9c6a2d66e7b Add a useful debug line for room joins.
Zachary West <zacw@adium.im>
parents: 3329
diff changeset
   826
		
1743
152780e69a42 Overload the service icon for group chat cells to display the overall status of the contact. I can't imagine a situation where service icons would be useful to be displayed, and it's better then duplicating the effort. IRC contacts now have available or away status shown.
Zachary West <zacw@adiumx.com>
parents: 1740
diff changeset
   827
		[contact setOnline:YES notify:NotifyNever silently:YES];
152780e69a42 Overload the service icon for group chat cells to display the overall status of the contact. I can't imagine a situation where service icons would be useful to be displayed, and it's better then duplicating the effort. IRC contacts now have available or away status shown.
Zachary West <zacw@adiumx.com>
parents: 1740
diff changeset
   828
		
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   829
		[newListObjects addObject:contact];
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   830
	}
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   831
	
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   832
	[chat addParticipatingListObjects:newListObjects notify:newlyAdded];
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   833
	
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   834
	for (NSDictionary *user in users) {
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   835
		AIListContact *contact = [self contactWithUID:[user objectForKey:@"UID"]];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   836
		
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   837
		[chat setFlags:(AIGroupChatFlags)[[user objectForKey:@"Flags"] integerValue] forContact:contact];
1743
152780e69a42 Overload the service icon for group chat cells to display the overall status of the contact. I can't imagine a situation where service icons would be useful to be displayed, and it's better then duplicating the effort. IRC contacts now have available or away status shown.
Zachary West <zacw@adiumx.com>
parents: 1740
diff changeset
   838
		
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   839
		if ([user objectForKey:@"Alias"]) {
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   840
			[chat setAlias:[user objectForKey:@"Alias"] forContact:contact];
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   841
			
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   842
			if (contact.isStranger) {
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   843
				[contact setServersideAlias:[user objectForKey:@"Alias"] silently:NO];
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   844
			}
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   845
		}
1012
6aa798b1ca14 There was a bunch of redundant code here
David Smith
parents: 999
diff changeset
   846
	}
1732
3660fa1e0442 Due to later changes, this appears to be unnecessary. It being unnecessary is good, since it makes joining #gsoc beachball for 30 seconds or more
David Smith
parents: 1716
diff changeset
   847
	
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   848
	// Post an update notification now that we've modified the flags and names.
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   849
	[[NSNotificationCenter defaultCenter] postNotificationName:Chat_ParticipatingListObjectsChanged
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   850
														object:chat];
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   851
}
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   852
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   853
- (void)renameParticipant:(NSString *)oldUID newName:(NSString *)newUID newAlias:(NSString *)newAlias flags:(AIGroupChatFlags)flags inChat:(AIChat *)chat
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   854
{
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   855
	[chat removeSavedValuesForContactUID:oldUID];
1404
8c1a106a9a8f When a contact is being renamed in multiple chats, avoid creating a secondary list contact and messing with things for the other chats; instead, remove the old values and, if the new UID isn't set, set it.
Zachary West <zacw@adiumx.com>
parents: 1400
diff changeset
   856
	
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   857
	AIListContact *contact = [adium.contactController existingContactWithService:self.service account:self UID:oldUID];
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   858
1404
8c1a106a9a8f When a contact is being renamed in multiple chats, avoid creating a secondary list contact and messing with things for the other chats; instead, remove the old values and, if the new UID isn't set, set it.
Zachary West <zacw@adiumx.com>
parents: 1400
diff changeset
   859
	if (contact) {
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   860
		[adium.contactController setUID:newUID forContact:contact];
1404
8c1a106a9a8f When a contact is being renamed in multiple chats, avoid creating a secondary list contact and messing with things for the other chats; instead, remove the old values and, if the new UID isn't set, set it.
Zachary West <zacw@adiumx.com>
parents: 1400
diff changeset
   861
	} else {
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   862
		contact = [self contactWithUID:newUID];
1404
8c1a106a9a8f When a contact is being renamed in multiple chats, avoid creating a secondary list contact and messing with things for the other chats; instead, remove the old values and, if the new UID isn't set, set it.
Zachary West <zacw@adiumx.com>
parents: 1400
diff changeset
   863
	}
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   864
1461
0ff9afc48fe5 Set the serverside alias for stranger participants in a group chat, which lets us display their formatted name in tooltips instead of their UID version in a clean way.
Zachary West <zacw@adiumx.com>
parents: 1460
diff changeset
   865
	[chat setFlags:flags forContact:contact];
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   866
	[chat setAlias:newAlias forContact:contact];
1461
0ff9afc48fe5 Set the serverside alias for stranger participants in a group chat, which lets us display their formatted name in tooltips instead of their UID version in a clean way.
Zachary West <zacw@adiumx.com>
parents: 1460
diff changeset
   867
	
0ff9afc48fe5 Set the serverside alias for stranger participants in a group chat, which lets us display their formatted name in tooltips instead of their UID version in a clean way.
Zachary West <zacw@adiumx.com>
parents: 1460
diff changeset
   868
	if (contact.isStranger) {
0ff9afc48fe5 Set the serverside alias for stranger participants in a group chat, which lets us display their formatted name in tooltips instead of their UID version in a clean way.
Zachary West <zacw@adiumx.com>
parents: 1460
diff changeset
   869
		[contact setServersideAlias:newAlias silently:NO];
0ff9afc48fe5 Set the serverside alias for stranger participants in a group chat, which lets us display their formatted name in tooltips instead of their UID version in a clean way.
Zachary West <zacw@adiumx.com>
parents: 1460
diff changeset
   870
	}
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   871
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   872
	// Post an update notification since we modified the user entirely.
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   873
	[[NSNotificationCenter defaultCenter] postNotificationName:Chat_ParticipatingListObjectsChanged
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   874
														object:chat];
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   875
}
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   876
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   877
- (void)setAttribute:(NSString *)name value:(NSString *)value forContact:(AIListContact *)contact
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   878
{
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   879
	NSString *property = nil;
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   880
	
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   881
	if ([name isEqualToString:@"userhost"]) {
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   882
		property = @"User Host";
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   883
	} else if ([name isEqualToString:@"realname"]) {
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   884
		property = @"Real Name";
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   885
	} else {
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   886
		AILog(@"Unknown attribute: %@ value %@", name, value);
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   887
	}
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   888
	
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   889
	if (property) {
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   890
		// Callsite should notify.
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   891
		[contact setValue:value forProperty:property notify:NotifyLater];
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   892
	}
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   893
}
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   894
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   895
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   896
- (void)updateUser:(NSString *)user
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   897
		   forChat:(AIChat *)chat
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   898
			 flags:(AIGroupChatFlags)flags
2231
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   899
			 alias:(NSString *)alias
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   900
		attributes:(NSDictionary *)attributes
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   901
{
2231
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   902
	BOOL triggerUserlistUpdate = NO;
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   903
	
1460
c9a3f439efaf Remove CBPurpleAccount's knowledge of PurpleConvChatBuddys, instead send it the information it needs. I removed {{{uidForContactWithUID:inChat:}}} in favor of using the {{{get_cb_real_name}}} function in libpurple which returns the same thing. Always send a valid, normalized UID to CBPurpleAccount when dealing with participants, and always use the full name value if available. Fixes renaming of contacts, etc., in Jabber chats, and makes the code a good amount better.
Zachary West <zacw@adiumx.com>
parents: 1453
diff changeset
   904
	AIListContact *contact = [self contactWithUID:user];
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   905
	
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   906
	AIGroupChatFlags oldFlags = [chat flagsForContact:contact];
2231
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   907
	NSString *oldAlias = [chat aliasForContact:contact];
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   908
	
2231
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   909
	// Trigger an update if the alias or flags (ignoring away state) changes.
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   910
	if ((alias && !oldAlias)
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   911
		|| (!alias && oldAlias)
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   912
		|| ![[chat aliasForContact:contact] isEqualToString:alias]
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   913
		|| (flags & ~AIGroupChatAway) != (oldFlags & ~AIGroupChatAway)) {
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   914
		triggerUserlistUpdate = YES;
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   915
	}
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   916
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   917
	[chat setAlias:alias forContact:contact];
1406
2325566fd746 Use our formatted UID when passing the login to the server. Normalize any usernames sent to us by the server, so we actually update the user list for formatted contacts.
Zachary West <zacw@adiumx.com>
parents: 1405
diff changeset
   918
	[chat setFlags:flags forContact:contact];
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1381
diff changeset
   919
	
1743
152780e69a42 Overload the service icon for group chat cells to display the overall status of the contact. I can't imagine a situation where service icons would be useful to be displayed, and it's better then duplicating the effort. IRC contacts now have available or away status shown.
Zachary West <zacw@adiumx.com>
parents: 1740
diff changeset
   920
	// Away changes only come in after the initial one, so we're safe in only updating it here.
1744
c9c90bd9a424 Only apply the status state to strangers.
Zachary West <zacw@adiumx.com>
parents: 1743
diff changeset
   921
	if (contact.isStranger) {
c9c90bd9a424 Only apply the status state to strangers.
Zachary West <zacw@adiumx.com>
parents: 1743
diff changeset
   922
		[contact setStatusWithName:nil
c9c90bd9a424 Only apply the status state to strangers.
Zachary West <zacw@adiumx.com>
parents: 1743
diff changeset
   923
						statusType:((flags & AIGroupChatAway) == AIGroupChatAway) ? AIAwayStatusType : AIAvailableStatusType
c9c90bd9a424 Only apply the status state to strangers.
Zachary West <zacw@adiumx.com>
parents: 1743
diff changeset
   924
							notify:NotifyLater];
c9c90bd9a424 Only apply the status state to strangers.
Zachary West <zacw@adiumx.com>
parents: 1743
diff changeset
   925
	}
1743
152780e69a42 Overload the service icon for group chat cells to display the overall status of the contact. I can't imagine a situation where service icons would be useful to be displayed, and it's better then duplicating the effort. IRC contacts now have available or away status shown.
Zachary West <zacw@adiumx.com>
parents: 1740
diff changeset
   926
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   927
	for (NSString *key in attributes.allKeys) {
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   928
		[self setAttribute:key value:[attributes objectForKey:key] forContact:contact];
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   929
	}
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   930
	
1749
90ff6ee730e9 Never broadcast (unsilently) the status changes of chat participants.
Zachary West <zacw@adiumx.com>
parents: 1744
diff changeset
   931
	[contact notifyOfChangedPropertiesSilently:YES];
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   932
	
1768
ca5d99ba75ad Don't resort on away changes when updating a user.
Zachary West <zacw@adiumx.com>
parents: 1749
diff changeset
   933
	// Post an update notification if we modified the flags; don't resort for away changes.
2231
177b25c92580 Update the alias, if necessary, when updating a chat participant.
Zachary West <zacw@adium.im>
parents: 2227
diff changeset
   934
	if (triggerUserlistUpdate) {
1740
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   935
		[[NSNotificationCenter defaultCenter] postNotificationName:Chat_ParticipatingListObjectsChanged
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   936
															object:chat];
f5e4bfc98331 Expose and display the attributes of PurpleConvChatBuddies I added in [26956], namely userhost and realname for IRC contacts. On join, we WHO the channel, and store userhosts and realnames for users. I need to add a timeout to the IRC protocol to WHO regularly to get status and real names for users who joined, but that can come later.
Zachary West <zacw@adiumx.com>
parents: 1732
diff changeset
   937
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   938
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   939
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   940
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   941
 * @brief Called by Purple code when a chat should be opened by the interface
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   942
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   943
 * If the user sent an initial message, this will be triggered and have no effect.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   944
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   945
 * If a remote user sent an initial message, however, a chat will be created without being opened.  This call is our
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   946
 * cue to actually open chat.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   947
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   948
 * Another situation in which this is relevant is when we request joining a group chat; the chat should only be actually
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   949
 * opened once the server notifies us that we are in the room.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   950
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   951
 * This will ultimately call -[CBPurpleAccount openChat:] below if the chat was not previously open.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   952
 */
1351
a8048a3cf06d [26555] didn't actually fix the issue, it just made it random and worse. Opens #10189.
Zachary West <zacw@adiumx.com>
parents: 1348
diff changeset
   953
- (void)addChat:(AIChat *)chat
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   954
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   955
	AILogWithSignature(@"");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   956
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   957
	//Open the chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   958
	if ([chat isOpen]) {
1453
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
   959
		if ([chat boolValueForProperty:@"Rejoining Chat"]) {
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
   960
			[self displayYouHaveConnectedInChat:chat];
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
   961
			
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
   962
			[chat setValue:nil forProperty:@"Rejoining Chat" notify:NotifyNever];
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
   963
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   964
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   965
100
68210ab2807a sed is evil. All [adium *Controller]s are now adium.*Controller.
David Smith
parents: 95
diff changeset
   966
	[adium.interfaceController openChat:chat];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   967
	
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
   968
	[chat setValue:[NSNumber numberWithBool:YES] forProperty:@"accountJoined" notify:NotifyNow];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   969
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   970
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   971
//Open a chat for Adium
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   972
- (BOOL)openChat:(AIChat *)chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   973
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   974
	/* The #if 0'd block below causes crashes in msn_tooltip_text() on MSN */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   975
#if 0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   976
	AIListContact	*listContact;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   977
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   978
	//Obtain the contact's information if it's a stranger
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   979
	if ((listContact = chat.listObject) && (listContact.isStranger)) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   980
		[self delayedUpdateContactStatus:listContact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   981
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   982
#endif
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   983
	
426
837e43c8d35d I was hungry and didn't feel like working on hard stuff, so I did a bunch of propertyizing instead.
David Smith
parents: 393
diff changeset
   984
	AILog(@"purple openChat:%@ for %@",chat,chat.uniqueChatID);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   985
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   986
	//Inform purple that we have opened this chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   987
	[purpleAdapter openChat:chat onAccount:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   988
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   989
	//Created the chat successfully
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   990
	return YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   991
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   992
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   993
- (BOOL)closeChat:(AIChat*)chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   994
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   995
	[purpleAdapter closeChat:chat];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   996
	
2085
5a0c00a9ebe8 Only clear the typing flag for non-group chats.
Zachary West <zacw@adium.im>
parents: 2081
diff changeset
   997
	if (!chat.isGroupChat) {
5a0c00a9ebe8 Only clear the typing flag for non-group chats.
Zachary West <zacw@adium.im>
parents: 2081
diff changeset
   998
		//Be sure any remaining typing flag is cleared as the chat closes
5a0c00a9ebe8 Only clear the typing flag for non-group chats.
Zachary West <zacw@adium.im>
parents: 2081
diff changeset
   999
		[self setTypingFlagOfChat:chat to:nil];
5a0c00a9ebe8 Only clear the typing flag for non-group chats.
Zachary West <zacw@adium.im>
parents: 2081
diff changeset
  1000
	}
5a0c00a9ebe8 Only clear the typing flag for non-group chats.
Zachary West <zacw@adium.im>
parents: 2081
diff changeset
  1001
	
426
837e43c8d35d I was hungry and didn't feel like working on hard stuff, so I did a bunch of propertyizing instead.
David Smith
parents: 393
diff changeset
  1002
	AILog(@"purple closeChat:%@",chat.uniqueChatID);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1003
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1004
    return YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1005
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1006
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1007
- (void)chatWasDestroyed:(AIChat *)chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1008
{
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
  1009
	[adium.chatController accountDidCloseChat:chat];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1010
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1011
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1012
- (void)chatJoinDidFail:(AIChat *)chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1013
{
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
  1014
	[adium.chatController accountDidCloseChat:chat];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1015
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1016
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1017
/* 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1018
 * @brief Rejoin a chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1019
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1020
- (BOOL)rejoinChat:(AIChat *)chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1021
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1022
	[chat retain];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1023
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1024
	PurpleConversation *conv = [[chat identifier] pointerValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1025
	if (conv && conv->ui_data) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1026
		[(AIChat *)(conv->ui_data) release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1027
		conv->ui_data = NULL;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1028
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1029
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1030
	/* The identifier is how we associate a PurpleConversation with an AIChat.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1031
	 * Clear the identifier so a new PurpleConversation will be made. The ChatCreationInfo for the chat is still around, so it can join.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1032
	 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1033
	[chat setIdentifier:nil];
1453
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
  1034
	
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
  1035
	[chat setValue:[NSNumber numberWithBool:YES] forProperty:@"Rejoining Chat" notify:NotifyNever];
15a3eefe22d2 Only display "You Have Connected" in a chat if we were rejoining it. This can be called multiple times per join in multiple ways, so this is the only really good way to do it. Fixes #10189.
Zachary West <zacw@adiumx.com>
parents: 1442
diff changeset
  1036
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1037
	[purpleAdapter openChat:chat onAccount:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1038
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1039
	[chat autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1040
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1041
	//We don't get any immediate feedback as to our success; just return YES.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1042
	return YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1043
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1044
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1045
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1046
 * @brief A chat will be joined
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1047
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1048
 * This gives the account a chance to update any information in the chat's creation dictionary if desired.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1049
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1050
 * @result The final chat creation dictionary to use.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1051
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1052
- (NSDictionary *)willJoinChatUsingDictionary:(NSDictionary *)chatCreationDictionary
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1053
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1054
	return chatCreationDictionary;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1055
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1056
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1057
- (BOOL)chatCreationDictionary:(NSDictionary *)chatCreationDict isEqualToDictionary:(NSDictionary *)baseDict
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1058
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1059
	return [chatCreationDict isEqualToDictionary:baseDict];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1060
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1061
1158
bb42b16ad8f5 Sketch out a mechanism for chats not started directly from our UI (/join, invite accept) to figure out what their chat creation dicts should be. At the moment this only works for one key on irc channels, but it should be expandable to other protocols and keys. The duplication of code here is ugly, but I am unclear on how to improve it. Refs #11789
David Smith
parents: 1109
diff changeset
  1062
- (NSDictionary *)extractChatCreationDictionaryFromConversation:(PurpleConversation *)conv
bb42b16ad8f5 Sketch out a mechanism for chats not started directly from our UI (/join, invite accept) to figure out what their chat creation dicts should be. At the moment this only works for one key on irc channels, but it should be expandable to other protocols and keys. The duplication of code here is ugly, but I am unclear on how to improve it. Refs #11789
David Smith
parents: 1109
diff changeset
  1063
{
bb42b16ad8f5 Sketch out a mechanism for chats not started directly from our UI (/join, invite accept) to figure out what their chat creation dicts should be. At the moment this only works for one key on irc channels, but it should be expandable to other protocols and keys. The duplication of code here is ugly, but I am unclear on how to improve it. Refs #11789
David Smith
parents: 1109
diff changeset
  1064
	AILog(@"%@ needs an implementation of extractChatCreationDictionaryFromConversation to handle rejoins, bookmarks, and invitations properly", NSStringFromClass([self class]));
bb42b16ad8f5 Sketch out a mechanism for chats not started directly from our UI (/join, invite accept) to figure out what their chat creation dicts should be. At the moment this only works for one key on irc channels, but it should be expandable to other protocols and keys. The duplication of code here is ugly, but I am unclear on how to improve it. Refs #11789
David Smith
parents: 1109
diff changeset
  1065
	return nil;
bb42b16ad8f5 Sketch out a mechanism for chats not started directly from our UI (/join, invite accept) to figure out what their chat creation dicts should be. At the moment this only works for one key on irc channels, but it should be expandable to other protocols and keys. The duplication of code here is ugly, but I am unclear on how to improve it. Refs #11789
David Smith
parents: 1109
diff changeset
  1066
}
bb42b16ad8f5 Sketch out a mechanism for chats not started directly from our UI (/join, invite accept) to figure out what their chat creation dicts should be. At the moment this only works for one key on irc channels, but it should be expandable to other protocols and keys. The duplication of code here is ugly, but I am unclear on how to improve it. Refs #11789
David Smith
parents: 1109
diff changeset
  1067
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1068
- (AIChat *)chatWithContact:(AIListContact *)contact identifier:(id)identifier
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1069
{
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
  1070
	AIChat *chat = [adium.chatController chatWithContact:contact];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1071
	[chat setIdentifier:identifier];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1072
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1073
	return chat;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1074
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1075
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1076
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1077
- (AIChat *)chatWithName:(NSString *)name identifier:(id)identifier
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1078
{
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
  1079
	return [adium.chatController chatWithName:name identifier:identifier onAccount:self chatCreationInfo:nil];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1080
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1081
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1082
//Typing update in an IM
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1083
- (void)typingUpdateForIMChat:(AIChat *)chat typing:(NSNumber *)typingState
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1084
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1085
	[self setTypingFlagOfChat:chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1086
						   to:typingState];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1087
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1088
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1089
//Multiuser chat update
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1090
- (void)convUpdateForChat:(AIChat *)chat type:(NSNumber *)type
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1091
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1092
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1093
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1094
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1095
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1096
 * @brief Called when we are informed that we left a multiuser chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1097
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1098
- (void)leftChat:(AIChat *)chat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1099
{
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3343
diff changeset
  1100
	[chat setValue:nil forProperty:@"accountJoined" notify:NotifyNow];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1101
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1102
1292
761b05dfd208 Add a Topic template for message styles, which gets added into a <div> with id "topic" in group chats. Authors should do something like: <div contentEditable>%message%</div> (or span, or whatever) so that (in a future commit) topics can be edited. The substitutions are the same for AIContentMessages. %sender% could be nil, however, on initial join.
Zachary West <zacw@adiumx.com>
parents: 1267
diff changeset
  1103
- (void)updateTopic:(NSString *)inTopic forChat:(AIChat *)chat withSource:(NSString *)