File indexing completed on 2024-04-21 04:04:43

0001  /*
0002   * jabberprotocol.h  -  Base class for the Kopete Jabber protocol
0003   *
0004   * Copyright (c) 2002-2003 by Till Gerken <till@tantalo.net>
0005   * Copyright (c) 2002 by Daniel Stone <dstone@kde.org>
0006   *
0007   * Kopete    (c) by the Kopete developers  <kopete-devel@kde.org>
0008   *
0009   * *************************************************************************
0010   * *                                                                       *
0011   * * This program is free software; you can redistribute it and/or modify  *
0012   * * it under the terms of the GNU General Public License as published by  *
0013   * * the Free Software Foundation; either either version 2
0014    of the License, or (at your option) any later version.of the License, or     *
0015   * * (at your option) any later version.                                   *
0016   * *                                                                       *
0017   * *************************************************************************
0018   */
0019 
0020 #ifndef JABBERPROTOCOL_H
0021 #define JABBERPROTOCOL_H
0022 
0023 
0024 #include <QMap>
0025 
0026 #include <KUrl>
0027 
0028 #define JABBER_DEBUG_GLOBAL     14130
0029 #define JABBER_DEBUG_PROTOCOL   14131
0030 
0031 namespace XMPP
0032 {
0033     class Resource;
0034     class Status;
0035 }
0036 
0037 class JabberCapabilitiesManager;
0038 
0039 class JabberProtocol: public QObject
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044     /**
0045      * Object constructor and destructor
0046      */
0047      JabberProtocol (QObject * parent);
0048      ~JabberProtocol ();
0049 
0050     /**
0051      * Creates the "add contact" dialog specific to this protocol
0052      */
0053 //  virtual AddContactPage *createAddContactWidget (QWidget * parent, Kopete::Account * i);
0054 //  virtual KopeteEditAccountWidget *createEditAccountWidget (Kopete::Account * account, QWidget * parent);
0055 //  virtual Kopete::Account *createNewAccount (const QString & accountId);
0056 
0057     /**
0058      * Deserialize contact data
0059      */
0060 //  virtual Kopete::Contact *deserializeContact (Kopete::MetaContact * metaContact,
0061 //                                   const QMap < QString, QString > &serializedData, const QMap < QString, QString > &addressBookData);
0062 
0063     enum OnlineStatus { JabberOnline, JabberFreeForChat, JabberAway, JabberXA, JabberDND,
0064                         JabberOffline, JabberInvisible, JabberConnecting };
0065 
0066 /*  const Kopete::OnlineStatus JabberKOSChatty;
0067     const Kopete::OnlineStatus JabberKOSOnline;
0068     const Kopete::OnlineStatus JabberKOSAway;
0069     const Kopete::OnlineStatus JabberKOSXA;
0070     const Kopete::OnlineStatus JabberKOSDND;
0071     const Kopete::OnlineStatus JabberKOSOffline;
0072     const Kopete::OnlineStatus JabberKOSInvisible;
0073     const Kopete::OnlineStatus JabberKOSConnecting;
0074 
0075     const Kopete::PropertyTmpl propLastSeen;
0076     const Kopete::PropertyTmpl propFirstName;
0077     const Kopete::PropertyTmpl propLastName;
0078     const Kopete::PropertyTmpl propFullName;
0079     const Kopete::PropertyTmpl propEmailAddress;
0080     const Kopete::PropertyTmpl propPrivatePhone;
0081     const Kopete::PropertyTmpl propPrivateMobilePhone;
0082     const Kopete::PropertyTmpl propWorkPhone;
0083     const Kopete::PropertyTmpl propWorkMobilePhone;
0084     const Kopete::PropertyTmpl propNickName;
0085     const Kopete::PropertyTmpl propSubscriptionStatus;
0086     const Kopete::PropertyTmpl propAuthorizationStatus;
0087     const Kopete::PropertyTmpl propAvailableResources;
0088     const Kopete::PropertyTmpl propVCardCacheTimeStamp;
0089     const Kopete::PropertyTmpl propPhoto;*/
0090     // extra properties to match with vCard
0091 //  const Kopete::PropertyTmpl propJid;
0092 //  const Kopete::PropertyTmpl propBirthday;
0093 //  const Kopete::PropertyTmpl propTimezone;
0094 //  const Kopete::PropertyTmpl propHomepage;
0095 //  const Kopete::PropertyTmpl propCompanyName;
0096 //  const Kopete::PropertyTmpl propCompanyDepartement;
0097 //  const Kopete::PropertyTmpl propCompanyPosition;
0098 //  const Kopete::PropertyTmpl propCompanyRole;
0099 //  const Kopete::PropertyTmpl propWorkStreet;
0100 //  const Kopete::PropertyTmpl propWorkExtAddr;
0101 //  const Kopete::PropertyTmpl propWorkPOBox;
0102 //  const Kopete::PropertyTmpl propWorkCity;
0103 //  const Kopete::PropertyTmpl propWorkPostalCode;
0104 //  const Kopete::PropertyTmpl propWorkCountry;
0105 //  const Kopete::PropertyTmpl propWorkEmailAddress;
0106 //  const Kopete::PropertyTmpl propHomeStreet;
0107 //  const Kopete::PropertyTmpl propHomeExtAddr;
0108 //  const Kopete::PropertyTmpl propHomePOBox;
0109 //  const Kopete::PropertyTmpl propHomeCity;
0110 //  const Kopete::PropertyTmpl propHomePostalCode;
0111 //  const Kopete::PropertyTmpl propHomeCountry;
0112 //  const Kopete::PropertyTmpl propPhoneFax;
0113 //  const Kopete::PropertyTmpl propAbout;
0114 
0115     /**
0116      * This returns our protocol instance
0117      */
0118     static JabberProtocol *protocol ();
0119 
0120     /**
0121      * Return whether the protocol supports offline messages.
0122      */
0123     bool canSendOffline() const { return true; }
0124 
0125     /**
0126      * Convert an XMPP::Resource status to a Kopete::OnlineStatus
0127      */
0128     OnlineStatus resourceToOS ( const XMPP::Resource &resource );
0129     
0130     /**
0131      * Convert an online status to a  XMPP::Status
0132      */
0133     XMPP::Status osToStatus( const OnlineStatus & status, const QString& message=QString() );
0134 
0135     /**
0136      * Return the Entity Capabilities(JEP-0115) manager instance.
0137      */
0138     JabberCapabilitiesManager *capabilitiesManager();
0139     
0140     /**
0141      * inherited from Kopete::MimeTypeHandler
0142      */
0143     virtual void handleURL( const KUrl & url ) const;
0144 
0145 private:
0146     /*
0147      * Singleton instance of our protocol class
0148      */
0149     static JabberProtocol *protocolInstance;
0150 
0151     /**
0152      * Unique Instance of the Entity Capabilities(JEP-0115) manager for Kopete Jabber plugin.
0153      */
0154     JabberCapabilitiesManager *capsManager;
0155     
0156 };
0157 
0158 #endif