• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

XMPPAccountHandler.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2005 by Martin Sevior
00003  * Copyright (C) 2006-2008 by Marc Maurer <uwog@uwog.net>
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00018  * 02111-1307, USA.
00019  */
00020 
00021 #ifndef __XMPPACCOUNTHANDLER__
00022 #define __XMPPACCOUNTHANDLER__
00023 
00024 #include <string>
00025 #include <vector>
00026 #include <map>
00027 
00028 using std::string;
00029 using std::map;
00030 
00031 #include <loudmouth/loudmouth.h>
00032 #include <libxml/tree.h>
00033 
00034 #include <account/xp/AccountHandler.h>
00035 #include "stdio.h"
00036 #include "ut_string_class.h"
00037 #include "ut_types.h"
00038 #include "XMPPBuddy.h"
00039 
00040 #define XMPP_RESOURCE "AbiCollab"
00041 
00042 extern AccountHandlerConstructor XMPPAccountHandlerConstructor;
00043 
00044 class XMPPAccountHandler : public AccountHandler
00045 {
00046 public:
00047     XMPPAccountHandler();
00048     virtual ~XMPPAccountHandler(void);
00049 
00050     // housekeeping
00051     static UT_UTF8String    getStaticStorageType();
00052     virtual UT_UTF8String   getStorageType()
00053         { return getStaticStorageType(); }
00054     virtual UT_UTF8String   getDescription();
00055     virtual UT_UTF8String   getDisplayType();
00056 
00057     // connection management
00058     virtual ConnectResult   connect();
00059     virtual bool            disconnect(void);
00060     virtual bool            isOnline()
00061         { return m_bLoggedIn; }
00062 
00063     // asynchronous connection helper functions
00064     bool                    authenticate();
00065     bool                    setup();
00066     bool                    tearDown();
00067 
00068     // dialog management
00069     virtual void            embedDialogWidgets(void* pEmbeddingParent) = 0;
00070     virtual void            removeDialogWidgets(void* pEmbeddingParent) = 0;
00071     virtual void            storeProperties() = 0;
00072 
00073     // user management
00074     virtual BuddyPtr        constructBuddy(const PropertyMap& vProps);
00075     virtual BuddyPtr        constructBuddy(const std::string& descriptor, BuddyPtr pBuddy);
00076     virtual bool            recognizeBuddyIdentifier(const std::string& identifier);
00077     virtual bool            allowsManualBuddies()
00078         { return true; }
00079     virtual void            forceDisconnectBuddy(BuddyPtr) { /* TODO: implement me? */ }
00080     virtual bool                            hasPersistentAccessControl()
00081         { return true; }
00082 
00083     // session management
00084     virtual bool                            allowsSessionTakeover()
00085         { return false; } // no technical reason not to allow this; we just didn't implement session takeover for this backend yet
00086 
00087         // packet management
00088     virtual bool            send(const Packet* pPacket);
00089     virtual bool            send(const Packet* pPacket, BuddyPtr pBuddy);
00090 
00091     virtual void            handleMessage(const gchar* packet_data, const std::string& from_address);
00092 
00093 private:
00094     UT_UTF8String           _getNameFromFqa(const UT_UTF8String& fqa);
00095     bool                    _send(const char* base64data, XMPPBuddyPtr pBuddy);
00096     XMPPBuddyPtr            _getBuddy(const std::string& from_address);
00097 
00098     // connection management
00099     LmConnection *          m_pConnection;
00100     LmMessageHandler *      m_pPresenceHandler;
00101     LmMessageHandler *      m_pStreamErrorHandler;
00102     LmMessageHandler *      m_pChatHandler;
00103     bool                    m_bLoggedIn;
00104 };
00105 
00106 #endif /* __XMPPACCOUNTHANDLER__ */

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1