-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmrimaccount.h
202 lines (143 loc) · 5.76 KB
/
mrimaccount.h
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#ifndef MRIMACCOUNT_H
#define MRIMACCOUNT_H
#include <kopete/kopeteaccount.h>
#include "mra/mraprotocol.h"
class MrimProtocol;
class MRAProtocol;
class MRAContactList;
class MRAOfflineMessage;
class TransferRequestInfo;
class KActionMenu;
namespace Kopete {
class Message;
}
class MrimAccount : public Kopete::Account
{
Q_OBJECT
public:
explicit MrimAccount( MrimProtocol *parent, const QString& accountID );
~MrimAccount();
/**
* @brief Create a New Contact
*
* Creates a protocol specific Kopete::Contact subclass and adds it to the supplied
* Kopete::MetaContact
* This is called internally only, as contacts cannot be added manually
*
* @return @c true if the contact is created, @c false otherwise
*/
virtual bool createContact(const QString& contactId, Kopete::MetaContact* parentContact);
/**
* @brief Called when Kopete is set globally away
*
* @todo FIXME: This Doesn't Do Anything Right Now
*/
virtual void setAway(bool away, const QString& reason);
/**
* @brief Parse The Config File
*
* This Function parses the appropriate group in the kopeterc
* It sets come internally used constants like @ref username, @ref emailAddress
*/
void parseConfig();
/**
* @brief Called when Kopete status is changed globally
*
* @todo FIXME: This Only Makes us go online or offline, we cannot go away
*/
virtual void setOnlineStatus(const Kopete::OnlineStatus& status , const Kopete::StatusMessage &reason = Kopete::StatusMessage(),
const OnlineStatusOptions& options = None);
virtual void setStatusMessage(const Kopete::StatusMessage& statusMessage);
/**
* @brief Custom action menu
*/
void fillActionMenu( KActionMenu *actionMenu );
/**
* @brief 'Connect' to the MRIM service.
*
* This the one stop call to do everything, like starting server, publishing, discovery, etc
* This will clear the contact list in the beginning, and start re populating it
* @todo Do something with initialStatus
*
* @param initialStatus
*/
virtual void connect( const Kopete::OnlineStatus& initialStatus = Kopete::OnlineStatus() );
/**
* @brief Disconnect from the service.
*
* This will disconnect from the service. It will stop everything started in connect
* It cleans out the contact list after it is finished
*/
virtual void disconnect();
Q_PROPERTY(QByteArray username READ getUsername WRITE setUsername)
void setUsername(const QByteArray &arg);
const QByteArray getUsername() const;
Q_PROPERTY(QByteArray password READ getPassword WRITE setPassword)
void setPassword(const QByteArray &arg);
const QByteArray getPassword() const;
Q_PROPERTY(QByteArray protocolVersion READ getProtocolVersion WRITE setProtocolVersion)
void setProtocolVersion(const QByteArray &arg);
const QByteArray getProtocolVersion() const;
void sendMessage(const QString &to, const QString &text);
void loadChatMembersList(const QString &to);
void inviteMemberToChat(const QString &to, const QString &contactIdToInvite);
void removeMemberFromChat(const QString &to, const QString &contactIdToInvite);
void contactTypingAMessage( const QString &to );
void loadAvatar( const QString &email );
void loadPhoto( const QString &email, QObject *receiver, const char *member );
void loadUserInfo( const QString &email );
void deleteContact( const QString &email );
void renameContact( const QString &email, const QString &newName );
void moveContactToGroup( const QString &email, const QString &newGroupName );
int getGroupIdByName( const QString &groupName );
int addGroupAndReturnId(const QString groupName);
MRAProtocol *getMraProtocol();
signals:
public slots:
/**
* @brief Change the account's status. Called by KActions and internally.
*/
void slotGoOnline();
/**
* @brief Change the account's status. Called by KActions and internally.
*
* @todo FIXME: This Does Nothing Useful
*/
void slotGoAway();
/**
* @brief Change the account's status. Called by KActions and internally.
*/
void slotGoOffline();
void slotGoBusy();
void slotReceivedMessage( const QString &from, const QString &text );
void slotReceivedOfflineMessage( const MRAOfflineMessage &message );
void slotTypingAMessage( const QString &from );
void requestForAuthorization( const QString &contact );
/**
* @brief Trggers add group task. Called from status menu.
*/
void addGroup();
/**
* @brief Trggers create a new conference task. Called from status menu.
*/
void addConference();
private slots:
void slotReceivedContactList(const MRAContactList &list);
void slotConnected();
void slotDisconnected(const QString &reason);
void slotLoginFailed(const QString &reason);
void authorizeRequestReceived(const QString &from, const QString &text);
void slotUserStatusChanged(const QString &user, int newStatus);
void slotAvatarLoaded(const QString &contact, const QImage &image);
void slotUserInfoLoaded(const QString &contact, const MRAContactInfo &info);
void slotAddContactAckReceived(int status, int contactId);
void slotChatSettingsReceived(const QString &chat, const MRAConferenceSettings &settings);
void slotChatInvitationReceived(const QString &chat, const QString &title, const QString &from);
void slotTransferRequest(const TransferRequestInfo &transferInfo);
void slotTransferRequestCancelled(const TransferRequestInfo &transferInfo);
private:
class Private;
Private *d;
Kopete::OnlineStatus mrimStatusToKopete(int mrimStatus);
};
#endif // MRIMACCOUNT_H