1 /*
2     qqprotocol.h - Kopete QQ Protocol
3 
4     Copyright (c) 2003      by Will Stephenson		 <will@stevello.free-online.co.uk>
5     Kopete    (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
6 
7     *************************************************************************
8     *                                                                       *
9     * This library is free software; you can redistribute it and/or         *
10     * modify it under the terms of the GNU General Public                   *
11     * License as published by the Free Software Foundation; either          *
12     * version 2 of the License, or (at your option) any later version.      *
13     *                                                                       *
14     *************************************************************************
15 */
16 
17 #ifndef QQPROTOCOL_H
18 #define QQPROTOCOL_H
19 
20 #include <kopeteprotocol.h>
21 #include <kopeteproperty.h>
22 
23 /**
24  * Encapsulates the generic actions associated with this protocol
25  * @author Will Stephenson
26  */
27 class QQProtocol : public Kopete::Protocol
28 {
29 	Q_OBJECT
30 public:
31 	QQProtocol(QObject *parent, const QVariantList &args);
32     ~QQProtocol();
33 
34 	/**
35 	 * The possible QQ online statuses
36 	 */
37 	const Kopete::OnlineStatus Online;  //online
38 	const Kopete::OnlineStatus BSY;  //busy
39 	const Kopete::OnlineStatus BRB;  //be right back
40 	const Kopete::OnlineStatus AWY;  //away
41 	const Kopete::OnlineStatus PHN;  //on the phone
42 	const Kopete::OnlineStatus LUN;  //out to lunch
43 	const Kopete::OnlineStatus Offline;  //offline
44 	const Kopete::OnlineStatus HDN;  //invisible
45 	const Kopete::OnlineStatus IDL;  //idle
46 	const Kopete::OnlineStatus UNK;  //unknown (internal)
47 	const Kopete::OnlineStatus CNT;  //connecting (internal)
48 
49 	/**
50 	 * Convert the serialised data back into a QQContact and add this
51 	 * to its Kopete::MetaContact
52 	 */
53 	Kopete::Contact *deserializeContact(
54 			Kopete::MetaContact *metaContact,
55 			const QMap< QString, QString > & serializedData,
56 			const QMap< QString, QString > & addressBookData
57 		) Q_DECL_OVERRIDE;
58 	/**
59 	 * Generate the widget needed to add QQContacts
60 	 */
61 	AddContactPage * createAddContactWidget( QWidget *parent, Kopete::Account *account ) Q_DECL_OVERRIDE;
62 	/**
63 	 * Generate the widget needed to add/edit accounts for this protocol
64 	 */
65 	KopeteEditAccountWidget * createEditAccountWidget( Kopete::Account *account, QWidget *parent ) Q_DECL_OVERRIDE;
66 	/**
67 	 * Generate a QQAccount
68 	 */
69 	Kopete::Account * createNewAccount( const QString &accountId ) Q_DECL_OVERRIDE;
70 	/**
71 	 * Access the instance of this protocol
72 	 */
73 	static QQProtocol *protocol();
74 	/**
75 	 * Validate whether userId is a legal QQ account
76 	 */
77 	static bool validContactId( const QString& userId );
78 	/**
79 	 * Represents contacts that are Online
80 	 */
81 	const Kopete::OnlineStatus qqOnline;
82 	/**
83 	 * Represents contacts that are Away
84 	 */
85 	const Kopete::OnlineStatus qqAway;
86 	/**
87 	 * Represents contacts that are Offline
88 	 */
89 	const Kopete::OnlineStatus qqOffline;
90 
91 	const Kopete::PropertyTmpl propNickName;
92 	const Kopete::PropertyTmpl propFullName;
93 	const Kopete::PropertyTmpl propCountry;
94 	const Kopete::PropertyTmpl propState;
95 	const Kopete::PropertyTmpl propCity;
96 	const Kopete::PropertyTmpl propStreet;
97 	const Kopete::PropertyTmpl propZipcode;
98 	const Kopete::PropertyTmpl propAge;
99 	const Kopete::PropertyTmpl propGender;
100 	const Kopete::PropertyTmpl propOccupation;
101 	const Kopete::PropertyTmpl propHomepage;
102 	const Kopete::PropertyTmpl propIntro;
103 	const Kopete::PropertyTmpl propGraduateFrom;
104 	const Kopete::PropertyTmpl propHoroscope;
105 	const Kopete::PropertyTmpl propZodiac;
106 	const Kopete::PropertyTmpl propBloodType;
107 	const Kopete::PropertyTmpl propEmail;
108 
109 protected:
110 	static QQProtocol *s_protocol;
111 };
112 
113 #endif // QQPROTOCOL_H
114