int OtrInternal::is_logged_in(const char *accountname, const char *protocol, const char *recipient) { TreeModelItem item; item.m_protocol_name = QString::fromUtf8(protocol); item.m_account_name = QString::fromUtf8(accountname); item.m_item_name = QString::fromUtf8(recipient); Buddy *buddy = item.unit(); if (buddy && buddy->status() != Status::Offline) return 1; else return 0; }
void OtrInternal::sendCustomNessage(TreeModelItem &item, QString msg) { Message message; message.setChatUnit(item.unit()); message.setProperty("service", true); message.setProperty("store", false); message.setIncoming(true); message.setText(msg); ChatLayer::get(message.chatUnit(), true)->append(message); // msg.replace("<b>"," "); // msg.replace("</b>"," "); // msg.replace("<i>"," "); // msg.replace("</i>"," "); // m_plugin->addServiceMessage(item,msg); // m_plugin->systemNotification(item,msg); }
//----------------------------------------------------------------------------- void OtrInternal::startSession(const QString& account, const QString& jid, TreeModelItem &item, int pol) { Q_UNUSED(jid); OtrlPolicy policy = (OtrlPolicy)pol; char fingerprint[45]; if (!otrl_privkey_fingerprint(m_userstate, fingerprint, account.toStdString().c_str(), item.m_protocol_name.toStdString().c_str())) { create_privkey(account.toStdString().c_str(), item.m_protocol_name.toStdString().c_str()); } if (!otrl_privkey_fingerprint(m_userstate, fingerprint, account.toStdString().c_str(), item.m_protocol_name.toStdString().c_str())) return; //TODO: make allowed otr versions configureable char* msg = otrl_proto_default_query_msg(account.toStdString().c_str(), policy); item.unit()->send(QString::fromUtf8(msg)); free(msg); }
void OtrInternal::inject_message(TreeModelItem &item, const char *message) { item.unit()->send(QString::fromUtf8(message)); }