本文整理汇总了C++中TreeModelItem::unit方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeModelItem::unit方法的具体用法?C++ TreeModelItem::unit怎么用?C++ TreeModelItem::unit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeModelItem
的用法示例。
在下文中一共展示了TreeModelItem::unit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_logged_in
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;
}
示例2: sendCustomNessage
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);
}
示例3: startSession
//-----------------------------------------------------------------------------
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);
}
示例4: inject_message
void OtrInternal::inject_message(TreeModelItem &item, const char *message)
{
item.unit()->send(QString::fromUtf8(message));
}