• 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., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, 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 
00068     // session management
00069     virtual bool                            allowsSessionTakeover()
00070         { return false; } // not sure if sugar/tubes allow session takeover; should investigate - MARCM
00071 
00072     // packet management
00073     virtual bool                            send(const Packet* pPacket);
00074     virtual bool                            send(const Packet* pPacket, BuddyPtr pBuddy);
00075 
00076     // functions for the regression test
00077     bool                                    process();
00078 
00079     // functions for the debug test
00080     bool                                    getCurrentRev(UT_sint32& iLocalRev, UT_sint32& iRemoteRev);
00081     bool                                    stepToRemoteRev(UT_sint32 iRemoteRev);
00082     bool                                    canStep();
00083     bool                                    step(UT_sint32& iLocalRev);
00084 
00085     // misc. functions
00086     bool                                    initialize(UT_UTF8String* pForceSessionId);
00087     void                                    cleanup();
00088     XAP_Frame*                              getFrame()
00089         { return m_pFrame; }
00090 
00091 private:
00092     bool                                    _loadDocument(UT_UTF8String* pForceSessionId);
00093     bool                                    _createSession();
00094     bool                                    _import(const RecordedPacket& rp);
00095 
00096     UT_UTF8String                           m_sSessionURI;
00097     XAP_Frame*                              m_pFrame;
00098     AbiCollab*                              m_pSession;
00099     bool                                    m_bLocallyControlled;
00100     PD_Document*                            m_pDoc;
00101     std::vector<RecordedPacket*>            m_packets;
00102     UT_sint32                               m_iIndex;
00103 
00104     // variables for the debug test
00105     UT_sint32                               m_iLocalRev;
00106     UT_sint32                               m_iRemoteRev;
00107 };
00108 
00109 #endif /* __SUGARACCOUNTHANDLER__ */

Generated on Sat May 26 2012 for AbiWord by  doxygen 1.7.1