~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to protocols/gadu/gaduaccount.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: c++-mode; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
 
2
//
 
3
// Copyright (C) 2003-2004 Grzegorz Jaskiewicz  <gj at pointblue.com.pl>
 
4
// Copyright (C) 2003 Zack Rusin                <zack@kde.org>
 
5
//
 
6
// gaduaccount.h
 
7
//
 
8
// This program is free software; you can redistribute it and/or
 
9
// modify it under the terms of the GNU General Public License
 
10
// as published by the Free Software Foundation; either version 2
 
11
// of the License, or (at your option) any later version.
 
12
//
 
13
// This program is distributed in the hope that it will be useful,
 
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
// GNU General Public License for more details.
 
17
//
 
18
// You should have received a copy of the GNU General Public License
 
19
// along with this program; if not, write to the Free Software
 
20
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
21
// 02110-1301, USA.
 
22
 
 
23
#ifndef GADUACCOUNT_H
 
24
#define GADUACCOUNT_H
 
25
 
 
26
#include "kopetepasswordedaccount.h"
 
27
#include "kopeteonlinestatus.h"
 
28
#include "kopetecontact.h"
 
29
 
 
30
#include "gaducontactlist.h"
 
31
#include "gadusession.h"
 
32
 
 
33
#include <libgadu.h>
 
34
 
 
35
#include <qhostaddress.h>
 
36
#include <qmap.h>
 
37
#include <qstring.h>
 
38
#include <kaction.h>
 
39
#include <kfiledialog.h>
 
40
 
 
41
class GaduAccountPrivate;
 
42
 
 
43
class GaduContact;
 
44
namespace Kopete { class Protocol; }
 
45
namespace Kopete { class Message; }
 
46
namespace Kopete { class StatusMessage; }
 
47
class KActionMenu;
 
48
class GaduDCC;
 
49
 
 
50
class GaduAccount : public Kopete::PasswordedAccount
 
51
{
 
52
        Q_OBJECT
 
53
 
 
54
public:
 
55
        GaduAccount( Kopete::Protocol*, const QString& accountID );
 
56
        ~GaduAccount();
 
57
        //{
 
58
        void setAway( bool isAway, const QString& awayMessage = QString() );
 
59
        virtual void fillActionMenu( KActionMenu *actionMenu );
 
60
        virtual bool hasCustomStatusMenu() const;
 
61
        void dccRequest( GaduContact* );
 
62
        void sendFile( GaduContact* , QString& );
 
63
        //}
 
64
        enum tlsConnection{ TLS_ifAvaliable = 0, TLS_only, TLS_no };
 
65
        unsigned int getPersonalInformation();
 
66
        bool publishPersonalInformation( ResLine& d );
 
67
 
 
68
public slots:
 
69
        //{
 
70
        void connectWithPassword(const QString &password);
 
71
        void disconnect( DisconnectReason );
 
72
        void disconnect();
 
73
        void setOnlineStatus( const Kopete::OnlineStatus& status , const Kopete::StatusMessage &reason = Kopete::StatusMessage(),
 
74
                              const OnlineStatusOptions& options = None );
 
75
        void setStatusMessage( const Kopete::StatusMessage& statusMessage );
 
76
        //}
 
77
 
 
78
        void changeStatus( const Kopete::OnlineStatus& status, const QString& descr = QString() );
 
79
        void slotLogin( int status = GG_STATUS_AVAIL, const QString& dscr = QString() );
 
80
        void slotLogoff();
 
81
        void slotGoOnline();
 
82
        void slotGoOffline();
 
83
        void slotGoInvisible();
 
84
        void slotGoBusy();
 
85
        void slotDescription();
 
86
        void slotSearch( int uin = 0);
 
87
 
 
88
        void removeContact( const GaduContact* );
 
89
 
 
90
        void addNotify( uin_t );
 
91
        void notify( uin_t*, int );
 
92
 
 
93
        void sendMessage( uin_t recipient, const Kopete::Message& msg,
 
94
                        int msgClass = GG_CLASS_CHAT );
 
95
 
 
96
        void error( const QString& title, const QString& message );
 
97
 
 
98
        void pong();
 
99
        void pingServer();
 
100
 
 
101
        // those two functions are connected straight to gadusession ones
 
102
        // with the same names/params. This was the easiest way to
 
103
        // make this interface public
 
104
        unsigned int pubDirSearch(  ResLine& query, int ageFrom, int ageTo, bool onlyAlive );
 
105
        void pubDirSearchClose();
 
106
 
 
107
        // tls
 
108
        tlsConnection useTls();
 
109
        void setUseTls( tlsConnection );
 
110
 
 
111
        // dcc
 
112
        bool dccEnabled();
 
113
        bool setDcc( bool );
 
114
 
 
115
        // anons
 
116
        bool ignoreAnons();
 
117
        void setIgnoreAnons( bool );
 
118
 
 
119
        // export list on change
 
120
        bool exportListOnChange();
 
121
        void setExportListOnChange( bool );
 
122
 
 
123
        // import list on startup
 
124
        bool importListOnLogin();
 
125
        void setImportListOnLogin( bool );
 
126
 
 
127
        // forFriends
 
128
        bool loadFriendsMode();
 
129
        void saveFriendsMode( bool );
 
130
 
 
131
signals:
 
132
        void pubDirSearchResult( const SearchResult&, unsigned int );
 
133
 
 
134
protected:
 
135
        //{
 
136
        bool createContact( const QString& contactId,
 
137
                        Kopete::MetaContact* parentContact );
 
138
        bool loadImportListOnLogin();
 
139
        bool loadExportListOnChange();
 
140
        void userListNotification(QString what);
 
141
        //}
 
142
 
 
143
private slots:
 
144
        void startNotify();
 
145
 
 
146
        void messageReceived( KGaduMessage* );
 
147
        void ackReceived( unsigned int );
 
148
        void contactStatusChanged( KGaduNotify* );
 
149
        void slotSessionDisconnect( Kopete::Account::DisconnectReason );
 
150
 
 
151
        void slotExportContactsList();
 
152
        void slotExportContactsListToFile();
 
153
        void slotImportContactsFromFile();
 
154
        void slotImportContactsList();
 
155
        void slotDeleteContactsList();
 
156
        void slotFriendsMode();
 
157
 
 
158
        void userlist( const QString& contacts );
 
159
        GaduContactsList* userlist();
 
160
        void slotUserlistSynch();
 
161
        
 
162
        void connectionFailed( gg_failure_t failure );
 
163
        void connectionSucceed( );
 
164
 
 
165
        void slotChangePassword();
 
166
 
 
167
        void slotCommandDone( const QString&, const QString& );
 
168
        void slotCommandError( const QString&, const QString& );
 
169
 
 
170
        void slotSearchResult( const SearchResult& result, unsigned int seq );
 
171
        void userListExportDone();
 
172
        void userListDeleteDone();
 
173
 
 
174
        void slotIncomingDcc( unsigned int );
 
175
 
 
176
private:
 
177
        void initConnections();
 
178
        void initActions();
 
179
        void dccOn();
 
180
        void dccOff();
 
181
        void userlistChanged();
 
182
 
 
183
        GaduAccountPrivate* p;
 
184
};
 
185
 
 
186
#endif