本文整理汇总了C++中AbiCollabSessionManager::startSession方法的典型用法代码示例。如果您正苦于以下问题:C++ AbiCollabSessionManager::startSession方法的具体用法?C++ AbiCollabSessionManager::startSession怎么用?C++ AbiCollabSessionManager::startSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbiCollabSessionManager
的用法示例。
在下文中一共展示了AbiCollabSessionManager::startSession方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: share
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);
}
示例2: startSession
bool TelepathyAccountHandler::startSession(PD_Document* pDoc, const std::vector<std::string>& vAcl, AbiCollab** pSession)
{
UT_DEBUGMSG(("TelepathyAccountHandler::startSession()\n"));
UT_return_val_if_fail(pDoc, false);
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_val_if_fail(pManager, false);
// generate a unique session id to use
UT_UTF8String sSessionId;
UT_UUID* pUUID = XAP_App::getApp()->getUUIDGenerator()->createUUID();
pUUID->toString(sSessionId);
DELETEP(pUUID);
// start the session already, while we'll continue to setup a
// MUC asynchronously below
// TODO: we should fill in the in the master buddy descriptor so we can do
// proper author coloring and session takeover; we can't do that however, since
// the following bugs needs to be fixed first:
//
// https://bugs.freedesktop.org/show_bug.cgi?id=37631
*pSession = pManager->startSession(pDoc, sSessionId, this, true, NULL, "");
// create a chatroom to hold the session information
TelepathyChatroomPtr pChatroom = boost::shared_ptr<TelepathyChatroom>(new TelepathyChatroom(this, NULL, pDoc, sSessionId));
m_chatrooms.push_back(pChatroom);
// add the buddies in the acl list to the room invitee list
/*
std::vector<TelepathyBuddyPtr> buddies = _getBuddies(vAcl);
gchar** invitee_ids = reinterpret_cast<gchar**>(malloc(sizeof(gchar*) * vAcl.size()+1));
int i = 0;
for (std::vector<TelepathyBuddyPtr>::iterator it = buddies.begin(); it != buddies.end(); it++)
{
UT_continue_if_fail(*it);
invitee_ids[i] = strdup(tp_contact_get_identifier((*it)->getContact()));
UT_DEBUGMSG(("Added %s to the invite list\n", invitee_ids[i]));
}
invitee_ids[vAcl.size()] = NULL;
*/
_inviteBuddies(pChatroom, vAcl); // use the above code when TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS is usable
// a quick hack to determine the account to offer the request on
TpAccountManager* manager = tp_account_manager_dup();
UT_return_val_if_fail(manager, false);
GList* accounts = tp_account_manager_get_valid_accounts(manager);
UT_return_val_if_fail(accounts, false);
// TODO: make sure the accounts are ready
TpAccount* selected_account = NULL;
for (GList* account = accounts; account; account = account->next)
{
selected_account = TP_ACCOUNT(account->data);
break;
}
UT_return_val_if_fail(selected_account, false);
g_list_free(accounts);
// determine the room target id
std::string target_id = sSessionId.utf8_str();
std::string conference_server = getProperty("conference_server");
if (conference_server != "")
target_id += "@" + conference_server;
UT_DEBUGMSG(("Using room target ID: %s\n", target_id.c_str()));
// create a anonymous MUC channel request
GHashTable* props = tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, TP_HANDLE_TYPE_ROOM,
TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, target_id.c_str(),
TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, INTERFACE,
/*
* Enable TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS if you want to use
* anonymous MUCs. We can't use it right now, anonymous DBUS_TUBE MUCs are not implemented yet.
* Remove the HANDLE_TYPE and TARGET_ID when you enable this.
*
* See https://bugs.freedesktop.org/show_bug.cgi?id=37630 for details.
*
* TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS, G_TYPE_STRV, invitee_ids,
*/
NULL);
TpAccountChannelRequest * channel_request = tp_account_channel_request_new(selected_account, props, TP_USER_ACTION_TIME_NOT_USER_ACTION);
UT_return_val_if_fail(channel_request, false);
g_hash_table_destroy (props);
// TODO: free invitee_ids
tp_account_channel_request_create_and_handle_channel_async(channel_request, NULL, muc_channel_ready_cb, pChatroom.get());
return true;
}