• 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., 51 Franklin Street, Fifth Floor, Boston, MA
00018  * 02110-1301 USA.
00019  */
00020 
00021 #ifndef __XMPPACCOUNTHANDLER__
00022 #define __XMPPACCOUNTHANDLER__
00023 
00024 #include <string>
00025 
00026 #include <loudmouth/loudmouth.h>
00027 #include <libxml/tree.h>
00028 
00029 #include <account/xp/AccountHandler.h>
00030 #include "stdio.h"
00031 #include "ut_string_class.h"
00032 #include "ut_types.h"
00033 #include "XMPPBuddy.h"
00034 
00035 #define XMPP_RESOURCE "AbiCollab"
00036 
00037 extern AccountHandlerConstructor XMPPAccountHandlerConstructor;
00038 
00039 class XMPPAccountHandler : public AccountHandler
00040 {
00041 public:
00042     XMPPAccountHandler();
00043     virtual ~XMPPAccountHandler(void);
00044 
00045     // housekeeping
00046     static UT_UTF8String    getStaticStorageType();
00047     virtual UT_UTF8String   getStorageType()
00048         { return getStaticStorageType(); }
00049     virtual UT_UTF8String   getDescription();
00050     virtual UT_UTF8String   getDisplayType();
00051 
00052     // connection management
00053     virtual ConnectResult   connect();
00054     virtual bool            disconnect(void);
00055     virtual bool            isOnline()
00056         { return m_bLoggedIn; }
00057 
00058     // asynchronous connection helper functions
00059     bool                    authenticate();
00060     bool                    setup();
00061     bool                    tearDown();
00062 
00063     // dialog management
00064     virtual void            embedDialogWidgets(void* pEmbeddingParent) = 0;
00065     virtual void            removeDialogWidgets(void* pEmbeddingParent) = 0;
00066     virtual void            storeProperties() = 0;
00067 
00068     // user management
00069     virtual BuddyPtr        constructBuddy(const PropertyMap& vProps);
00070     virtual BuddyPtr        constructBuddy(const std::string& descriptor, BuddyPtr pBuddy);
00071     virtual bool            recognizeBuddyIdentifier(const std::string& identifier);
00072     virtual bool            allowsManualBuddies()
00073         { return true; }
00074     virtual void            forceDisconnectBuddy(BuddyPtr) { /* TODO: implement me? */ }
00075     virtual bool                            hasPersistentAccessControl()
00076         { return true; }
00077 
00078     // session management
00079     virtual bool                            allowsSessionTakeover()
00080         { return false; } // no technical reason not to allow this; we just didn't implement session takeover for this backend yet
00081 
00082         // packet management
00083     virtual bool            send(const Packet* pPacket);
00084     virtual bool            send(const Packet* pPacket, BuddyPtr pBuddy);
00085 
00086     virtual void            handleMessage(const gchar* packet_data, const std::string& from_address);
00087 
00088 private:
00089     UT_UTF8String           _getNameFromFqa(const UT_UTF8String& fqa);
00090     bool                    _send(const char* base64data, XMPPBuddyPtr pBuddy);
00091     XMPPBuddyPtr            _getBuddy(const std::string& from_address);
00092 
00093     // connection management
00094     LmConnection *          m_pConnection;
00095     LmMessageHandler *      m_pPresenceHandler;
00096     LmMessageHandler *      m_pStreamErrorHandler;
00097     LmMessageHandler *      m_pChatHandler;
00098     bool                    m_bLoggedIn;
00099 };
00100 
00101 #endif /* __XMPPACCOUNTHANDLER__ */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1