forked from dmacvicar/kopete-facebook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfacebookaccount.h
176 lines (143 loc) · 4.4 KB
/
facebookaccount.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
/*
Kopete Facebook Protocol implementation
This code is not associated with Facebook in any way.
Copyright (c) 2009 Duncan Mac-Vicar P. <[email protected]>
Kopete (c) 2002-2009 by the Kopete developers <[email protected]>
*************************************************************************
* *
* This library 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 FACEBOOKACCOUNT_H
#define FACEBOOKACCOUNT_H
#include "kopetepasswordedaccount.h"
#include "facebook/chatservice.h"
class KActionMenu;
namespace Kopete
{
class Contact;
class MetaContact;
class StatusMessage;
}
class FacebookProtocol;
class FacebookContact;
using Facebook::ChatMessage;
using Facebook::BuddyInfo;
/**
* A Facebook account with its own session
* @author Duncan Mac-Vicar P. <[email protected]>
*/
class FacebookAccount : public Kopete::PasswordedAccount
{
Q_OBJECT
public:
FacebookAccount( FacebookProtocol *parent, const QString& accountID );
~FacebookAccount();
/**
* return contact with id
*/
FacebookContact *contact( const QString &id );
/**
* Construct the context menu used for the status bar icon
*/
virtual void fillActionMenu( KActionMenu *actionMenu );
/**
* Creates a protocol specific Kopete::Contact subclass and adds it to the supplie
* Kopete::MetaContact
*/
virtual bool createContact(const QString& contactId, Kopete::MetaContact* parentContact);
/**
* Called when Kopete is set globally away
*/
virtual void setAway(bool away, const QString& reason);
/**
* Called when Kopete status is changed globally
*/
virtual void setOnlineStatus(const Kopete::OnlineStatus& status , const Kopete::StatusMessage &reason = Kopete::StatusMessage(),
const OnlineStatusOptions& options = None);
virtual void setStatusMessage(const Kopete::StatusMessage& statusMessage);
/**
* Connect to the server
*/
virtual void connectWithPassword (const QString & password);
/**
* Disconnect from the server. Only sets myself() offline.
*/
virtual void disconnect();
/**
* Facebook service session
*/
Facebook::ChatService *service();
protected:
Facebook::ChatService *m_service;
protected slots:
/**
* login to server completed
*/
void slotLoginToServiceFinished();
/**
* login to server failed
*/
void slotLoginToServiceError();
/**
* login to server completed
*/
void slotLogoutFromServiceFinished();
/**
* login to server failed
*/
void slotLogoutFromServiceError();
/**
* a message is available
*/
void slotMessageAvailable( const ChatMessage &message );
/**
* a message is ack available
*/
void slotMessageAckAvailable( const ChatMessage &message );
/**
* a message is ack available
*/
void slotMessageErrorAvailable( const ChatMessage &message );
/**
* buddy on available list
*/
void slotBuddyAvailable( const BuddyInfo &buddy, bool idle );
/**
* buddy on available list
*/
void slotBuddyNotAvailable( const BuddyInfo &buddy );
/**
* a buddy is known
*/
void slotBuddyInformation( const BuddyInfo &buddy );
/**
* picture available
*/
void slotBuddyThumbAvailable( const QString &buddyid, const QImage &image );
/**
* Change the account's status. Called by KActions and internally.
*/
void slotGoOnline();
/**
* Change the account's status. Called by KActions and internally.
*/
void slotGoAway();
/**
* Change the account's status. Called by KActions and internally.
*/
void slotGoOffline();
/**
* someone is typing
*/
void slotTypingEventAvailable( const QString &from, const QString &to );
/**
* something bad happened
*/
void slotError( Facebook::ChatService::ErrorType error, const QString &desc );
};
#endif