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

FakeAccountHandler.h

Go to the documentation of this file.
00001 /* Copyright (C) 2007 One Laptop Per Child
00002  * Author: Marc Maurer <uwog@uwog.net>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 #ifndef __FAKEACCOUNTHANDLER__
00021 #define __FAKEACCOUNTHANDLER__
00022 
00023 #include <account/xp/AccountHandler.h>
00024 #include <account/xp/Buddy.h>
00025 #include "FakeBuddy.h"
00026 
00027 class RecordedPacket;
00028 class AbiCollab;
00029 class PD_Document;
00030 
00031 class FakeAccountHandler : public AccountHandler
00032 {
00033 public:
00034     FakeAccountHandler(const UT_UTF8String& sSessionURI, XAP_Frame* pFrame);
00035     virtual ~FakeAccountHandler();
00036 
00037     // housekeeping
00038     static UT_UTF8String                    getStaticStorageType();
00039     virtual UT_UTF8String                   getStorageType()
00040         { return getStaticStorageType(); }
00041     virtual UT_UTF8String                   getDescription();
00042     virtual UT_UTF8String                   getDisplayType();
00043 
00044     // dialog management
00045     virtual void                            embedDialogWidgets(void* /*pEmbeddingParent*/)
00046         { UT_ASSERT_HARMLESS(UT_NOT_REACHED); }
00047     virtual void                            removeDialogWidgets(void* /*pEmbeddingParent*/)
00048         { UT_ASSERT_HARMLESS(UT_NOT_REACHED); }
00049     virtual void                            loadProperties();
00050     virtual void                            storeProperties();
00051 
00052     // connection management
00053     virtual ConnectResult                   connect();
00054     virtual bool                            disconnect();
00055     virtual bool                            isOnline();
00056     bool                                    isLocallyControlled()
00057         { return false; }
00058 
00059     // user management
00060     FakeBuddyPtr                            getBuddy(const UT_UTF8String& description);
00061     virtual BuddyPtr                        constructBuddy(const PropertyMap& props);
00062     virtual BuddyPtr                        constructBuddy(const std::string& descriptor, BuddyPtr pBuddy);
00063     virtual bool                            allowsManualBuddies()
00064         { return false; }
00065     virtual void                            forceDisconnectBuddy(BuddyPtr pBuddy);
00066     virtual bool                            recognizeBuddyIdentifier(const std::string& identifier);
00067     virtual bool                            hasPersistentAccessControl()
00068         { return true; }
00069 
00070     // session management
00071     virtual bool                            allowsSessionTakeover()
00072         { return false; } // not sure if sugar/tubes allow session takeover; should investigate - MARCM
00073 
00074     // packet management
00075     virtual bool                            send(const Packet* pPacket);
00076     virtual bool                            send(const Packet* pPacket, BuddyPtr pBuddy);
00077 
00078     // functions for the regression test
00079     bool                                    process();
00080 
00081     // functions for the debug test
00082     bool                                    getCurrentRev(UT_sint32& iLocalRev, UT_sint32& iRemoteRev);
00083     bool                                    stepToRemoteRev(UT_sint32 iRemoteRev);
00084     bool                                    canStep();
00085     bool                                    step(UT_sint32& iLocalRev);
00086 
00087     // misc. functions
00088     bool                                    initialize(UT_UTF8String* pForceSessionId);
00089     void                                    cleanup();
00090     XAP_Frame*                              getFrame()
00091         { return m_pFrame; }
00092 
00093 private:
00094     bool                                    _loadDocument(UT_UTF8String* pForceSessionId);
00095     bool                                    _createSession();
00096     bool                                    _import(const RecordedPacket& rp);
00097 
00098     UT_UTF8String                           m_sSessionURI;
00099     XAP_Frame*                              m_pFrame;
00100     AbiCollab*                              m_pSession;
00101     bool                                    m_bLocallyControlled;
00102     PD_Document*                            m_pDoc;
00103     std::vector<RecordedPacket*>            m_packets;
00104     UT_sint32                               m_iIndex;
00105 
00106     // variables for the debug test
00107     UT_sint32                               m_iLocalRev;
00108     UT_sint32                               m_iRemoteRev;
00109 };
00110 
00111 #endif /* __SUGARACCOUNTHANDLER__ */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1