summaryrefslogtreecommitdiffstats
path: root/kopete/kopete/kopeteiface.h
blob: 46a521663920a8b2135c493f31804111a5bd3167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
    kopeteiface.h - Kopete DCOP Interface

    Copyright (c) 2002 by Hendrik vom Lehn       <hennevl@hennevl.de>

    Kopete    (c) 2002-2003      by the Kopete developers  <kopete-devel@kde.org>

    *************************************************************************
    *                                                                       *
    * This program is free software; you can redistribute it and/or modify  *
    * it under the terms of the GNU General Public License as published by  *
    * the Free Software Foundation; either version 2 of the License, or     *
    * (at your option) any later version.                                   *
    *                                                                       *
    *************************************************************************
*/

#ifndef KopeteIface_h
#define KopeteIface_h

#include <dcopobject.h>
#include <tqstringlist.h>
#include <kurl.h>

#include "kopeteonlinestatus.h"

/**
 * DCOP interface for kopete
 */
class KopeteIface : virtual public DCOPObject
{
	K_DCOP

public:
	KopeteIface();

k_dcop:
	TQStringList contacts();
	TQStringList reachableContacts();
	TQStringList onlineContacts();
	TQStringList fileTransferContacts();
	TQStringList contactFileProtocols(const TQString &displayName);

	/*void sendFile(const TQString &displayName, const KURL &sourceURL,
		const TQString &altFileName = TQString::null, uint fileSize = 0);*/

	// FIXME: Do we *need* this one? Sounds error prone to me, because
	// nicknames can contain parentheses too.
	// Better add a contactStatus( const TQString id ) I'd say - Martijn
	TQStringList contactsStatus();

	/**
	 * Open a chat to a contact, and optionally set some initial text
	 */
	TQString messageContact( const TQString &contactId, const TQString &messageText = TQString::null );

	/**
	 * Describe the status of a contact by their metaContactId,
	 * aka their uid in KABC.
	 */
	TQString onlineStatus( const TQString &metaContactId );

	/**
	 * Message a contact by their metaContactId, aka their uid in KABC.
	 */
	void messageContactById( const TQString &metaContactId );

	/**
	 * Adds a contact with the specified params.
	 *
	 * @param protocolName The name of the protocol this contact is for ("ICQ", etc)
	 * @param accountId The account ID to add the contact to
	 * @param contactId The unique ID for this protocol
	 * @param displayName The displayName of the contact (may equal userId for some protocols
	 * @param groupName The name of the group to add the contact to
	 * @return Weather or not the contact was added successfully
	 */
	bool addContact( const TQString &protocolName, const TQString &accountId, const TQString &contactId,
		const TQString &displayName, const TQString &groupName = TQString::null );

	/**
	 * return a list of alls accounts.
	 * form: XXXProtocol||AccountId
	 */
	TQStringList accounts();

	/**
	 * connect a given account in the given protocol
	 */
	void connect(const TQString &protocolName, const TQString &accountId);
	/**
	 * disconnect a given account in the given protocol
	 */
	void disconnect(const TQString &protocolName, const TQString &accountId);

	/**
	 * Ask all accounts to connect
	 */
	void connectAll();

	/**
	 * Ask all accounts to disconnect
	 */
	void disconnectAll();

	/**
	 * load a plugin
	 * the name is the name of the library: example: kopete_msn
	 * but you can ommit the kopete_ prefix
	 */
	bool loadPlugin( const TQString& name );
	/**
	 * unload a plugin
	 * the name is the name of the library: example: kopete_msn
	 * but you can ommit the kopete_ prefix
	 */
	bool unloadPlugin( const TQString& name );

	/**
	 * set all account away using the global away function
	 */
	void setAway();

	/**
	 * set all account away using the global away function
	 * and set an away message
	 */
	void setAway( const TQString &msg ) { setAway( msg, true ); }

	/**
	 * set all account away using the global away function
	 * and set an away message.
	 * @param away decides if the message is away/non-away
	 */
	void setAway( const TQString &msg, bool away );

	/**
	 * set Available all accountes
	 */
	void setAvailable();
	/**
	 * set all account away using the auto away funciton.
	 * accounts will return online if activity is detected again
	 */
	void setAutoAway();

	/**
	 * set the global nickname if global identity is enabled.
	 * @param nickname the new global nickname
	 */
	void setGlobalNickname( const TQString &nickname );

	/**
	 * set the global photo if global identity is enabled.
	 * @param photoUrl URL to the photo
	 */
	void setGlobalPhoto( const KURL &photoUrl );
    
    /**
     * get the contactIds for a given display name
     * @param displayName
     */
    TQStringList contactsForDisplayName( const TQString & displayName );

    /**
     * get the metacontactIds that have the given contactId
     * @param contactId
     */
    TQStringList metacontactsForContactId( const TQString & contactId );
};

#endif



/*
 * Local variables:
 * c-indentation-style: k&r
 * c-basic-offset: 8
 * indent-tabs-mode: t
 * End:
 */
// vim: set noet ts=4 sts=4 sw=4: