示例#1
0
// if it's a protocol going offline, attempt to send terminate session to all contacts of that protocol
// (this would be hooked as the ME_CLIST_STATUSMODECHANGE handler except that event is sent *after* the proto goes offline)
int StatusModeChange(WPARAM wParam, LPARAM lParam)
{
	int status = (int)wParam;
	if (status != ID_STATUS_OFFLINE)
		return 0;

	const char *proto = (char *)lParam;

	lib_cs_lock();

	ConnContext *context = otr_user_state->context_root;
	while (context) {
		if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == 0 || mir_strcmp(proto, context->protocol) == 0)) {
			MCONTACT hContact = (UINT_PTR)context->app_data;

			if (hContact) {
				otrl_message_disconnect(otr_user_state, &ops, (void*)hContact, context->accountname, context->protocol, context->username, OTRL_INSTAG_BEST);
				SetEncryptionStatus(hContact, TRUST_NOT_PRIVATE);
			}

		}
		context = context->next;
	}

	return 0;
}
示例#2
0
void
otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops)
{
    ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
        0, NULL, NULL, NULL);

    if (context) {
        otrl_message_disconnect(user_state, ops, NULL, jid, "xmpp", recipient);
    }
}
示例#3
0
// static
void OTR_Wrapper::stopAll()
{
    otrwui_trace("OTR_Wrapper::stopAll()");
    if (!gOTR) return;
    if (gOTR->userstate)
    {
        for (ConnContext *context = gOTR->userstate->context_root; context; context = context->next)
        {
            if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate))
            {
                LLUUID their_uuid = LLUUID(context->username);
                LLUUID session_uuid = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, their_uuid);
                LLFloaterIMPanel* pan = gIMMgr->findFloaterBySession(session_uuid);
                if (pan)
                {
                    llinfos << "$PLOTR$ found IM pannel, pan->doOtrStop()" << llendl;
                    pan->doOtrStop();
                }
                else
                {
                    char my_uuid[UUID_STR_SIZE];
                    gAgent.getID().toString(&(my_uuid[0]));
                    llinfos << "$PLOTR$ didn't find IM panel, going lower level"
                            << " c->accountname:" << context->accountname // this avatar, aka me
                            << " c->protocol:"    << context->protocol    // secondlife, IRC, yahoo...
                            << " c->username:"******" session_uuid:"   << session_uuid
                            << llendl;
                    otrl_message_disconnect(
                        gOTR->get_userstate(), 
                        gOTR->get_uistate(), 
                        &session_uuid,
                        context->accountname,
                        context->protocol,
                        context->username);
                }
            }
        }
    }
}
void OtrInternal::endSession(const QString& account, const QString& contact)
{
    ConnContext* context = otrl_context_find(m_userstate,
                                             contact.toUtf8().constData(),
                                             account.toUtf8().constData(),
                                             OTR_PROTOCOL_STRING,
#if (OTRL_VERSION_MAJOR >= 4)
                                             OTRL_INSTAG_BEST,
#endif
                                             false, NULL, NULL, NULL);
    if (context && (context->msgstate != OTRL_MSGSTATE_PLAINTEXT))
    {
        m_callback->stateChange(account, contact, psiotr::OTR_STATECHANGE_CLOSE);
    }
    otrl_message_disconnect(m_userstate, &m_uiOps, this,
                            account.toUtf8().constData(), OTR_PROTOCOL_STRING,
                            contact.toUtf8().constData()
#if (OTRL_VERSION_MAJOR >= 4)
                            ,OTRL_INSTAG_BEST
#endif
                            );
}
示例#5
0
/*
 * Finish the conversation.
 */
void otr_finish(SERVER_REC *irssi, const char *nick)
{
	ConnContext *ctx;

	assert(irssi);
	assert(nick);

	ctx = otr_find_context(irssi, nick, FALSE);
	if (!ctx) {
		IRSSI_INFO(irssi, nick, "Nothing to do");
		goto end;
	}

	otrl_message_disconnect(user_state_global->otr_state, &otr_ops, irssi,
			ctx->accountname, OTR_PROTOCOL_ID, nick, ctx->their_instance);

	otr_status_change(irssi, nick, OTR_STATUS_FINISHED);

	IRSSI_INFO(irssi, nick, "Finished conversation with %9%s%9",
			nick);

end:
	return;
}
示例#6
0
void OtrInternal::endSession(const QString& account, const QString& jid, TreeModelItem &item)
{
    otrl_message_disconnect(m_userstate, &m_uiOps, this,
                            account.toStdString().c_str(), item.m_protocol_name.toStdString().c_str(),
                            jid.toStdString().c_str());
}