Plugins/Purple Service/adiumPurpleCore.m
author Robert Vehse <robertvehse@fastmail.fm>
Tue, 21 Mar 2017 20:36:54 +0100
branchadium-1.5.10.3
changeset 5952 395e617c3bdc
parent 5024 e3fd38fc6c95
permissions -rw-r--r--
For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
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 "adiumPurpleCore.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
e22ad6bc8b46 svn 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
#import "adiumPurpleAccounts.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
    20
#import "adiumPurpleBlist.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 "adiumPurpleConnection.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 "adiumPurpleConversation.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 "adiumPurpleDnsRequest.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 "adiumPurpleEventloop.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 "adiumPurpleFt.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 "adiumPurpleNotify.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 "adiumPurplePrivacy.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 "adiumPurpleRequest.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 "adiumPurpleRoomlist.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 "adiumPurpleSignals.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 "adiumPurpleWebcam.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 "adiumPurpleCertificateTrustWarning.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
e22ad6bc8b46 svn 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 <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
    35
#import "AILibpurplePlugin.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    36
#import <AIUtilities/AIFileManagerAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    37
#import <Adium/AIAccountControllerProtocol.h>
4328
12729561aef4 Clean up a lot of overincludes of <AIUtilities/AIApplicationAdditions.h>
Stephen Holt <sholt@adium.im>
parents: 4302
diff changeset
    38
#import <AIUtilities/AIApplicationAdditions.h>
3940
f121619ec7c0 Added facebook auth code to adium-space instead of libpurple-space
Evan Schoenberg
parents: 3928
diff changeset
    39
f121619ec7c0 Added facebook auth code to adium-space instead of libpurple-space
Evan Schoenberg
parents: 3928
diff changeset
    40
#warning This include and the jabber_auth_add_mech() will be part of the FacebookXMPP account's initialization
f121619ec7c0 Added facebook auth code to adium-space instead of libpurple-space
Evan Schoenberg
parents: 3928
diff changeset
    41
#import "auth.h"
f121619ec7c0 Added facebook auth code to adium-space instead of libpurple-space
Evan Schoenberg
parents: 3928
diff changeset
    42
f121619ec7c0 Added facebook auth code to adium-space instead of libpurple-space
Evan Schoenberg
parents: 3928
diff changeset
    43
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
    44
#pragma mark Debug
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    45
// Debug ------------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 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
static void adiumPurpleDebugPrint(PurpleDebugLevel level, const char *category, const char *debug_msg)
e22ad6bc8b46 svn 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
	//Log error
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
    49
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
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
    50
	if (!category) category = "general"; //Category can be 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
    51
	AILog(@"(Libpurple: %s) %s",category, debug_msg);
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
    52
    [pool drain];
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
    53
}
e22ad6bc8b46 svn 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
3081
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    55
static int adiumPurpleDebugIsEnabled(PurpleDebugLevel level, const char *category)
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    56
{
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    57
	return TRUE;
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    58
}
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    59
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
    60
static PurpleDebugUiOps adiumPurpleDebugOps = {
3081
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    61
    adiumPurpleDebugPrint,
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    62
    adiumPurpleDebugIsEnabled,
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    63
	
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    64
    /* _purple_reserved 1-4 */
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
    65
    NULL, NULL, NULL, 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
    66
};
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    67
e22ad6bc8b46 svn 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
PurpleDebugUiOps *adium_purple_debug_get_ui_ops(void)
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	return &adiumPurpleDebugOps;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
// Core ------------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
extern gboolean purple_init_ssl_plugin(void);
e22ad6bc8b46 svn 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
extern gboolean purple_init_ssl_openssl_plugin(void);
e22ad6bc8b46 svn 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
extern gboolean purple_init_ssl_cdsa_plugin(void);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    78
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    79
static void init_all_plugins()
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	AILog(@"adiumPurpleCore: load_all_plugins()");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    82
e22ad6bc8b46 svn 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
	//First, initialize our built-in plugins
e22ad6bc8b46 svn 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
	purple_init_ssl_plugin();
e22ad6bc8b46 svn 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
#ifdef HAVE_CDSA
e22ad6bc8b46 svn 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
	purple_init_ssl_cdsa_plugin();
e22ad6bc8b46 svn 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
#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
    88
	#ifdef HAVE_OPENSSL
e22ad6bc8b46 svn 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
		purple_init_ssl_openssl_plugin();
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    90
	#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
    91
		#warning No SSL plugin!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    92
	#endif
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    93
#endif
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    94
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    95
	//Load each plugin
166
a43b4310ef2a Updated most of our enumerations to fast enumerations, and did some paramaterization.
Evan Schoenberg
parents: 95
diff changeset
    96
	for (id <AILibpurplePlugin>	plugin in [SLPurpleCocoaAdapter libpurplePluginArray]) {
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
    97
		if ([plugin respondsToSelector:@selector(installLibpurplePlugin)]) {
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
    98
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
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
    99
			[plugin installLibpurplePlugin];
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
   100
            [pool drain];
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
   101
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   102
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   103
#ifdef HAVE_CDSA
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   104
	{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   105
		PurplePlugin *cdsa_plugin = purple_plugins_find_with_name("CDSA");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   106
		if(cdsa_plugin) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   107
			gboolean ok = 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
   108
			purple_plugin_ipc_call(cdsa_plugin, "register_certificate_ui_cb", &ok, adium_query_cert_chain);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   109
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   110
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   111
#endif
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   112
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   113
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   114
static void load_external_plugins(void)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   115
{
166
a43b4310ef2a Updated most of our enumerations to fast enumerations, and did some paramaterization.
Evan Schoenberg
parents: 95
diff changeset
   116
	//Load each plugin	
a43b4310ef2a Updated most of our enumerations to fast enumerations, and did some paramaterization.
Evan Schoenberg
parents: 95
diff changeset
   117
	for (id <AILibpurplePlugin>	plugin in [SLPurpleCocoaAdapter libpurplePluginArray]) {
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
   118
		if ([plugin respondsToSelector:@selector(loadLibpurplePlugin)]) {
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
   119
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
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
   120
			[plugin loadLibpurplePlugin];
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
   121
            [pool drain];
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
   122
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   123
	}	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   124
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   125
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   126
static void adiumPurplePrefsInit(void)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   127
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   128
    //Disable purple away handling - we do it ourselves
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   129
	purple_prefs_set_bool("/purple/away/away_when_idle", FALSE);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   130
	purple_prefs_set_string("/purple/away/auto_reply","never");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   131
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   132
	//Disable purple idle reporting - we do it ourselves
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   133
	purple_prefs_set_bool("/purple/away/report_idle", FALSE);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   134
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   135
    //Disable purple conversation logging
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   136
    purple_prefs_set_bool("/purple/logging/log_chats", FALSE);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   137
    purple_prefs_set_bool("/purple/logging/log_ims", FALSE);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   138
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   139
    //Typing preference
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   140
    purple_prefs_set_bool("/purple/conversations/im/send_typing", TRUE);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   141
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   142
	//Use server alias where possible
e22ad6bc8b46 svn 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
	purple_prefs_set_bool("/purple/buddies/use_server_alias", TRUE);
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
	//Ensure we are using caching
e22ad6bc8b46 svn 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
	purple_buddy_icons_set_caching(TRUE);	
e22ad6bc8b46 svn 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
3531
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   149
void configurePurpleDebugLogging()
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   150
{
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   151
	purple_debug_set_ui_ops(AIDebugLoggingIsEnabled() ?
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   152
							adium_purple_debug_get_ui_ops() :
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   153
							NULL);
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   154
}
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   155
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
   156
static void adiumPurpleCoreDebugInit(void)
e22ad6bc8b46 svn 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
{
5024
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   158
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   159
	
3531
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   160
	AILogWithSignature(@"");
d254fa9daa25 Fixed debug logging not to go to Console
Evan Schoenberg
parents: 3470
diff changeset
   161
	configurePurpleDebugLogging();
5024
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   162
	
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   163
	[pool 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
   164
}
e22ad6bc8b46 svn 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
static void associateLibpurpleAccounts(void)
e22ad6bc8b46 svn 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
{
166
a43b4310ef2a Updated most of our enumerations to fast enumerations, and did some paramaterization.
Evan Schoenberg
parents: 95
diff changeset
   168
	for (CBPurpleAccount *adiumAccount in adium.accountController.accounts) {
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
   169
		if ([adiumAccount isKindOfClass:[CBPurpleAccount class]]) {
166
a43b4310ef2a Updated most of our enumerations to fast enumerations, and did some paramaterization.
Evan Schoenberg
parents: 95
diff changeset
   170
			PurpleAccount *account = purple_accounts_find(adiumAccount.purpleAccountName, adiumAccount.protocolPlugin);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   171
			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
   172
				[(CBPurpleAccount *)account->ui_data 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
   173
				account->ui_data = [adiumAccount 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
   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
				[adiumAccount setPurpleAccount: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
   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
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   178
	}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
/* The core is ready... finish configuring libpurple and its plugins */
e22ad6bc8b46 svn 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
static void adiumPurpleCoreUiInit(void)
3054
b2062c21f7b5 Move gst and new gtype init to before libpurple init. Still infinite looping.
Zachary West <zacw@adium.im>
parents: 3047
diff changeset
   183
{
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
   184
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
   185
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
   186
	bindtextdomain("pidgin", [[[NSBundle bundleWithIdentifier:@"im.pidgin.libpurple"] resourcePath] fileSystemRepresentation]);
e22ad6bc8b46 svn 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
	bind_textdomain_codeset("pidgin", "UTF-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
   188
	textdomain("pidgin");
e22ad6bc8b46 svn 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
	
2883
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   190
	NSString *preferredLocale = [[[NSBundle bundleForClass:[SLPurpleCocoaAdapter class]] preferredLocalizations] objectAtIndex:0];
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   191
	
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   192
	// OS X-ism.. "pt" is Brazilian Portuguese, "pt_PT" is Portugal Portuguese.
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   193
	// However, libpurple delivers us localizations in the form of pt for pt_PT and pt_BR for pt.
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   194
	if ([preferredLocale isEqualToString:@"pt"]) {
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   195
		preferredLocale = @"pt_BR";
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   196
	} else if ([preferredLocale isEqualToString:@"pt_PT"]) {
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   197
		preferredLocale = @"pt";
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   198
	}
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   199
	
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   200
	AILog(@"Setting %@ as LC_ALL", preferredLocale);
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   201
	
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   202
	const char *preferredLocaleString = [preferredLocale 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
   203
	//We should be able to just do setlocale()... but it always returns NULL, which indicates failure
2883
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   204
	/* setlocale(LC_MESSAGES, preferredLocaleString); */
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   205
	
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
   206
	//So we'll set the environment variable for this process, which does work
2883
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   207
	setenv("LC_ALL", preferredLocaleString, /* overwrite? */ 1);
8319b6f89f25 Set LC_ALL to the locale libpurple uses for pt/pt_PT, which are not the same as they are treated on OS X. Refs #13377.
Zachary West <zacw@adium.im>
parents: 2873
diff changeset
   208
	setenv("LC_MESSAGES", preferredLocaleString, /* overwrite? */ 1);
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
   209
e22ad6bc8b46 svn 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
	//Initialize all external plugins.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   211
	init_all_plugins();
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
	AILog(@"adiumPurpleCoreUiInit");
e22ad6bc8b46 svn 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
	//Initialize the core UI ops
e22ad6bc8b46 svn 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
    purple_blist_set_ui_ops(adium_purple_blist_get_ui_ops());
e22ad6bc8b46 svn 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
    purple_connections_set_ui_ops(adium_purple_connection_get_ui_ops());
e22ad6bc8b46 svn 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
    purple_privacy_set_ui_ops (adium_purple_privacy_get_ui_ops());	
e22ad6bc8b46 svn 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
	purple_accounts_set_ui_ops(adium_purple_accounts_get_ui_ops());
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   219
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   220
	//Configure signals for receiving purple events
e22ad6bc8b46 svn 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
	configureAdiumPurpleSignals();
e22ad6bc8b46 svn 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
	//Associate each libpurple account with the appropriate Adium AIAccount.
e22ad6bc8b46 svn 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
	associateLibpurpleAccounts();
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   225
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   226
	/* Why use Purple's accounts and blist list when we have the information locally?
e22ad6bc8b46 svn 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
		*		- Faster account connection: Purple doesn't have to recreate the local 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
   228
		*		- Privacy/blocking support depends on the accounts and blist files existing
e22ad6bc8b46 svn 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
		*	Another possible advantage:
e22ad6bc8b46 svn 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
		*		- Using Purple's own buddy icon caching (which depends on both files) allows us to avoid
e22ad6bc8b46 svn 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
		*			re-requesting icons we already have locally on some protocols such as 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
   233
		*/	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   234
	//Setup the buddy list; then load the blist.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   235
	purple_set_blist(purple_blist_new());
e22ad6bc8b46 svn 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
	AILog(@"adiumPurpleCore: purple_blist_load()...");
e22ad6bc8b46 svn 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
	purple_blist_load();
e22ad6bc8b46 svn 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
	//Configure the GUI-related UI ops last
e22ad6bc8b46 svn 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
	purple_roomlist_set_ui_ops (adium_purple_roomlist_get_ui_ops());
e22ad6bc8b46 svn 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
    purple_notify_set_ui_ops(adium_purple_notify_get_ui_ops());
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   242
    purple_request_set_ui_ops(adium_purple_request_get_ui_ops());
e22ad6bc8b46 svn 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
	purple_xfers_set_ui_ops(adium_purple_xfers_get_ui_ops());
e22ad6bc8b46 svn 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
	purple_dnsquery_set_ui_ops(adium_purple_dns_request_get_ui_ops());
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   245
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   246
	adiumPurpleConversation_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
   247
	
e22ad6bc8b46 svn 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
	load_external_plugins();
3940
f121619ec7c0 Added facebook auth code to adium-space instead of libpurple-space
Evan Schoenberg
parents: 3928
diff changeset
   249
	
3943
f1ec1687f4f4 Added a AILibpurpleDidInitialize notification which is useful for performing actions once all libpurple plugins and prpsl are guaranteed to have been loaded.
Evan Schoenberg
parents: 3940
diff changeset
   250
	[[NSNotificationCenter defaultCenter] postNotificationName:AILibpurpleDidInitialize
f1ec1687f4f4 Added a AILibpurpleDidInitialize notification which is useful for performing actions once all libpurple plugins and prpsl are guaranteed to have been loaded.
Evan Schoenberg
parents: 3940
diff changeset
   251
														object:nil];
4061
396786e9e2b7 Wrap a number of our libpurple callback functions with autorelease pools, to help keep our memory footprint managed.
Stephen Holt <sholt@adium.im>
parents: 3943
diff changeset
   252
    [pool drain];
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
   253
}
e22ad6bc8b46 svn 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
static void adiumPurpleCoreQuit(void)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   256
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   257
    AILog(@"Core quit");
e22ad6bc8b46 svn 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
    exit(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
   259
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   260
e22ad6bc8b46 svn 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
static GHashTable *adiumPurpleCoreGetUiInfo(void)
e22ad6bc8b46 svn 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
{
5024
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   263
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   264
	
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
   265
	static GHashTable *ui_info = 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
   266
	if (!ui_info) {
2533
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   267
		ui_info = g_hash_table_new(g_str_hash, g_str_equal);
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   268
		g_hash_table_insert(ui_info, "name", "Adium");
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   269
		
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   270
		/* I have a vague recollection of a crash if we didn't g_strdup() this, but it really shouldn't be necessary.
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   271
		 * The ui_info stays in memory forever, anyways, so it hardly matters. -evands
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   272
		 */
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   273
		g_hash_table_insert(ui_info, "version", g_strdup([[NSApp applicationVersion] UTF8String])); 
4499
fe90d7000f7a Switched some adiumx.com links to adium.im. Added some "missing" wwws.
Adrian Godoroja <robotive@me.com>
parents: 4328
diff changeset
   274
		g_hash_table_insert(ui_info, "website", "http://www.adium.im");
2533
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   275
		g_hash_table_insert(ui_info, "dev_website", "http://trac.adium.im");
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   276
		g_hash_table_insert(ui_info, "client_type", "mac");
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   277
		
5952
395e617c3bdc For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
Robert Vehse <robertvehse@fastmail.fm>
parents: 5024
diff changeset
   278
		/* prpl-aim-distid is a distID for Adium, given to us by an AOL representative in March 2017.
395e617c3bdc For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
Robert Vehse <robertvehse@fastmail.fm>
parents: 5024
diff changeset
   279
		*/
395e617c3bdc For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
Robert Vehse <robertvehse@fastmail.fm>
parents: 5024
diff changeset
   280
		g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1721));
2533
4fcaa4d8c274 Set our distid for AOL as per their request
Evan Schoenberg
parents: 2082
diff changeset
   281
		g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1551));
2873
f436e1fe2e80 Sign up for a clientKey for Adium under my account.
Zachary West <zacw@adium.im>
parents: 2533
diff changeset
   282
		
5952
395e617c3bdc For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
Robert Vehse <robertvehse@fastmail.fm>
parents: 5024
diff changeset
   283
		/* prpl-aim-clientkey is a DevID (or "client key") for Adium, given to us by an AOL representative in March 2017.
395e617c3bdc For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
Robert Vehse <robertvehse@fastmail.fm>
parents: 5024
diff changeset
   284
		*/
395e617c3bdc For AIM, use the DevID and the distID supplied to us by an AOL representative in March 2017. Fixes #17097.
Robert Vehse <robertvehse@fastmail.fm>
parents: 5024
diff changeset
   285
		g_hash_table_insert(ui_info, "prpl-aim-clientkey", "do1z1yfXmOsnFBW6");
3928
1c791dbfec39 Use the devId from the AIR version of ICQ instead of the old one we had for both AIM and ICQ, which has stopped working for ICQ for unknown reasons.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3531
diff changeset
   286
		
1c791dbfec39 Use the devId from the AIR version of ICQ instead of the old one we had for both AIM and ICQ, which has stopped working for ICQ for unknown reasons.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3531
diff changeset
   287
		/* As our previous key doesn't work with ICQ anymore, and registering for a
1c791dbfec39 Use the devId from the AIR version of ICQ instead of the old one we had for both AIM and ICQ, which has stopped working for ICQ for unknown reasons.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3531
diff changeset
   288
		 * new one requires signing an agreement which contradicts the GPL on various
1c791dbfec39 Use the devId from the AIR version of ICQ instead of the old one we had for both AIM and ICQ, which has stopped working for ICQ for unknown reasons.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3531
diff changeset
   289
		 * points, we now use the key used by the offical AIR (Mac/Linux) client. */
1c791dbfec39 Use the devId from the AIR version of ICQ instead of the old one we had for both AIM and ICQ, which has stopped working for ICQ for unknown reasons.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3531
diff changeset
   290
		g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ic1-IIcaJnnNV5xA");
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
   291
	}
5024
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   292
	
e3fd38fc6c95 Added another couple of pools for good measure.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4499
diff changeset
   293
	[pool 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
   294
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   295
	return ui_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
   296
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   297
e22ad6bc8b46 svn 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
static PurpleCoreUiOps adiumPurpleCoreOps = {
e22ad6bc8b46 svn 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
    adiumPurplePrefsInit,
e22ad6bc8b46 svn 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
    adiumPurpleCoreDebugInit,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   301
    adiumPurpleCoreUiInit,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   302
    adiumPurpleCoreQuit,
3081
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
   303
	adiumPurpleCoreGetUiInfo,
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
   304
	
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
   305
	/* _purple_reserved 1-3 */
6388b2768ef1 Complete libpurple uiops struct initializers in AdiumLibpurple.framework
Stephen Holt <sholt@adium.im>
parents: 3054
diff changeset
   306
	NULL, NULL, 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
   307
};
e22ad6bc8b46 svn 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
PurpleCoreUiOps *adium_purple_core_get_ops(void)
e22ad6bc8b46 svn 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
	return &adiumPurpleCoreOps;
e22ad6bc8b46 svn 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
}