Plugins/Purple Service/CBPurpleOscarAccount.m
author Thijs Alkemade <me@thijsalkema.de>
Thu, 23 Mar 2017 22:20:36 +0100
branchadium-1.5.10.3
changeset 5976 a752b22eb698
parent 5750 dad5f3048dc3
permissions -rw-r--r--
Switch to the new preference for client_login, remove dependency on proxy.
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 "CBPurpleOscarAccount.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
#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
    19
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    20
#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
    21
#import <Adium/AIContactControllerProtocol.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 <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
    23
#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
    24
#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
    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/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
    27
#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
    28
#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
    29
#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
    30
#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
    31
#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
    32
#import <AIUtilities/AIDateFormatterAdditions.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 <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
    34
#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
    35
#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
    36
3120
bb6ae18089d0 Remove global scoping in CBPurpleOscarAccount.
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
    37
#import <libkern/OSAtomic.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
    38
e22ad6bc8b46 svn 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
#define DELAYED_UPDATE_INTERVAL			2.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
    40
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: 75
diff changeset
    41
@interface CBPurpleOscarAccount ()
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
    42
- (NSString *)stringByProcessingImgTagsForDirectIM:(NSString *)inString forContactWithUID:(const char *)who;
3869
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
    43
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
    44
// migration from 1.4.1 to 1.4.2
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
    45
- (void)migrateSSL;
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
@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
    47
e22ad6bc8b46 svn 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
@implementation CBPurpleOscarAccount
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (const char*)protocolPlugin
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	NSLog(@"WARNING: Subclass must override");
e22ad6bc8b46 svn 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
    return "";
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
3870
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    56
- (void)initAccount
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    57
{
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    58
	// Migrate from SSL/no SSL to the tri-state radio button
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    59
	if (![self preferenceForKey:PREFERENCE_ENCRYPTION_TYPE group:GROUP_ACCOUNT_STATUS]) {
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    60
		AILogWithSignature(@"Migrating %@ to new encryption settings", self);
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    61
		[self migrateSSL];
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    62
		[self setPreference:nil forKey:PREFERENCE_SSL_CONNECTION group:GROUP_ACCOUNT_STATUS];
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    63
	}
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    64
	
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    65
	[super initAccount];
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    66
}
1e977a7abdba Migrate when initialising an account, don't wait until it connects.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3869
diff changeset
    67
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
#pragma mark AIListContact and AIService special cases for OSCAR
e22ad6bc8b46 svn 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
//Override contactWithUID to mark mobile and ICQ users as such via the displayServiceID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    70
- (AIListContact *)contactWithUID:(NSString *)sourceUID
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    71
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    72
	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
    73
	
e22ad6bc8b46 svn 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
	if (!namesAreCaseSensitive) {
e22ad6bc8b46 svn 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
		sourceUID = [sourceUID compactedString];
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 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
	
89
a9e58c43be6c Propertyize, synthesize, and use fast enumeration in a few places
David Smith
parents: 84
diff changeset
    78
	contact = [adium.contactController existingContactWithService: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
    79
															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
    80
																UID:sourceUID];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    81
	if (!contact) {		
89
a9e58c43be6c Propertyize, synthesize, and use fast enumeration in a few places
David Smith
parents: 84
diff changeset
    82
		contact = [adium.contactController contactWithService:[self _serviceForUID:sourceUID]
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
    83
														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
    84
															UID:sourceUID];
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 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
	
e22ad6bc8b46 svn 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
	return 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
    88
}
e22ad6bc8b46 svn 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
995
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    90
- (void)configurePurpleAccount
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    91
{
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    92
	[super configurePurpleAccount];
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    93
	
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    94
	purple_account_set_bool(account, "always_use_rv_proxy", [[self preferenceForKey:PREFERENCE_FT_PROXY_SERVER
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    95
																			  group:GROUP_ACCOUNT_STATUS] boolValue]);
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
    96
	
3303
bdf6043f7816 Add a preference for AIM: allow multiple sign in locations defaulting to true. Fixes #5790, initial patch from Josh Perry.
Frank Dowsett <wixardy@adium.im>
parents: 3291
diff changeset
    97
	purple_account_set_bool(account, "allow_multiple_logins", [[self preferenceForKey:PREFERENCE_ALLOW_MULTIPLE_LOGINS
bdf6043f7816 Add a preference for AIM: allow multiple sign in locations defaulting to true. Fixes #5790, initial patch from Josh Perry.
Frank Dowsett <wixardy@adium.im>
parents: 3291
diff changeset
    98
																				group:GROUP_ACCOUNT_STATUS] boolValue]);
3869
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
    99
	
5976
a752b22eb698 Switch to the new preference for client_login, remove dependency on proxy.
Thijs Alkemade <me@thijsalkema.de>
parents: 5750
diff changeset
   100
	purple_account_set_string(account, "login_type", "client_login");
3869
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   101
	
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   102
	if ([[self preferenceForKey:PREFERENCE_ENCRYPTION_TYPE group:GROUP_ACCOUNT_STATUS] isEqualToString:PREFERENCE_ENCRYPTION_TYPE_OPPORTUNISTIC]) {
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   103
		purple_account_set_string(account, "encryption", "opportunistic_encryption");
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   104
	} else if ([[self preferenceForKey:PREFERENCE_ENCRYPTION_TYPE group:GROUP_ACCOUNT_STATUS] isEqualToString:PREFERENCE_ENCRYPTION_TYPE_REQUIRED]) {
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   105
		purple_account_set_string(account, "encryption", "require_encryption");
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   106
	} else {
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   107
		purple_account_set_string(account, "encryption", "no_encryption");
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   108
	}
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   109
}
4017
e071ecbbe9bb Don't use client login for OSCAR accounts if a proxy is configured. Worksaround #15137. Fixes #15137.
Evan Schoenberg
parents: 3870
diff changeset
   110
    
3869
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   111
- (void)migrateSSL
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   112
{
e9f94c290817 Change ICQ and AIM encryption settings to no/opportunistic/required encryption.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3574
diff changeset
   113
	// ICQ and AIM should override this
995
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   114
}
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   115
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   116
- (BOOL)encrypted
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   117
{
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   118
	return self.online && [self secureConnection];
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   119
}
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   120
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   121
- (PurpleSslConnection *)secureConnection {
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   122
	PurpleConnection *gc = purple_account_get_connection(self.purpleAccount);
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   123
	
996
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   124
	if(gc) {
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   125
		OscarData *oscarData = (OscarData *)gc->proto_data;	
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   126
		
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   127
		if(oscarData) {
997
516704587ca4 Last try on [26197] - we need to iterate over all of the {{{oscar_connections}}} to find any SSL connections. Certain Oscar connections (buddy icons, etc) are required to use non-SSL connections, and may be the head of the GSList. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 996
diff changeset
   128
			for(GSList *oscarConnections = oscarData->oscar_connections; oscarConnections; oscarConnections = g_slist_next(oscarConnections)) {
516704587ca4 Last try on [26197] - we need to iterate over all of the {{{oscar_connections}}} to find any SSL connections. Certain Oscar connections (buddy icons, etc) are required to use non-SSL connections, and may be the head of the GSList. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 996
diff changeset
   129
				FlapConnection *flapConnection = (FlapConnection *)oscarConnections->data;
516704587ca4 Last try on [26197] - we need to iterate over all of the {{{oscar_connections}}} to find any SSL connections. Certain Oscar connections (buddy icons, etc) are required to use non-SSL connections, and may be the head of the GSList. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 996
diff changeset
   130
				
516704587ca4 Last try on [26197] - we need to iterate over all of the {{{oscar_connections}}} to find any SSL connections. Certain Oscar connections (buddy icons, etc) are required to use non-SSL connections, and may be the head of the GSList. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 996
diff changeset
   131
				if(flapConnection->gsc) {
516704587ca4 Last try on [26197] - we need to iterate over all of the {{{oscar_connections}}} to find any SSL connections. Certain Oscar connections (buddy icons, etc) are required to use non-SSL connections, and may be the head of the GSList. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 996
diff changeset
   132
					return flapConnection->gsc;
516704587ca4 Last try on [26197] - we need to iterate over all of the {{{oscar_connections}}} to find any SSL connections. Certain Oscar connections (buddy icons, etc) are required to use non-SSL connections, and may be the head of the GSList. Refs #9553.
Zachary West <zacw@adiumx.com>
parents: 996
diff changeset
   133
				}
996
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   134
			}
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   135
		}
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   136
	}
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   137
	
aef527a2c7d8 Fixes [26197] with some help from '''darkrain42''': instead of accessing random locations in memory to determine if we're connected via SSL, return the correct location. Corrects the problem I noted in [26197], refs #9553.
Zachary West <zacw@adiumx.com>
parents: 995
diff changeset
   138
	return NULL;
995
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   139
}
ef567c351ef6 Adds two Oscar UI options:
Zachary West <zacw@adiumx.com>
parents: 838
diff changeset
   140
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
   141
- (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
   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
	AIService	*contactService;
e22ad6bc8b46 svn 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
	NSString	*contactServiceID = 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
   145
	
e22ad6bc8b46 svn 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
	const char	firstCharacter = ([contactUID length] ? [contactUID characterAtIndex:0] : '\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
   147
e22ad6bc8b46 svn 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
	//Determine service based on 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
   149
	if ([contactUID hasSuffix:@"@mac.com"]) {
e22ad6bc8b46 svn 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
		contactServiceID = @"libpurple-oscar-Mac";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   151
	} else if ([contactUID hasSuffix:@"@me.com"]) {
e22ad6bc8b46 svn 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
		contactServiceID = @"libpurple-oscar-MobileMe";
e22ad6bc8b46 svn 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
	} else if (firstCharacter && (firstCharacter >= '0' && firstCharacter <= '9')) {
e22ad6bc8b46 svn 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
		contactServiceID = @"libpurple-oscar-ICQ";
e22ad6bc8b46 svn 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
	} 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
   156
		contactServiceID = @"libpurple-oscar-AIM";
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   158
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
   159
	contactService = [adium.accountController serviceWithUniqueID:contactServiceID];
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
   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
	return contactService;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   163
	
e22ad6bc8b46 svn 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
#pragma mark Account Connection
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   165
e22ad6bc8b46 svn 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
- (AIReconnectDelayType)shouldAttemptReconnectAfterDisconnectionError:(NSString **)disconnectionError
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	AIReconnectDelayType shouldAttemptReconnect = [super shouldAttemptReconnectAfterDisconnectionError:disconnectionError];
e22ad6bc8b46 svn 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
	if ([self lastDisconnectionReason] == PURPLE_CONNECTION_ERROR_INVALID_USERNAME) {
e22ad6bc8b46 svn 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
			shouldAttemptReconnect = AIReconnectNever;
e22ad6bc8b46 svn 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
			*disconnectionError = AILocalizedString(@"The screen name you entered is not registered. Check to ensure you typed it correctly. If it is a new name, you must register it at www.aim.com before you can use it.", "Invalid name on AIM");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   173
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   174
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   175
	return shouldAttemptReconnect;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   176
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   177
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: 2131
diff changeset
   178
- (NSString *)connectionStringForStep:(NSInteger)step
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
   179
{
e22ad6bc8b46 svn 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
	switch (step)
e22ad6bc8b46 svn 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
	{
e22ad6bc8b46 svn 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
		case 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
   183
			return AILocalizedString(@"Connecting",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
   184
			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
   185
		case 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
   186
			return AILocalizedString(@"Screen name sent",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
   187
			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
   188
		case 2:
e22ad6bc8b46 svn 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
			return AILocalizedString(@"Password sent",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
   190
			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
   191
		case 3:
e22ad6bc8b46 svn 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
			return AILocalizedString(@"Received authorization",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
   193
			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
   194
		case 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
   195
			return AILocalizedString(@"Connection established",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
   196
			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
   197
		case 5:
e22ad6bc8b46 svn 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
			return AILocalizedString(@"Finalizing connection",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
   199
			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
   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
	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
   203
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   204
e22ad6bc8b46 svn 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
#pragma mark Account status
e22ad6bc8b46 svn 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
- (const char *)purpleStatusIDForStatus:(AIStatus *)statusState
e22ad6bc8b46 svn 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
							arguments:(NSMutableDictionary *)arguments
e22ad6bc8b46 svn 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
	char	*statusID = 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
   210
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   211
	switch (statusState.statusType) {
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
   212
		case AIAvailableStatusType:
e22ad6bc8b46 svn 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
			statusID = OSCAR_STATUS_ID_AVAILABLE;
e22ad6bc8b46 svn 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
			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
   215
		case AIAwayStatusType:
e22ad6bc8b46 svn 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
			statusID = OSCAR_STATUS_ID_AWAY;
e22ad6bc8b46 svn 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
			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
   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
		case AIInvisibleStatusType:
e22ad6bc8b46 svn 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
			statusID = OSCAR_STATUS_ID_INVISIBLE;
e22ad6bc8b46 svn 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
			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
   222
			
e22ad6bc8b46 svn 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
		case AIOfflineStatusType:
e22ad6bc8b46 svn 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
			statusID = OSCAR_STATUS_ID_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
   225
			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
   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
	
e22ad6bc8b46 svn 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
	return statusID;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (BOOL)shouldSetITMSLinkForNowPlayingStatus
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	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
   234
}
e22ad6bc8b46 svn 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
#pragma mark Contact notes
e22ad6bc8b46 svn 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
-(NSString *)serversideCommentForContact:(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
   238
{	
e22ad6bc8b46 svn 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
	NSString *serversideComment = 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
   240
	
e22ad6bc8b46 svn 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
	if (purple_account_is_connected(account)) {
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   242
		const char  *uidUTF8String = [theContact.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
   243
		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
   244
		
e22ad6bc8b46 svn 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
		if ((buddy = purple_find_buddy(account, uidUTF8String))) {
e22ad6bc8b46 svn 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
			PurpleGroup   *g;
e22ad6bc8b46 svn 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
			char		*comment;
e22ad6bc8b46 svn 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
			OscarData   *od;
e22ad6bc8b46 svn 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
			if ((g = purple_buddy_get_group(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
   251
				(od = purple_account_get_connection(account)->proto_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
   252
				(comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), purple_buddy_get_name(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
   253
				gchar		*comment_utf8;
e22ad6bc8b46 svn 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
				
e22ad6bc8b46 svn 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
				comment_utf8 = purple_utf8_try_convert(comment);
e22ad6bc8b46 svn 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
				serversideComment = [NSString stringWithUTF8String:comment_utf8];
e22ad6bc8b46 svn 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
				g_free(comment_utf8);
e22ad6bc8b46 svn 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
				
e22ad6bc8b46 svn 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
				free(comment);
e22ad6bc8b46 svn 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
			}
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 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
	return serversideComment;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (void)preferencesChangedForGroup:(NSString *)group key:(NSString *)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
   268
							object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime
e22ad6bc8b46 svn 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
	[super preferencesChangedForGroup:group key:key object:object preferenceDict:prefDict firstTime:firstTime];
e22ad6bc8b46 svn 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
	
e22ad6bc8b46 svn 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
	if ([group isEqualToString:PREF_GROUP_NOTES]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   273
		//If the notification object is a listContact belonging to this account, update the serverside 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
   274
		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
   275
			[object isKindOfClass:[AIListContact class]] && 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   276
			[(AIListContact *)object 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
   277
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   278
			if ([key isEqualToString:@"Notes"]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   279
				NSString  *comment = [object preferenceForKey:@"Notes" 
744
e5fddfb8a3f8 Xcode keeps not showing up me important search results, apparently...
David Smith
parents: 721
diff changeset
   280
														group:PREF_GROUP_NOTES];
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
   281
				
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   282
				[[super purpleAdapter] OSCAREditComment:comment forUID:object.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
   283
			}			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   284
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   285
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   286
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   287
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   288
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   289
#pragma mark Delayed 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
   290
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   291
- (void)_performDelayedUpdates:(NSTimer *)timer
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   292
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   293
	if ([arrayOfContactsForDelayedUpdates count]) {
e22ad6bc8b46 svn 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
		AIListContact *theContact = [arrayOfContactsForDelayedUpdates objectAtIndex: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
   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
		[theContact setValue:[self serversideCommentForContact: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
   297
							 forProperty:@"Notes"
e22ad6bc8b46 svn 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
							 notify: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
   299
e22ad6bc8b46 svn 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
		//Request ICQ contacts' info to get the nickname
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   301
		const char *contactUIDUTF8String = [theContact.UID UTF8String];
1428
0e38be580ac1 Updated for libpurple 2.6.0mtn API changes
Evan Schoenberg
parents: 1381
diff changeset
   302
		if (oscar_util_valid_name_icq(contactUIDUTF8String)) {
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
			OscarData			*od;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   304
e22ad6bc8b46 svn 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
			if ((purple_account_is_connected(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
   306
				(od = purple_account_get_connection(account)->proto_data)) {
3291
a250b3f68d8a libpurple @ 72a1ab897368e57934b7b5d2e58e897e679efabe
Frank Dowsett <wixardy@adium.im>
parents: 3121
diff changeset
   307
				aim_icq_getalias(od, contactUIDUTF8String, FALSE, NULL);
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
			}
e22ad6bc8b46 svn 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
		}
e22ad6bc8b46 svn 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
		[arrayOfContactsForDelayedUpdates removeObjectAtIndex: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
   312
		
e22ad6bc8b46 svn 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
	} 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
   314
		[arrayOfContactsForDelayedUpdates release]; arrayOfContactsForDelayedUpdates = 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
   315
		[delayedSignonUpdateTimer invalidate]; [delayedSignonUpdateTimer release]; delayedSignonUpdateTimer = 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
   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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (void)gotGroupForContact:(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
   320
{
e22ad6bc8b46 svn 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
	if (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
   322
		if (!arrayOfContactsForDelayedUpdates) arrayOfContactsForDelayedUpdates = [[NSMutableArray alloc] init];
e22ad6bc8b46 svn 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
		[arrayOfContactsForDelayedUpdates addObject: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
   324
		
e22ad6bc8b46 svn 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
		if (!delayedSignonUpdateTimer) {
e22ad6bc8b46 svn 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
			delayedSignonUpdateTimer = [[NSTimer scheduledTimerWithTimeInterval:DELAYED_UPDATE_INTERVAL 
e22ad6bc8b46 svn 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
																		 target: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
   328
																	   selector:@selector(_performDelayedUpdates:) 
e22ad6bc8b46 svn 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
																	   userInfo: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
   330
																		repeats:YES] 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
   331
		}
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   333
}
e22ad6bc8b46 svn 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
2131
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   335
- (void)removeContacts:(NSArray *)objects fromGroups:(NSArray *)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
   336
{
2131
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   337
	for (AIListObject *object in objects) {
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   338
		BOOL completelyRemoving = YES;
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   339
		
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   340
		for (AIListGroup *group in object.groups) {
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   341
			if (![groups containsObject:group]) {
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   342
				completelyRemoving = NO;
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   343
				break;
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   344
			}
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   345
		}
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   346
		
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   347
		if (completelyRemoving) {
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   348
			//Stop any pending delayed updates for these objects
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   349
			[arrayOfContactsForDelayedUpdates removeObjectsInArray:objects];
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   350
		}
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   351
	}
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
   352
2131
0846c7e2b617 Contact list support for removing contacts in multiple groups.
Zachary West <zacw@adium.im>
parents: 1428
diff changeset
   353
	[super removeContacts:objects fromGroups: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
   354
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
#pragma mark File transfer
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (void)acceptFileTransferRequest:(ESFileTransfer *)fileTransfer
e22ad6bc8b46 svn 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
    [super acceptFileTransferRequest:fileTransfer];    
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
- (void)beginSendOfFileTransfer:(ESFileTransfer *)fileTransfer
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	[super _beginSendOfFileTransfer:fileTransfer];
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
- (void)rejectFileReceiveRequest:(ESFileTransfer *)fileTransfer
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
    [super rejectFileReceiveRequest:fileTransfer];    
e22ad6bc8b46 svn 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
- (void)cancelFileTransfer:(ESFileTransfer *)fileTransfer
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	[super cancelFileTransfer:fileTransfer];
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (BOOL)canSendFolders
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	return [super canSendFolders];
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
#pragma mark Messaging
e22ad6bc8b46 svn 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
 * @brief Can we send images for 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
   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
- (BOOL)canSendImagesForChat:(AIChat *)inChat
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   388
{	
812
3de38d362167 Propertyize
David Smith
parents: 744
diff changeset
   389
	if (inChat.isGroupChat) return NO;
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
   390
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   391
	OscarData *od = ((account && purple_account_get_connection(account)) ? purple_account_get_connection(account)->proto_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
   392
	if (od) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   393
		AIListObject *listObject = [inChat listObject];
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   394
		const char *contactUID = [listObject.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
   395
		aim_userinfo_t *userinfo = aim_locate_finduserinfo(od, 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
   396
		
e22ad6bc8b46 svn 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
		if (userinfo &&
1428
0e38be580ac1 Updated for libpurple 2.6.0mtn API changes
Evan Schoenberg
parents: 1381
diff changeset
   398
			oscar_util_name_compare(purple_account_get_username(account), contactUID) &&
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   399
			listObject.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
   400
			return ((userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) != 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
   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
		} 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
   403
			return 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
   404
		}
e22ad6bc8b46 svn 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
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   406
	} 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
   407
		return 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
   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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (NSString *)encodedAttributedString:(NSAttributedString *)inAttributedString forListObject:(AIListObject *)inListObject
3120
bb6ae18089d0 Remove global scoping in CBPurpleOscarAccount.
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
   412
{
3121
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   413
  static AIHTMLDecoder * encoderCloseFontTagsAttachmentsAsText = nil;
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   414
  
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   415
  if(!encoderCloseFontTagsAttachmentsAsText) {
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   416
	AIHTMLDecoder *newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   417
															  fontTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   418
														 closeFontTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   419
															 colorTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   420
															 styleTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   421
														encodeNonASCII:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   422
														  encodeSpaces:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   423
													 attachmentsAsText:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   424
											 onlyIncludeOutgoingImages:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   425
														simpleTagsOnly:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   426
														bodyBackground:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   427
												   allowJavascriptURLs:YES];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   428
	if(!OSAtomicCompareAndSwapPtrBarrier(nil, newEncoder, (void *)&encoderCloseFontTagsAttachmentsAsText))
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   429
	  [newEncoder release];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   430
	[encoderCloseFontTagsAttachmentsAsText setAllowAIMsubprofileLinks:YES];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   431
  }
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   432
  
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   433
  return ([inAttributedString length] ? [encoderCloseFontTagsAttachmentsAsText encodeHTML:inAttributedString imagesPath:nil] : 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
   434
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   435
e22ad6bc8b46 svn 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
- (NSString *)encodedAttributedStringForSendingContentMessage:(AIContentMessage *)inContentMessage
e22ad6bc8b46 svn 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
{		
e22ad6bc8b46 svn 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
	AIListObject		*inListObject = [inContentMessage destination];
813
046940c2b1bd Propertyize
David Smith
parents: 812
diff changeset
   439
	NSAttributedString	*inAttributedString = inContentMessage.message;
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
	NSString			*encodedString;
e22ad6bc8b46 svn 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
	
3121
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   442
  static AIHTMLDecoder * encoderCloseFontTags = nil;
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   443
  static AIHTMLDecoder * encoderGroupChat = nil;
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   444
  
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   445
  if(!(encoderCloseFontTags && encoderGroupChat)) {
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   446
	AIHTMLDecoder *newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   447
															  fontTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   448
														 closeFontTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   449
															 colorTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   450
															 styleTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   451
														encodeNonASCII:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   452
														  encodeSpaces:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   453
													 attachmentsAsText:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   454
											 onlyIncludeOutgoingImages:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   455
														simpleTagsOnly:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   456
														bodyBackground:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   457
												   allowJavascriptURLs:YES];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   458
	if(!OSAtomicCompareAndSwapPtrBarrier(nil, newEncoder, (void *)&encoderCloseFontTags))
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   459
	  [newEncoder release];
3120
bb6ae18089d0 Remove global scoping in CBPurpleOscarAccount.
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
   460
	
3121
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   461
	newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   462
											   fontTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   463
										  closeFontTags:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   464
											  colorTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   465
											  styleTags:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   466
										 encodeNonASCII:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   467
										   encodeSpaces:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   468
									  attachmentsAsText:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   469
							  onlyIncludeOutgoingImages:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   470
										 simpleTagsOnly:YES
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   471
										 bodyBackground:NO
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   472
									allowJavascriptURLs:YES];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   473
	if(!OSAtomicCompareAndSwapPtrBarrier(nil, newEncoder, (void *)&encoderGroupChat))
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   474
	  [newEncoder release];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   475
	
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   476
	[encoderCloseFontTags setAllowAIMsubprofileLinks:YES];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   477
	[encoderGroupChat setAllowAIMsubprofileLinks:YES];
cd004d7bd5d7 Ok, so I've been convinced to do this without blocking. Yay CAS funtimes!
Stephen Holt <sholt@adium.im>
parents: 3120
diff changeset
   478
  }
3120
bb6ae18089d0 Remove global scoping in CBPurpleOscarAccount.
Stephen Holt <sholt@adium.im>
parents: 3079
diff changeset
   479
	
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
   480
	if (inListObject) {
813
046940c2b1bd Propertyize
David Smith
parents: 812
diff changeset
   481
		if (inContentMessage.chat.isSecure &&
1428
0e38be580ac1 Updated for libpurple 2.6.0mtn API changes
Evan Schoenberg
parents: 1381
diff changeset
   482
			oscar_util_valid_name_icq([inContentMessage.source.UID UTF8String]) &&
0e38be580ac1 Updated for libpurple 2.6.0mtn API changes
Evan Schoenberg
parents: 1381
diff changeset
   483
			oscar_util_valid_name_icq([inListObject.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
   484
			/* If we're an ICQ account and they're an ICQ account, we need to strip HTML now since 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
   485
			 * encrypted message won't be able to be processed by libpurple */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   486
			encodedString = [[inAttributedString attributedStringByConvertingLinksToStrings] string];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   487
813
046940c2b1bd Propertyize
David Smith
parents: 812
diff changeset
   488
		} else if ([self canSendImagesForChat:inContentMessage.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
   489
			//Encode to HTML and look for outgoing images if the chat supports 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
   490
			encodedString = [encoderCloseFontTags encodeHTML:inAttributedString
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   491
												  imagesPath:@"/tmp"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   492
			
e22ad6bc8b46 svn 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
			if ([encodedString rangeOfString:@"<IMG " options:NSCaseInsensitiveSearch].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
   494
				/* There's an image... we need to see about a Direct Connect, aborting the send attempt if none is established 
e22ad6bc8b46 svn 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
				 * and sending after it is if one is established.
e22ad6bc8b46 svn 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
				 * Note that an encrypted session won't ever be able to succeed with a DirectIM at present, because
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   498
				 * libpurple only sees the encrypted message :(
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   499
				 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   500
				
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   501
				//Check for a PeerConnection for a direct IM currently 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
   502
				PeerConnection	*conn;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   503
				OscarData		*od = (OscarData *)purple_account_get_connection(account)->proto_data;
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   504
				const char		*who = [inListObject.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
   505
				
e22ad6bc8b46 svn 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
				conn = peer_connection_find_by_type(od, who, OSCAR_CAPABILITY_DIRECTIM);
e22ad6bc8b46 svn 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
				encodedString = [self stringByProcessingImgTagsForDirectIM:encodedString forContactWithUID:who];
e22ad6bc8b46 svn 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
				
e22ad6bc8b46 svn 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
				if ((conn != NULL) && (conn->ready)) {
e22ad6bc8b46 svn 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
					//We have a connected dim already; simply continue, and we'll be told to send it in a moment
e22ad6bc8b46 svn 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
					
e22ad6bc8b46 svn 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
				} 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
   514
					//Either no dim, or the dim we have is no longer conected (oscar_direct_im_initiate_immediately will reconnect 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
   515
					peer_connection_propose(od, OSCAR_CAPABILITY_DIRECTIM, who);
e22ad6bc8b46 svn 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
					
e22ad6bc8b46 svn 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
					//Add this content message to the sending queue for this contact to be sent once a connection is established
e22ad6bc8b46 svn 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
					if (!directIMQueue) directIMQueue = [[NSMutableDictionary alloc] init];
e22ad6bc8b46 svn 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
					
838
0f6dc3d1afd7 More dot syntax. Hooray regexes
David Smith
parents: 837
diff changeset
   520
					NSMutableArray	*thisContactQueue = [directIMQueue objectForKey:inListObject.internalObjectID];
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
   521
					if (!thisContactQueue) {
e22ad6bc8b46 svn 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
						thisContactQueue = [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
   523
						
e22ad6bc8b46 svn 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
						[directIMQueue setObject:thisContactQueue
838
0f6dc3d1afd7 More dot syntax. Hooray regexes
David Smith
parents: 837
diff changeset
   525
										  forKey:inListObject.internalObjectID];
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
   526
					}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   527
					
e22ad6bc8b46 svn 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
					[thisContactQueue addObject:inContentMessage];
e22ad6bc8b46 svn 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
				}
e22ad6bc8b46 svn 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
			}
e22ad6bc8b46 svn 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
		} 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
   532
			encodedString = [self encodedAttributedString:inAttributedString forListObject:inListObject];
e22ad6bc8b46 svn 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
		}
e22ad6bc8b46 svn 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
	} else { //Send HTML when signed in as an AIM account and we don't know what sort of user we are sending to (most likely 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
   536
		AILog(@"Encoding %@ for no contact",inAttributedString);
e22ad6bc8b46 svn 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
		encodedString = [encoderGroupChat encodeHTML:inAttributedString
e22ad6bc8b46 svn 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
										  imagesPath: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
   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
	return encodedString;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (BOOL)sendMessageObject:(AIContentMessage *)inContentMessage
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   546
	if (directIMQueue) {
e22ad6bc8b46 svn 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
		NSMutableArray	*thisContactQueue = [directIMQueue objectForKey:[[inContentMessage destination] internalObjectID]];
e22ad6bc8b46 svn 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
		if ([thisContactQueue containsObject:inContentMessage]) {
e22ad6bc8b46 svn 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
			//This message is in our queue of messages to send...
e22ad6bc8b46 svn 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
			PeerConnection	*conn;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   551
			OscarData		*od = (OscarData *)purple_account_get_connection(account)->proto_data;
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   552
			const char		*who = [inContentMessage.destination.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
   553
			
e22ad6bc8b46 svn 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
			conn = peer_connection_find_by_type(od, who, OSCAR_CAPABILITY_DIRECTIM);
e22ad6bc8b46 svn 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
			if ((conn != NULL) && (conn->ready)) {
e22ad6bc8b46 svn 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
				//We have a connected dim ready; send it!  We already displayed it, though, so don't do that.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   558
				[inContentMessage setDisplayContent: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
   559
				return [super sendMessageObject:inContentMessage];
e22ad6bc8b46 svn 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
			} 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
   561
				//Don't send now, as we'll do the actual send when the dim is connected, in directIMConnected: above, and return here.
e22ad6bc8b46 svn 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
				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
   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
		}
e22ad6bc8b46 svn 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
	
e22ad6bc8b46 svn 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
	BOOL success = [super sendMessageObject:inContentMessage];
e22ad6bc8b46 svn 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
	
e22ad6bc8b46 svn 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
	if (purpleImagesToUnref) {
e22ad6bc8b46 svn 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
		NSNumber	 *imgstoreNumber;
75
eb2d4c6c53c6 Preliminary conversion to using fast enumeration; caveats: variable declarations were not moved into loop headers. In *most* cases it should be safe to move them, but make sure the variable is not needed later on in the method. Also, AIContactController was not converted, because the conversion tool freaked out
David Smith
parents: 0
diff changeset
   571
		for (imgstoreNumber in purpleImagesToUnref) {
3078
1b883db24823 Resolve implicit 64->32 bit castings in AdiumLibpurple.framework. Add asserts to ensure sanity where needed.
Stephen Holt <sholt@adium.im>
parents: 2729
diff changeset
   572
			purple_imgstore_unref_by_id([imgstoreNumber 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
   573
		}
e22ad6bc8b46 svn 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
		
e22ad6bc8b46 svn 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
		[purpleImagesToUnref release]; purpleImagesToUnref = 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
   576
	}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
	return success;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
522
ec9d342516dc Allow the account to prevent sending an autoreply to a message. This moves some OSCAR-specific code to CBPurpleOscarAccount from AIAutoReplyPlugin and fixes IRC sending autoreplies to the connection bots.
Evan Schoenberg
parents: 153
diff changeset
   581
- (BOOL)shouldSendAutoreplyToMessage:(AIContentMessage *)message
ec9d342516dc Allow the account to prevent sending an autoreply to a message. This moves some OSCAR-specific code to CBPurpleOscarAccount from AIAutoReplyPlugin and fixes IRC sending autoreplies to the connection bots.
Evan Schoenberg
parents: 153
diff changeset
   582
{
ec9d342516dc Allow the account to prevent sending an autoreply to a message. This moves some OSCAR-specific code to CBPurpleOscarAccount from AIAutoReplyPlugin and fixes IRC sending autoreplies to the connection bots.
Evan Schoenberg
parents: 153
diff changeset
   583
	return ![[message.message string] hasPrefix:@"[Offline IM sent"];
ec9d342516dc Allow the account to prevent sending an autoreply to a message. This moves some OSCAR-specific code to CBPurpleOscarAccount from AIAutoReplyPlugin and fixes IRC sending autoreplies to the connection bots.
Evan Schoenberg
parents: 153
diff changeset
   584
}
ec9d342516dc Allow the account to prevent sending an autoreply to a message. This moves some OSCAR-specific code to CBPurpleOscarAccount from AIAutoReplyPlugin and fixes IRC sending autoreplies to the connection bots.
Evan Schoenberg
parents: 153
diff changeset
   585
ec9d342516dc Allow the account to prevent sending an autoreply to a message. This moves some OSCAR-specific code to CBPurpleOscarAccount from AIAutoReplyPlugin and fixes IRC sending autoreplies to the connection bots.
Evan Schoenberg
parents: 153
diff changeset
   586
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
   587
#pragma mark DirectIM (IM Image)
e22ad6bc8b46 svn 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
//We are now connected via DirectIM to 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
   589
- (void)directIMConnected:(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
   590
{
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   591
	AILog(@"Direct IM Connected: %@",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
   592
	
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
   593
	[adium.contentController displayEvent:AILocalizedString(@"Direct IM connected","Direct IM is an AIM-specific phrase for transferring images in the message window")
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
   594
									 ofType:@"directIMConnected"
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
   595
									 inChat:[adium.chatController chatWithContact:theContact]];
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
   596
e22ad6bc8b46 svn 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
	//Send any pending directIM messages for this contact
838
0f6dc3d1afd7 More dot syntax. Hooray regexes
David Smith
parents: 837
diff changeset
   598
	NSMutableArray	*thisContactQueue = [directIMQueue objectForKey:theContact.internalObjectID];
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
   599
	if (thisContactQueue) {
e22ad6bc8b46 svn 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
		AIContentObject	*contentObject;
e22ad6bc8b46 svn 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
		
75
eb2d4c6c53c6 Preliminary conversion to using fast enumeration; caveats: variable declarations were not moved into loop headers. In *most* cases it should be safe to move them, but make sure the variable is not needed later on in the method. Also, AIContactController was not converted, because the conversion tool freaked out
David Smith
parents: 0
diff changeset
   602
		for (contentObject in thisContactQueue) {
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
   603
			[adium.contentController sendContentObject:contentObject];
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
   604
		}
e22ad6bc8b46 svn 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
		
838
0f6dc3d1afd7 More dot syntax. Hooray regexes
David Smith
parents: 837
diff changeset
   606
		[directIMQueue removeObjectForKey:theContact.internalObjectID];
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
   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
		if (![directIMQueue count]) {
e22ad6bc8b46 svn 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
			[directIMQueue release]; directIMQueue = 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
   610
		}
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
- (void)directIMDisconnected:(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
   615
{
721
7a01f7df42eb Propertyize + build fix
David Smith
parents: 714
diff changeset
   616
	AILog(@"Direct IM Disconnected: %@",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
   617
	
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
   618
	[adium.contentController displayEvent:AILocalizedString(@"Direct IM disconnected","Direct IM is an AIM-specific phrase for transferring images in the message window")
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
   619
									 ofType:@"directIMDisconnected"
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 89
diff changeset
   620
									 inChat:[adium.chatController chatWithContact:theContact]];	
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
   621
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   622
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   623
- (NSString *)stringByProcessingImgTagsForDirectIM:(NSString *)inString forContactWithUID:(const char *)who
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   624
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   625
	NSScanner			*scanner;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   626
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   627
	static NSCharacterSet *elementEndCharacters = 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
   628
	if (!elementEndCharacters)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   629
		elementEndCharacters = [[NSCharacterSet characterSetWithCharactersInString:@" >"] 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
   630
	static NSString		*tagStart = @"<", *tagEnd = @">";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   631
	NSString			*chunkString;
e22ad6bc8b46 svn 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
	NSMutableString		*processedString;
e22ad6bc8b46 svn 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
    scanner = [NSScanner scannerWithString: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
   635
	[scanner setCaseSensitive: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
   636
    [scanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@""]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   637
	
e22ad6bc8b46 svn 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
	processedString = [[NSMutableString alloc] init];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   639
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   640
    //Parse the HTML
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   641
    while (![scanner isAtEnd]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   642
        //Find an HTML IMG tag
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   643
        if ([scanner scanUpToString:@"<img" intoString:&chunkString]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   644
			//Append the text leading up the the IMG tag; a directIM may have image tags inline with message text
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   645
            [processedString appendString:chunkString];
e22ad6bc8b46 svn 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
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   648
        //Look for the start of a tag
e22ad6bc8b46 svn 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
        if ([scanner scanString:tagStart intoString: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
   650
			//Get the tag itself
e22ad6bc8b46 svn 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
			if ([scanner scanUpToCharactersFromSet:elementEndCharacters intoString:&chunkString]) {
e22ad6bc8b46 svn 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
				if ([chunkString caseInsensitiveCompare:@"IMG"] == NSOrderedSame) {
e22ad6bc8b46 svn 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
					if ([scanner scanUpToString:tagEnd intoString:&chunkString]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   654
						
e22ad6bc8b46 svn 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
						//Load the src image
e22ad6bc8b46 svn 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
						NSDictionary	*imgArguments = [AIHTMLDecoder parseArguments:chunkString];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   657
						NSString		*source = [imgArguments objectForKey:@"src"];
e22ad6bc8b46 svn 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
						NSString		*alt = [imgArguments objectForKey:@"alt"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   659
						NSString		*filename;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   660
						NSData			*imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:source]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   661
						NSString		*extension;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   662
						BOOL			requiresConversionToJPEG = 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
   663
						
e22ad6bc8b46 svn 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
						//Store the src image's data purpleside
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   665
						filename = (alt ? alt : [source lastPathComponent]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   666
						
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   667
						extension = [filename pathExtension];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   668
						if (![extension 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
   669
							extension = [NSImage extensionForBitmapImageFileType:[NSImage fileTypeOfData:imageData]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   670
						
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   671
						if (([extension caseInsensitiveCompare:@"jpg"] != NSOrderedSame) &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   672
							([extension caseInsensitiveCompare:@"jpeg"] != NSOrderedSame) &&
e22ad6bc8b46 svn 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
							([extension caseInsensitiveCompare:@"gif"] != NSOrderedSame)) {							
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   674
							//Old versions of AIM for Windows only supports JPEG and GIF images, so we need to pick a format it does support.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   675
							OscarData			*od;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   676
							aim_userinfo_t		*userinfo;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   677
							
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   678
							if (purple_account_is_connected(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
   679
								(od = purple_account_get_connection(account)->proto_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
   680
								(userinfo = aim_locate_finduserinfo(od, who))) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   681
								/* There's no explicit AIM for Windows capability, but only AIM for Windows advertises AOL's AIM games.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   682
								 * Not all AIM for Windows clients advertise those, though. OSCAR_CAPABILITY_ADDINS is only advertised
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   683
								 * by official AIM clients, so it's a good sensitive-but-not-specific test.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   684
								 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   685
								if ((userinfo->capabilities & OSCAR_CAPABILITY_GAMES) ||
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   686
									(userinfo->capabilities & OSCAR_CAPABILITY_GAMES2) ||
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   687
									(userinfo->capabilities & OSCAR_CAPABILITY_ADDINS)) 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   688
									requiresConversionToJPEG = 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
   689
							}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   690
						}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   691
						
e22ad6bc8b46 svn 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
						if (requiresConversionToJPEG) {
e22ad6bc8b46 svn 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
							NSImage				*image = [[NSImage alloc] initWithData:imageData];
e22ad6bc8b46 svn 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
							
3078
1b883db24823 Resolve implicit 64->32 bit castings in AdiumLibpurple.framework. Add asserts to ensure sanity where needed.
Stephen Holt <sholt@adium.im>
parents: 2729
diff changeset
   695
							imageData = [[[image JPEGRepresentationWithCompressionFactor:1.0f] retain] autorelease];
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
   696
							extension = @"jpg";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   697
							[image 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
   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
						} else if (![extension 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
   700
							//We don't know what we're working with. Try to produce a PNG so we know the format.
e22ad6bc8b46 svn 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
							NSImage				*image = [[NSImage alloc] initWithData:imageData];
e22ad6bc8b46 svn 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
							
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   703
							imageData = [[[image PNGRepresentation] 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
   704
							extension = @"png";
e22ad6bc8b46 svn 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
							[image 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
   706
						}
e22ad6bc8b46 svn 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
						//Delete any existing wrong extension
e22ad6bc8b46 svn 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
						if ([[filename pathExtension] caseInsensitiveCompare:extension] != NSOrderedSame) 
e22ad6bc8b46 svn 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
							filename = [filename stringByDeletingPathExtension];
e22ad6bc8b46 svn 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
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   712
						//Add the right extension if needed
e22ad6bc8b46 svn 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
						if (![[filename pathExtension] 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
   714
							filename = [filename stringByAppendingPathExtension:extension];
e22ad6bc8b46 svn 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
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: 2131
diff changeset
   716
						NSUInteger imgBytesLength = [imageData 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
   717
						gpointer imgBytes = malloc(imgBytesLength);
e22ad6bc8b46 svn 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
						[imageData getBytes:imgBytes];
e22ad6bc8b46 svn 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
						/* purple_imgstore_add_with_id() will take ownership of imgBytes and free it when done*/
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: 2131
diff changeset
   720
						NSInteger	imgstore = purple_imgstore_add_with_id(imgBytes, imgBytesLength, [filename 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
   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
						AILog(@"Adding image id %i with name %s", imgstore, (filename ? [filename UTF8String] : "(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
   723
						
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   724
						NSString		*newTag = [NSString stringWithFormat:@"<IMG ID=\"%i\" CLASS=\"scaledToFitImage\">",imgstore];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   725
						[processedString appendString:newTag];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   726
						
e22ad6bc8b46 svn 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
						if (!purpleImagesToUnref) purpleImagesToUnref = [[NSMutableSet alloc] init];
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: 2131
diff changeset
   728
						[purpleImagesToUnref addObject:[NSNumber numberWithInteger:imgstore]];
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
   729
					}
e22ad6bc8b46 svn 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
				
e22ad6bc8b46 svn 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
				if (![scanner isAtEnd]) {
e22ad6bc8b46 svn 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
					[scanner setScanLocation:[scanner scanLocation]+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
   734
				}
e22ad6bc8b46 svn 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
			}
e22ad6bc8b46 svn 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
		}
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 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
	
e22ad6bc8b46 svn 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
	return ([processedString 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
#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
   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
 * @brief Should set aliases serverside?
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   746
 *
e22ad6bc8b46 svn 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
 * AIM and ICQ support serverside aliases.
e22ad6bc8b46 svn 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
 */
e22ad6bc8b46 svn 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
- (BOOL)shouldSetAliasesServerside
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	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
   752
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   753
e22ad6bc8b46 svn 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
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   755
* @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
   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
- (void)updateStatusForContact:(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
   758
				  toStatusType:(NSNumber *)statusTypeNumber
e22ad6bc8b46 svn 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
					statusName:(NSString *)statusName
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: 3303
diff changeset
   760
				 statusMessage:(NSAttributedString *)inStatusMessage
153
640a1705a59a We don't need a separate method for setting isMobile
Evan Schoenberg
parents: 95
diff changeset
   761
					  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
   762
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   763
	/* XXX - Giant hack!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   764
	 * Libpurple, as of 2.0.0 but not before so far as we've seen, sometimes feeds us truncated AIM away messages.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   765
	 * The full message will then follow... followed by the truncated one... and so on. This makes the message
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   766
	 * change in the buddy list and in the message window repeatedly.
3574
c78ad2850051 Fix typos in comments.
Robert Vehse
parents: 3380
diff changeset
   767
	 * I'm not sure how long the truncated versions are - I've seen 40 to 70 characters.  We'll therefore ignore
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
   768
	 * an incoming message which is the same as the first 40 characters of the existing one.  I wonder how long
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   769
	 * before someone will notice this "odd" behavior and file a bug report... -evands
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   770
	 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   771
	 
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: 2131
diff changeset
   772
	if ((theContact.statusType == [statusTypeNumber integerValue]) &&
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   773
		((statusName && !theContact.statusName) || [theContact.statusName isEqualToString:statusName])) {
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
   774
		//Type and name match...
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   775
		NSString *currentStatusMessage = [theContact statusMessageString];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   776
		if (currentStatusMessage &&
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: 3303
diff changeset
   777
			([currentStatusMessage length] > [inStatusMessage length]) &&
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: 3303
diff changeset
   778
			([inStatusMessage length] >= 40) &&
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: 3303
diff changeset
   779
			([currentStatusMessage rangeOfString:[inStatusMessage string] options:NSAnchoredSearch].location == 0)) {
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
   780
			/* New message is shorter but at least 40 characters, and it matches the start of the current one.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   781
			 * Do nothing.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   782
			 */
e22ad6bc8b46 svn 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
			return;
e22ad6bc8b46 svn 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
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   785
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   786
	
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: 3303
diff changeset
   787
	[super updateStatusForContact:theContact toStatusType:statusTypeNumber statusName:statusName statusMessage:inStatusMessage isMobile: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
   788
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   789
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   790
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   791
 * @brief Is a contact on the contact list intentionally listed?
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   792
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   793
 * This is used by AIListContact to determine if the prescence of itself on the list is indicative of a degree
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   794
 * of trust, for preferences such as "automatically accept files from contacts on my contact list".
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   795
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   796
- (BOOL)isContactIntentionallyListed:(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
   797
{
714
2b8014f97fd4 Remove the -remoteGroupName property from AIListContact, fix another place to be multigroups-aware
David Smith
parents: 660
diff changeset
   798
	//if the only group it's in is recent buddies, it's not intentionally listed
1381
3c8a27044cb4 Assorted remote grouping related changes. .remoteGroupNames is now *actually* a copy property rather than just claiming to be, and various other things are (I think) more correct.
David Smith
parents: 998
diff changeset
   799
	return !(contact.countOfRemoteGroupNames == 1 && [contact.remoteGroupNames containsObject:@"Recent Buddies"]);
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
   800
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   801
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   802
- (NSString *)localizedDateAndTimeFromString:(NSString *)inDateAndTime includeTimeWithDay:(BOOL)includeTimeWithDay
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   803
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   804
	NSString		*replacementString = 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
   805
	struct tm tm;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   806
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   807
	if (inDateAndTime && (strptime([inDateAndTime UTF8String], "%c", &tm) != NULL)) {
4356
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   808
		__block NSString	*valueDay, *valueTime;
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
   809
		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
   810
		/* Not set by strptime(); tells mktime()
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   811
		 * to determine whether daylight saving 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
   812
		 * is in 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
   813
		tm.tm_isdst = -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
   814
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   815
		date = [NSDate dateWithTimeIntervalSince1970:mktime(&tm)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   816
e22ad6bc8b46 svn 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
		//Get day & time strings
4356
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   818
		[NSDateFormatter withLocalizedDateFormatterPerform:^(NSDateFormatter *dayFormatter){
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   819
			valueDay = [[dayFormatter stringForObjectValue:date] retain];
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   820
		}];
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   821
		[NSDateFormatter withLocalizedDateFormatterShowingSeconds:NO showingAMorPM:YES perform:^(NSDateFormatter *timeFormatter) {
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   822
			valueTime = [[timeFormatter stringForObjectValue:date] retain];
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   823
		}];
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
   824
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   825
		if (valueDay && valueTime) {
4356
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   826
			__block BOOL cond;
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   827
			
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   828
			[NSDateFormatter withLocalizedDateFormatterPerform:^(NSDateFormatter *dayFormatter){
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   829
				cond = [[dayFormatter stringForObjectValue:[NSDate date]] isEqualToString:valueDay];
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   830
			}];
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   831
			
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   832
			if (cond)
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
   833
				//Show 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
   834
				replacementString = valueTime;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   835
			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
   836
				replacementString = (includeTimeWithDay ? [NSString stringWithFormat:@"%@, %@", valueDay, valueTime] : valueDay);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   837
		}
4356
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   838
		
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   839
		[valueDay release];
a0d4ead5c91e Use a serial dispatch queue for all shared localized NSDateFormatter uses.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4017
diff changeset
   840
		[valueTime 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
   841
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   842
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   843
	return replacementString;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   844
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   845
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: 522
diff changeset
   846
- (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
   847
{
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: 522
diff changeset
   848
	NSMutableArray *array = [super arrayOfDictionariesFromPurpleNotifyUserInfo:user_info forContact: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
   849
	NSString *onlineSinceKey = [NSString stringWithUTF8String:_("Online Since")];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   850
	NSString *memberSinceKey = [NSString stringWithUTF8String:_("Member Since")];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   851
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: 2131
diff changeset
   852
	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: 2131
diff changeset
   853
	NSUInteger count = [array count];
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
   854
	for (i = 0; i < count; i++) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   855
		NSDictionary *dict = [array objectAtIndex:i];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   856
		NSString *key = [dict objectForKey: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
   857
		if ([key isEqualToString:onlineSinceKey]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   858
			NSString *replacementString = [self localizedDateAndTimeFromString:[dict objectForKey: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
   859
															includeTimeWithDay: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
   860
			if (replacementString) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   861
				NSMutableDictionary *replacementDict = [dict 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
   862
				[replacementDict setObject:replacementString 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
   863
				[array replaceObjectAtIndex:i withObject:replacementDict];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   864
				[replacementDict 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
   865
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   866
		} else if ([key isEqualToString:memberSinceKey]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   867
			[array removeObjectAtIndex:i];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   868
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   869
			//Decrement i so we look at the next item rather than skipping 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
   870
			i--;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   871
			count--;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   872
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   873
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   874
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   875
	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
   876
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   877
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   878
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   879
#pragma mark Contact List Menu Items
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   880
- (NSString *)titleForContactMenuLabel:(const char *)label forContact:(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
   881
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   882
	if (strcmp(label, _("Edit Buddy Comment")) == 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
   883
		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
   884
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   885
	} else if (strcmp(label, _("Re-request Authorization")) == 0) {
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   886
		return [NSString stringWithFormat:AILocalizedString(@"Re-request Authorization from %@",nil),inContact.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
   887
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   888
	} else 	if (strcmp(label, _("Get AIM Info")) == 0) {
2729
d63ecb31443c Patch from roman to remove the redundant 'Get AIM Information for <buddy>' context menu item. Fixes #11904.
Zachary West <zacw@adium.im>
parents: 2693
diff changeset
   889
		//Handled via Get Info
d63ecb31443c Patch from roman to remove the redundant 'Get AIM Information for <buddy>' context menu item. Fixes #11904.
Zachary West <zacw@adium.im>
parents: 2693
diff changeset
   890
		return 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
   891
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   892
	} else if (strcmp(label, _("Direct IM")) == 0) {
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 813
diff changeset
   893
		return [NSString stringWithFormat:AILocalizedString(@"Initiate Direct IM with %@",nil),inContact.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
   894
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   895
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   896
	return [super titleForContactMenuLabel:label forContact: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
   897
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   898
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   899
#pragma mark Account Action Menu Items
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   900
- (NSString *)titleForAccountActionMenuLabel:(const char *)label
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   901
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   902
	if (strcmp(label, _("Set User Info...")) == 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
   903
		//Handled via Get 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
   904
		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
   905
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   906
	} else if (strcmp(label, _("Edit Buddy Comment")) == 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
   907
		//Handled via Get 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
   908
		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
   909
	} else if (strcmp(label, _("Show Buddies Awaiting Authorization")) == 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
   910
		return AILocalizedString(@"Show Contacts Awaiting Authorization", "Account action menu item to show a list of contacts for whom this account is awaiting authorization to be able to show them in the contact list");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   911
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   912
	} else if (strcmp(label, _("Configure IM Forwarding (URL)")) == 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
   913
		return [AILocalizedString(@"Configure IM Forwarding", nil) stringByAppendingEllipsis];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   914
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   915
	} else if (strcmp(label, _("Change Password (URL)")) == 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
   916
		//There's no reason to have the URL version available - we have Change Password for in-app changing.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   917
		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
   918
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   919
	} else if (strcmp(label, _("Display Currently Registered E-Mail Address")) == 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
   920
		return AILocalizedString(@"Display Currently Registered Email Address", 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
   921
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   922
	} else if (strcmp(label, _("Change Currently Registered E-Mail Address...")) == 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
   923
		return [AILocalizedString(@"Change Currently Registered Email Address", nil) stringByAppendingEllipsis];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   924
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   925
	} else if (strcmp(label, _("Search for Buddy by E-Mail Address...")) == 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
   926
		return [AILocalizedString(@"Search for Contact By Email Address", nil) stringByAppendingEllipsis];		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   927
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   928
	} else if (strcmp(label, _("Set User Info (URL)...")) == 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
   929
		return [AILocalizedString(@"Set User Info", nil) stringByAppendingEllipsis];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   930
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   931
	} else if (strcmp(label, _("Set Privacy Options...")) == 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
   932
		return [AILocalizedString(@"Set Privacy Options", nil) stringByAppendingEllipsis];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   933
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   934
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   935
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   936
	return [super titleForAccountActionMenuLabel:label];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   937
}
e22ad6bc8b46 svn 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
#pragma mark Buddy status
e22ad6bc8b46 svn 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
- (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
   941
{
e22ad6bc8b46 svn 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
	NSString		*statusName = 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
   943
	
1428
0e38be580ac1 Updated for libpurple 2.6.0mtn API changes
Evan Schoenberg
parents: 1381
diff changeset
   944
	if (oscar_util_valid_name_icq(purple_buddy_get_name(buddy))) {
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
   945
		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
   946
		PurpleStatus *status = purple_presence_get_active_status(presence);
e22ad6bc8b46 svn 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
		const char *purpleStatusID = purple_status_get_id(status);
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
		if (!strcmp(purpleStatusID, OSCAR_STATUS_ID_INVISIBLE)) {
e22ad6bc8b46 svn 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
			statusName = STATUS_NAME_INVISIBLE;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
		} else if (!strcmp(purpleStatusID, OSCAR_STATUS_ID_OCCUPIED)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   953
			statusName = STATUS_NAME_OCCUPIED;
e22ad6bc8b46 svn 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
		} else if (!strcmp(purpleStatusID, OSCAR_STATUS_ID_NA)) {
e22ad6bc8b46 svn 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
			statusName = STATUS_NAME_NOT_AVAILABLE;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
		} else if (!strcmp(purpleStatusID, OSCAR_STATUS_ID_DND)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   959
			statusName = STATUS_NAME_DND;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   960
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   961
		} else if (!strcmp(purpleStatusID, OSCAR_STATUS_ID_FREE4CHAT)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   962
			statusName = STATUS_NAME_FREE_FOR_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
   963
e22ad6bc8b46 svn 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
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   966
e22ad6bc8b46 svn 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
	return statusName;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   968
}
e22ad6bc8b46 svn 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
@end