本文整理汇总了C++中AbiCollabSessionManager类的典型用法代码示例。如果您正苦于以下问题:C++ AbiCollabSessionManager类的具体用法?C++ AbiCollabSessionManager怎么用?C++ AbiCollabSessionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbiCollabSessionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UT_DEBUGMSG
void Synchronizer::_registerWndClass() // Win32-only
{
if (sm_iClass)
{
UT_DEBUGMSG(("Skipping window class registration\n"));
return;
}
AbiCollabSessionManager * pSessionManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pSessionManager);
HINSTANCE hInstance = pSessionManager->getInstance();
UT_return_if_fail(hInstance);
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = Synchronizer::s_wndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = SYNC_CLASSNAME;
sm_iClass = RegisterClass(&wc);
UT_return_if_fail(sm_iClass);
sm_iMessageWindows = 0;
}
示例2: gtk_list_store_new
void AP_UnixDialog_CollaborationAddBuddy::_populateWindowData()
{
// populate the account combobox
GtkListStore* store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
GtkTreeIter iter;
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
{
AccountHandler* pHandler = pManager->getAccounts()[i];
if (pHandler && pHandler->allowsManualBuddies())
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
DESC_COLUMN, pHandler->getDescription().utf8_str(),
HANDLER_COLUMN, pHandler,
-1);
}
}
m_model = GTK_TREE_MODEL (store);
gtk_combo_box_set_model(GTK_COMBO_BOX(m_wAccount), m_model);
// if we have at least one account, then make sure the first one is selected
if (pManager->getAccounts().size() > 0)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(m_wAccount), 0);
}
else
{
// nope, we don't have any account :'-(
gtk_combo_box_set_active(GTK_COMBO_BOX(m_wAccount), -1);
}
}
示例3: UT_DEBUGMSG
bool TelepathyAccountHandler::disconnect()
{
UT_DEBUGMSG(("TelepathyAccountHandler::disconnect()\n"));
UT_return_val_if_fail(m_pTpClient, false);
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_val_if_fail(pManager, false);
// unregister as a telepathy client
tp_base_client_unregister(m_pTpClient);
m_pTpClient = NULL;
// tear down all active rooms
for (std::vector<TelepathyChatroomPtr>::iterator it = m_chatrooms.begin(); it != m_chatrooms.end(); it++)
(*it)->stop();
// we are disconnected now, no need to receive events anymore
pManager->unregisterEventListener(this);
// signal all listeners we are logged out
AccountOfflineEvent event;
AbiCollabSessionManager::getManager()->signal(event);
return true;
}
示例4: UT_DEBUGMSG
void TCPAccountHandler::addBuddy(BuddyPtr pBuddy)
{
UT_DEBUGMSG(("TCPAccountHandler::addBuddy()\n"));
UT_return_if_fail(pBuddy);
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
if (getProperty("allow-all") == "true")
{
const UT_GenericVector<AbiCollab *> pSessions = pManager->getSessions();
for (UT_sint32 i = 0; i < pSessions.size(); i++)
{
AbiCollab* pSession = pSessions.getNthItem(i);
UT_continue_if_fail(pSession);
if (pSession->getAclAccount() != this)
continue;
pSession->appendAcl(pBuddy->getDescriptor(false).utf8_str());
}
}
AccountHandler::addBuddy(pBuddy);
}
示例5: gtk_list_store_new
GtkListStore* AP_UnixDialog_CollaborationAccounts::_constructModel()
{
GtkTreeIter iter;
GtkListStore* model = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
{
AccountHandler* pHandler = pManager->getAccounts()[i];
if (pHandler)
{
UT_DEBUGMSG(("Got account: %s of type %s\n",
pHandler->getDescription().utf8_str(),
pHandler->getDisplayType().utf8_str()
));
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter,
ONLINE_COLUMN, pHandler->isOnline(),
DESC_COLUMN, pHandler->getDescription().utf8_str(),
TYPE_COLUMN, pHandler->getDisplayType().utf8_str(),
HANDLER_COLUMN, pHandler,
-1);
}
}
return model;
}
示例6: UT_DEBUGMSG
/*!
* This virtual method is called if the attached document is deleted with an attached
* AbiCollab_Export connected to the document.
*/
void ABI_Collab_Export::removeDocument(void)
{
UT_DEBUGMSG(("ABI_Collab_Export::removeDocument()\n"));
// inform the session manager that this session is being (forcefully) closed
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
// WARNING: Don't do anything after this line, as the disconnectSession() call will
// have destroyed ourselves (yes, that is ugly).
pManager->disconnectSession(m_pAbiCollab);
}
示例7: UT_return_if_fail
void AbiCollab::initiateSessionTakeover(BuddyPtr pNewMaster)
{
UT_return_if_fail(pNewMaster);
UT_DEBUGMSG(("AbiCollab::initiateSessionTakeover() - pNewMaster: %s\n", pNewMaster->getDescriptor(true).utf8_str()));
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
// this could lead to us never exiting; add a timeout or something somewhere :)
pManager->beginAsyncOperation(this);
// NOTE: we only allow slaves in the session takeover process
// that are on the same account as the proposed master is. The
// others are dropped from the session. At least for now.
// TODO: implement me
// reset any old session takeover state
m_bProposedController = false;
m_pProposedController = pNewMaster;
m_vApprovedReconnectBuddies.clear();
m_mAckedSessionTakeoverBuddies.clear();
m_bSessionFlushed = false;
if (m_vOutgoingQueue.size() > 0)
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
m_vOutgoingQueue.clear();
// send a SessionTakeoverRequest packet to the new master
std::vector<std::string> buddyIdentifiers;
for (std::map<BuddyPtr, std::string>::iterator it = m_vCollaborators.begin(); it != m_vCollaborators.end(); it++)
{
BuddyPtr pBuddy = (*it).first;
UT_continue_if_fail(pBuddy);
if (pNewMaster != pBuddy)
buddyIdentifiers.push_back(pBuddy->getDescriptor(true).utf8_str());
}
SessionTakeoverRequestPacket strp_promote(m_sId, m_pDoc->getDocUUIDString(), true, buddyIdentifiers);
pNewMaster->getHandler()->send(&strp_promote, pNewMaster);
// send a SessionTakeoverRequest packet to the other slaves (if any)
buddyIdentifiers.clear();
buddyIdentifiers.push_back(pNewMaster->getDescriptor(true).utf8_str());
SessionTakeoverRequestPacket strp_normal(m_sId, m_pDoc->getDocUUIDString(), false, buddyIdentifiers);
for (std::map<BuddyPtr, std::string>::iterator it = m_vCollaborators.begin(); it != m_vCollaborators.end(); it++)
{
BuddyPtr pBuddy = (*it).first;
UT_continue_if_fail(pBuddy);
if (pNewMaster != pBuddy)
pBuddy->getHandler()->send(&strp_normal, pBuddy);
}
m_eTakeoveState = STS_SENT_TAKEOVER_REQUEST;
}
示例8: UT_DEBUGMSG
void AP_Dialog_CollaborationShare::share(AccountHandler* pAccount, const std::vector<std::string>& vAcl)
{
UT_DEBUGMSG(("AP_Dialog_CollaborationShare::_share()\n"));
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
// determine which document to share
XAP_Frame* pFrame = XAP_App::getApp()->getLastFocussedFrame();
UT_return_if_fail(pFrame);
PD_Document* pDoc = static_cast<PD_Document *>(pFrame->getCurrentDoc());
UT_return_if_fail(pDoc);
AbiCollab* pSession = NULL;
if (!pManager->isInSession(pDoc))
{
UT_DEBUGMSG(("Sharing document...\n"));
// FIXME: this can cause a race condition: the other side can already be
// offered the session before we actually started it!
// Tell the account handler that we start a new session, so
// it set up things if needed. This call may just setup some stuff
// for a new session, or it might actually start a new session.
bool b = pAccount->startSession(pDoc, m_vAcl, &pSession);
if (!b)
{
XAP_App::getApp()->getLastFocussedFrame()->showMessageBox(
"There was an error sharing this document!",
XAP_Dialog_MessageBox::b_O, XAP_Dialog_MessageBox::a_OK);
return;
}
// start the session ourselves when the account handler did not...
if (!pSession)
{
// ... and start the session!
UT_UTF8String sSessionId("");
// TODO: we could use/generate a proper descriptor when there is only
// 1 account where we share this document over
pSession = pManager->startSession(pDoc, sSessionId, pAccount, true, NULL, "");
}
}
else
{
pSession = pManager->getSession(pDoc);
}
UT_return_if_fail(pSession);
pManager->updateAcl(pSession, pAccount, vAcl);
}
示例9: _populateWindowData
void AP_UnixDialog_CollaborationShare::_populateWindowData()
{
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
// populate the account combobox
GtkListStore* store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
GtkTreeIter iter;
AccountHandler* pShareeableAcount = _getShareableAccountHandler();
if (pShareeableAcount)
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
0, pShareeableAcount->getDescription().utf8_str(),
1, pShareeableAcount,
-1);
gtk_widget_set_sensitive(m_wAccount, false);
}
else
{
for (std::vector<AccountHandler*>::const_iterator cit = pManager->getAccounts().begin(); cit != pManager->getAccounts().end(); cit++)
{
AccountHandler* pAccount = *cit;
UT_continue_if_fail(pAccount);
if (!pAccount->isOnline() || !pAccount->canManuallyStartSession())
continue;
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
0, pAccount->getDescription().utf8_str(),
1, pAccount,
-1);
}
gtk_widget_set_sensitive(m_wAccount, true);
}
m_pAccountModel = GTK_TREE_MODEL (store);
gtk_combo_box_set_model(GTK_COMBO_BOX(m_wAccount), m_pAccountModel);
// if we have at least one account handler, then make sure the first one is selected
if (pManager->getRegisteredAccountHandlers().size() > 0)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(m_wAccount), 0);
}
else
{
// nope, we don't have any account handler :'-(
gtk_combo_box_set_active(GTK_COMBO_BOX(m_wAccount), -1);
}
}
示例10: UT_DEBUGMSG
void TCPAccountHandler::handleEvent(boost::shared_ptr<Session> session_ptr)
{
UT_DEBUGMSG(("TCPAccountHandler::handleEvent()\n"));
UT_return_if_fail(session_ptr);
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
// make sure we have handled _all_ packets in the queue before checking
// the disconnected status
bool disconnected = !session_ptr->isConnected();
_handleMessages(session_ptr);
// check the connection status
if (disconnected)
{
UT_DEBUGMSG(("Socket is not connected anymore!\n"));
// drop all buddies that were on this connection
std::map<TCPBuddyPtr, boost::shared_ptr<Session> >::iterator next;
for (std::map<TCPBuddyPtr, boost::shared_ptr<Session> >::iterator it = m_clients.begin(); it != m_clients.end(); it = next)
{
next = it;
next++;
UT_continue_if_fail((*it).first);
UT_continue_if_fail((*it).second);
TCPBuddyPtr pB = (*it).first;
if ((*it).second == session_ptr)
{
UT_DEBUGMSG(("Lost connection to %s buddy %s:%s\n", getProperty("server") == "" ? "client" : "server", pB->getAddress().c_str(), pB->getPort().c_str()));
// drop this buddy from all sessions
pManager->removeBuddy(pB, false);
// erase the buddy <-> session mapping
m_clients.erase(it);
deleteBuddy(pB);
}
}
// if we were connected to a server, then we are basically disconnected now
if (getProperty("server") != "")
disconnect();
}
// check other things here if needed...
}
示例11: s_abicollab_join
bool s_abicollab_join(AV_View* /*v*/, EV_EditMethodCallData* /*d*/)
{
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_val_if_fail(pManager, false);
// Get the current view that the user is in.
XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
// Get an Accounts dialog instance
XAP_DialogFactory* pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
UT_return_val_if_fail(pFactory, false);
AP_Dialog_CollaborationJoin* pDialog = static_cast<AP_Dialog_CollaborationJoin*>(
pFactory->requestDialog(AbiCollabSessionManager::getManager()->getDialogJoinId())
);
// Run the dialog
pDialog->runModal(pFrame);
// Handle the dialog outcome
AP_Dialog_CollaborationJoin::tAnswer answer = pDialog->getAnswer();
BuddyPtr pBuddy = pDialog->getBuddy();
DocHandle* pDocHandle = pDialog->getDocHandle();
pFactory->releaseDialog(pDialog);
switch (answer)
{
case AP_Dialog_CollaborationJoin::a_OPEN:
{
UT_return_val_if_fail(pBuddy && pDocHandle, false);
// Check if we have already joined this session. If so, then just
// ignore the request. Otherwise actually join the session.
AbiCollab* pSession = pManager->getSessionFromSessionId(pDocHandle->getSessionId());
if (pSession)
{
UT_DEBUGMSG(("Already connected to session, just raising the associated frame\n"));
// Just raise a frame that contains this session, instead of
// opening the document again
XAP_Frame* pFrameForSession = pManager->findFrameForSession(pSession);
UT_return_val_if_fail(pFrameForSession, false);
pFrameForSession->raise();
}
else
pManager->joinSessionInitiate(pBuddy, pDocHandle);
}
break;
case AP_Dialog_CollaborationJoin::a_CANCEL:
break;
}
return true;
}
示例12: _getActiveSession
AbiCollab* AP_Dialog_CollaborationShare::_getActiveSession()
{
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_val_if_fail(pManager, NULL);
XAP_Frame* pFrame = XAP_App::getApp()->getLastFocussedFrame();
UT_return_val_if_fail(pFrame, NULL);
PD_Document* pDoc = static_cast<PD_Document *>(pFrame->getCurrentDoc());
UT_return_val_if_fail(pDoc, NULL);
if (!pManager->isInSession(pDoc))
return NULL;
return pManager->getSession(pDoc);
}
示例13: _populateShareState
bool AP_Dialog_CollaborationShare::_populateShareState(BuddyPtr pBuddy)
{
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_val_if_fail(pManager, false);
PD_Document *pDoc = static_cast<PD_Document*>(XAP_App::getApp()->getLastFocussedFrame()->getCurrentDoc());
UT_return_val_if_fail(pDoc, false);
if (!pManager->isInSession(pDoc))
{
AccountHandler* pHandler = pBuddy->getHandler();
UT_return_val_if_fail(pHandler, false);
return pHandler->defaultShareState(pBuddy);
}
return _inAcl(m_vAcl, pBuddy);
}
示例14: TCPAccountHandler
TCPWin32AccountHandler::TCPWin32AccountHandler()
: TCPAccountHandler(),
m_pWin32Dialog(NULL),
m_hInstance(NULL),
m_hServerEntry(NULL),
m_hPortEntry(NULL),
m_hServerRadio(NULL),
m_hJoinRadio(NULL),
m_hServerLabel(NULL),
m_hPortLabel(NULL),
m_hAllowAllCheck(NULL),
m_hAutoconnectCheck(NULL)
{
AbiCollabSessionManager * pSessionManager = AbiCollabSessionManager::getManager();
if (pSessionManager)
{
m_hInstance = pSessionManager->getInstance();
}
}
示例15: UT_DEBUGMSG
bool XMPPAccountHandler::disconnect()
{
UT_DEBUGMSG(("XMPPAccountHandler::disconnect()\n"));
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_val_if_fail(pManager, false);
// we are disconnected now, no need to receive events anymore
pManager->unregisterEventListener(this);
tearDown();
// signal all listeners we are logged out
AccountOfflineEvent event;
// TODO: fill the event
AbiCollabSessionManager::getManager()->signal(event);
return true;
}