Bonjour nick name is in Latin1 encoding
[kdenetwork.git] / kopete / protocols / meanwhile / meanwhileaccount.h
blob8c26fe4cab4b4bba3582c21bf4504edafccb5d4f
1 /*
2 meanwhileaccount.h - meanwhile account
4 Copyright (c) 2003-2004 by Sivaram Gottimukkala <suppandi@gmail.com>
5 Copyright (c) 2005 by Jeremy Kerr <jk@ozlabs.org>
7 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 *************************************************************************
18 #ifndef MEANWHILEACCOUNT_H
19 #define MEANWHILEACCOUNT_H
21 #include <kopetepasswordedaccount.h>
22 #include "meanwhileprotocol.h"
23 #include "meanwhileplugin.h"
25 class MeanwhileSession;
27 /**
28 * A class to handle a single Meanwhile Account.
30 class MeanwhileAccount : public Kopete::PasswordedAccount
32 Q_OBJECT
33 public:
34 /**
35 * Create a new Meanwhile account
36 * @param protocol The MeanwhileProtocol that this acccount is for
37 * @param accountID The (meanwhile) account id of this account
39 MeanwhileAccount(MeanwhileProtocol *protocol, const QString &accountID);
41 ~MeanwhileAccount();
43 bool createContact(const QString &contactId,
44 Kopete::MetaContact *parentContact);
46 void connectWithPassword(const QString &password);
48 void disconnect();
49 void disconnect(Kopete::Account::DisconnectReason reason);
51 void fillActionMenu( KActionMenu *actionMenu );
53 /** Get the server host name */
54 QString getServerName();
55 /** Get the server port */
56 int getServerPort();
57 /** Set the server host name */
58 void setServerName(const QString &server);
59 /** Set the server port */
60 void setServerPort(int port);
61 /** Provide an information plugin for this account */
62 void setPlugin(MeanwhilePlugin *plugin);
64 /** Set the client identification parameters for the sametime connection */
65 void setClientID(int client, int major, int minor);
67 /** Returns true if custom IDs are in use, and populates the args */
68 bool getClientIDParams(int *clientID, int *verMajor, int *verMinor);
70 /** Reset client identification parameters to their defaults */
71 void resetClientID();
73 /** Set the 'force login' flag, to ignore server redirect messages */
74 void setForceLogin(bool force);
76 /** Returns the state of the 'force login' option */
77 bool getForceLogin();
79 MeanwhilePlugin *infoPlugin;
81 /**
82 * Save the current contact list to the server
84 void syncContactsToServer();
86 /**
87 * Get a reference to the meanwhile session object, if one exists
89 MeanwhileSession *session();
91 /**
92 * Get the meanwhile id for this account
93 * @return The meanwhile ID for the account
95 QString meanwhileId() const;
97 public slots:
98 /**
99 * Called by the session to notify that the state has changed
101 void slotSessionStateChange(Kopete::OnlineStatus status);
104 * Called by the session when a notification message has been received
106 void slotServerNotification(const QString &mesg);
108 /** \reimp */
109 void setStatusMessage(const Kopete::StatusMessage &statusMessage);
111 /** Reimplemented from Kopete::Account */
112 void setOnlineStatus(const Kopete::OnlineStatus& status,
113 const Kopete::StatusMessage &reason = Kopete::StatusMessage(),
114 const OnlineStatusOptions& options = None);
115 void setAway(bool away, const QString &reason = QString());
117 private:
118 /** Current online status */
119 Kopete::OnlineStatus status;
121 /** A meanwhile session */
122 MeanwhileSession *m_session;
124 /* The user id for this account */
125 QString m_meanwhileId;
128 #endif