bool MySqlStorage::addContactToRoster(QString jid, Contact contact) { if (contactExists(jid, contact.getJid())) { updateNameToContact(jid, contact.getJid(), contact.getName()); updateGroupToContact(jid, contact.getJid(), contact.getGroups()); return true; } else { if (userExists(contact.getJid())) { QJsonDocument document; QJsonObject object; object.insert("groups", QJsonArray::fromStringList(QStringList::fromSet(contact.getGroups()))); document.setObject(object); QSqlQuery query; query.prepare("INSERT INTO qjabberd_contact(user_id, approved, ask, groups, jid, name, subscription, version)" " VALUES(:user_id, :approved, :ask, :groups, :jid, :name, :subscription, :version)"); query.bindValue(":user_id", getUserId(jid)); query.bindValue(":version", contact.getVersion()); query.bindValue(":approved", (int)contact.getApproved()); query.bindValue(":ask", contact.getAsk()); query.bindValue(":jid", contact.getJid()); query.bindValue(":name", contact.getName()); query.bindValue(":subscription", contact.getSubscription()); query.bindValue(":groups", document.toJson()); return query.exec(); } } return false; }
void OSDPlugin::processQueue() { if (m_timer->isActive()) return; while (queue.size()){ m_request = queue.front(); QString text; Contact *contact = getContacts()->contact(m_request.contact); OSDUserData *data = NULL; if (contact){ data = (OSDUserData*)contact->getUserData(user_data_id); }else{ data = (OSDUserData*)getContacts()->getUserData(user_data_id); } switch (m_request.type){ case OSD_ALERT: if (data->EnableAlert.bValue && contact) text = i18n("%1 is online") .arg(contact->getName()); break; case OSD_TYPING: if (data->EnableTyping.bValue && contact) text = i18n("%1 typed") .arg(contact->getName()); break; default: if (data->EnableMessage.bValue && core){ unsigned type = m_request.type; CommandDef *cmd = core->messageTypes.find(type); if (cmd){ MessageDef *def = (MessageDef*)(cmd->param); text = i18n(def->singular, def->plural, 1); int pos = text.find("1 "); if (pos > 0){ text = text.left(pos); }else if (pos == 0){ text = text.mid(2); } text = text.left(1).upper() + text.mid(1); if (contact) text = i18n("%1 from %2") .arg(text) .arg(contact->getName()); } } } if (!text.isEmpty()){ if (m_osd == NULL){ m_osd = new OSDWidget; connect(m_osd, SIGNAL(dblClick()), this, SLOT(dblClick())); } static_cast<OSDWidget*>(m_osd)->showOSD(text, data); m_timer->start(data->Timeout.value * 1000); queue.erase(queue.begin()); break; } queue.erase(queue.begin()); } }
bool RosNameSpace::disconnectPortFromTopic(const Contact& src, const Contact& dest, ContactStyle style) { Bottle cmd; cmd.addString("unregisterPublisher"); cmd.addString(toRosNodeName(src.getName())); cmd.addString(dest.getName()); cmd.addString(rosify(src).toString()); return connectTopic(cmd, false, src, dest, style, false); }
bool RosNameSpace::disconnectTopicFromPort(const Contact& src, const Contact& dest, ContactStyle style) { Bottle cmd; cmd.addString("unregisterSubscriber"); cmd.addString(toRosNodeName(dest.getName())); cmd.addString(src.getName()); cmd.addString(rosify(dest).toString()); return connectTopic(cmd, true, src, dest, style, false); }
bool NetworkBase::setNameServerContact(Contact &nameServerContact) { NameConfig nameConfig; if (nameServerContact.getName() != "") setNameServerName(nameServerContact.getName()); nameConfig.fromFile(); nameConfig.setAddress(nameServerContact); bool result = nameConfig.toFile(); getNameSpace().activate(true); return result; }
static int noteDud(const Contact& src) { NameStore *store = getNameSpace().getQueryBypass(); if (store!=YARP_NULLPTR) { return store->announce(src.getName().c_str(),0); } Bottle cmd, reply; cmd.addString("announce"); cmd.addString(src.getName().c_str()); cmd.addInt(0); ContactStyle style; bool ok = NetworkBase::writeToNameServer(cmd, reply, style); return ok?0:1; }
void OSDPlugin::processQueue() { if (m_timer->isActive()) return; while (queue.size()){ m_request = queue.front(); QString text; Contact *contact = getContacts()->contact(m_request.contact); OSDUserData *data = NULL; if (contact){ data = (OSDUserData*)contact->getUserData(user_data_id); if (m_request.type){ if (data->EnableMessage && core){ unsigned type = m_request.type; for (;;){ CommandDef *cmd = core->messageTypes.find(type); if (cmd == NULL) break; MessageDef *def = (MessageDef*)(cmd->param); if (def->base_type){ type = def->base_type; continue; } text = i18n(def->singular, def->plural, 1); text = i18n("%1 from %2") .arg(text) .arg(contact->getName()); break; } } }else{ if (data->EnableAlert) text = i18n("%1 is online") .arg(contact->getName()); } } if (!text.isEmpty()){ if (m_osd == NULL){ m_osd = new OSDWidget; connect(m_osd, SIGNAL(dblClick()), this, SLOT(dblClick())); } static_cast<OSDWidget*>(m_osd)->showOSD(text, data); m_timer->start(data->Timeout * 1000); queue.erase(queue.begin()); break; } queue.erase(queue.begin()); } }
QString UserWnd::getLongName() { QString res; Contact *contact = getContacts()->contact(m_id); res = contact->getName(); void *data; Client *client = m_edit->client(data, false); if (client && data){ res += " "; res += client->contactName(data); bool bFrom = false; for (unsigned i = 0; i < getContacts()->nClients(); i++){ Client *pClient = getContacts()->getClient(i); if (pClient == client) continue; Contact *contact; clientData *data1 = (clientData*)data; if (pClient->isMyData(data1, contact)){ bFrom = true; break; } } if (bFrom){ res += " "; if (m_edit->m_bReceived){ res += i18n("to %1") .arg(client->name().c_str()); }else{ res += i18n("from %1") .arg(client->name().c_str()); } } } return res; }
Contact YarpNameSpace::registerContact(const Contact& contact) { NameClient& nic = HELPER(this); Contact address = nic.registerName(contact.getName().c_str(), contact); if (address.isValid()) { NestedContact nc; nc.fromString(address.getRegName().c_str()); std::string cat = nc.getCategory(); if (nc.getNestedName()!="") { //bool service = (cat.find("1") != std::string::npos); bool publish = (cat.find('+') != std::string::npos); bool subscribe = (cat.find('-') != std::string::npos); ContactStyle style; Contact c1(nc.getFullName()); Contact c2(std::string("topic:/") + nc.getNestedName()); if (subscribe) { style.persistenceType = ContactStyle::END_WITH_TO_PORT; connectPortToTopic(c2, c1, style); } if (publish) { style.persistenceType = ContactStyle::END_WITH_FROM_PORT; connectPortToTopic(c1, c2, style); } } } return address; }
void *YahooClient::processEvent(Event *e) { if (e->type() == EventContactChanged) { Contact *contact = (Contact*)(e->param()); string grpName; string name; name = contact->getName().utf8(); Group *grp = NULL; if (contact->getGroup()) grp = getContacts()->group(contact->getGroup()); if (grp) grpName = grp->getName().utf8(); ClientDataIterator it(contact->clientData, this); YahooUserData *data; while ((data = (YahooUserData*)(++it)) != NULL) { moveBuddy(data, grpName.c_str()); } } if (e->type() == EventContactDeleted) { Contact *contact = (Contact*)(e->param()); ClientDataIterator it(contact->clientData, this); YahooUserData *data; while ((data = (YahooUserData*)(++it)) != NULL) { removeBuddy(data); } } if (e->type() == EventTemplateExpanded) { TemplateExpand *t = (TemplateExpand*)(e->param()); sendStatus(YAHOO_STATUS_CUSTOM, t->tmpl.local8Bit()); } return NULL; }
void HistoryWindow::setName() { QString name; Contact *contact = getContacts()->contact(m_id); if (contact) name = contact->getName(); setCaption(i18n("History") + " " + name); }
void DockWnd::reset() { m_unread = NULL; QString oldUnreadText = m_unreadText; m_unreadText = ""; MAP_COUNT count; MAP_COUNT::iterator itc; for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){ if (m_unread == NULL){ CommandDef *def = m_plugin->core->messageTypes.find((*it).type); if (def) m_unread = def->icon; } msgIndex m; m.contact = (*it).contact; m.type = (*it).type; itc = count.find(m); if (itc == count.end()){ count.insert(MAP_COUNT::value_type(m, 1)); }else{ (*itc).second++; } } if (!count.empty()){ for (itc = count.begin(); itc != count.end(); ++itc){ CommandDef *def = m_plugin->core->messageTypes.find((*itc).first.type); if (def == NULL) continue; MessageDef *mdef = (MessageDef*)(def->param); QString msg = i18n(mdef->singular, mdef->plural, (*itc).second); Contact *contact = getContacts()->contact((*itc).first.contact); if (contact == NULL) continue; msg = i18n("%1 from %2") .arg(msg) .arg(contact->getName()); #ifdef WIN32 if (m_unreadText.length() + 2 + msg.length() >= 64){ m_unreadText += "..."; break; } #endif if (!m_unreadText.isEmpty()) #ifdef WIN32 m_unreadText += ", "; #else m_unreadText += "\n"; #endif m_unreadText += msg; } } if (m_unread && !blinkTimer->isActive()) blinkTimer->start(1500); if (m_unreadText != oldUnreadText) setTip(m_tip); }
bool Port::addOutput(const Contact& contact) { PortCoreAdapter& core = HELPER(implementation); if (core.isInterrupted()) return false; if (!core.isListening()) { return core.addOutput(contact.toString().c_str(),NULL,NULL,true); } Contact me = where(); return NetworkBase::connect(me.getName().c_str(), contact.toString().c_str()); }
void testOpen() { report(0,"checking opening and closing ports"); Port out, in; in.open("/in"); out.open(Contact::bySocket("tcp","",safePort())); Contact conIn = in.where(); Contact conOut = out.where(); checkTrue(conIn.isValid(),"valid address for /in"); checkTrue(conOut.isValid(),"valid address for /out"); out.addOutput(Contact::byName("/in").addCarrier("tcp")); //Time::delay(0.2); checkEqual(conIn.getName().c_str(),"/in","name is recorded"); checkTrue(conOut.getName().find("/tmp")==0, "name is created"); Bottle bot1, bot2; bot1.fromString("5 10 \"hello\""); out.enableBackgroundWrite(true); out.write(bot1); in.read(bot2); checkEqual(bot1.get(0).asInt(),5,"check bot[0]"); checkEqual(bot1.get(1).asInt(),10,"check bot[1]"); checkEqual(bot1.get(2).asString().c_str(),"hello","check bot[2]"); while (out.isWriting()) { printf("Waiting...\n"); Time::delay(0.1); } bot1.fromString("18"); out.write(bot1); in.read(bot2); checkEqual(bot1.get(0).asInt(),18,"check one more send/receive"); in.close(); out.close(); }
void MainWindow::setTitle() { QString title; Contact *owner = getContacts()->owner(); if (owner) title = owner->getName(); if (title.isEmpty()) title = "SIM"; setCaption(title); }
static Message *dropContacts(QMimeSource *src) { if (ContactDragObject::canDecode(src)){ Contact *contact = ContactDragObject::decode(src); ContactsMessage *msg = new ContactsMessage; QString name = contact->getName(); msg->setContacts(QString("sim:") + QString::number(contact->id()) + "," + getToken(name, '/')); return msg; } return NULL; }
bool MsgContacts::processEvent(Event *e) { if (e->type() == eEventCheckCommandState){ EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e); CommandDef *cmd = ecs->cmd(); if (cmd->param == m_edit){ unsigned id = cmd->bar_grp; if ((id >= MIN_INPUT_BAR_ID) && (id < MAX_INPUT_BAR_ID)){ cmd->flags |= BTN_HIDE; return true; } switch (cmd->id){ case CmdSend: case CmdSendClose: e->process(this); cmd->flags &= ~BTN_HIDE; return true; case CmdTranslit: case CmdSmile: case CmdNextMessage: case CmdMsgAnswer: e->process(this); cmd->flags |= BTN_HIDE; return true; } } } else if (e->type() == eEventCommandExec){ EventCommandExec *ece = static_cast<EventCommandExec*>(e); CommandDef *cmd = ece->cmd(); if ((cmd->id == CmdSend) && (cmd->param == m_edit)){ QString msgText = m_edit->m_edit->text(); QString contacts; for (list<unsigned>::iterator it = m_list->selected.begin(); it != m_list->selected.end(); ++it){ Contact *contact = getContacts()->contact(*it); if (contact){ if (!contacts.isEmpty()) contacts += ';'; contacts += QString("sim:%1,%2") .arg(*it) .arg(contact->getName()); } } if (!contacts.isEmpty()){ ContactsMessage *msg = new ContactsMessage; msg->setContact(m_edit->m_userWnd->id()); msg->setContacts(contacts); msg->setClient(m_client); m_edit->sendMessage(msg); } return true; } } return false; }
void appendEntry(yarp::os::Bottle& reply, const Contact& c) { Bottle& info = reply.addList(); info.addString("registration"); info.addString("name"); info.addString(c.getName().c_str()); info.addString("ip"); info.addString(c.getHost().c_str()); info.addString("port"); info.addInt(c.getPort()); info.addString("type"); info.addString(c.getCarrier().c_str()); }
void ContactBook::addContact(Contact temp) { Contact* newContact = new Contact(temp); name.addElement(temp.getName(), newContact); ID.addElement(temp.getID(), newContact); phoneNumber.addElement(temp.getNumber(), newContact); bookContacts.push_back(*newContact); ++numberOfContacts; }
//add\remove contacts void ContactBook::addContact() { Contact* temp = new Contact(); temp->enterInfo(); name.addElement(temp->getName(), temp); phoneNumber.addElement(temp->getNumber(), temp); ID.addElement(temp->getID(), temp); bookContacts.push_back(*temp); ++numberOfContacts; }
Contact RosNameSpace::unregisterContact(const Contact& contact) { // Remainder of method is supporting older /name+#/foo syntax Bottle cmd, reply; cmd.addString("unregisterSubscriber"); cmd.addString(contact.getName()); cmd.addString("/yarp/registration"); Contact c("http", contact.getHost().c_str(), contact.getPort()); cmd.addString(c.toString()); bool ok = NetworkBase::write(getNameServerContact(), cmd, reply); if (!ok) return Contact(); return Contact(); }
bool RosNameSpace::connectTopic(Bottle& cmd, bool srcIsTopic, const Contact& src, const Contact& dest, ContactStyle style, bool activeRegistration) { Bottle reply; Contact dynamicSrc = src; Contact dynamicDest = dest; if (style.carrier!="") { if (srcIsTopic) { dynamicDest.setCarrier(style.carrier); } else { dynamicSrc.setCarrier(style.carrier); } } Contact base = getNameServerContact(); bool ok = NetworkBase::write(base, cmd, reply); bool fail = (reply.check("faultCode", Value(0)).asInt()!=0)||!ok; if (fail) { if (!style.quiet) { fprintf(stderr, "Failure: name server did not accept connection to topic.\n"); if (reply.check("faultString")) { fprintf(stderr, "Cause: %s\n", reply.check("faultString", Value("")).asString().c_str()); } } } if (!fail) { if (activeRegistration) { Bottle *lst = reply.get(2).asList(); Bottle cmd2; if (lst!=nullptr) { cmd2.addString("publisherUpdate"); cmd2.addString("/yarp"); cmd2.addString(dynamicSrc.getName()); cmd2.addList() = *lst; NetworkBase::write(dynamicDest, cmd2, reply, true); } } } return !fail; }
bool Port::addOutput(const Contact& contact) { PortCoreAdapter& core = HELPER(implementation); if (core.isInterrupted()) return false; core.alertOnWrite(); ConstString name; if (contact.getPort()<=0) { name = contact.toString(); } else { name = contact.toURI(); } if (!core.isListening()) { return core.addOutput(name.c_str(),NULL,NULL,true); } Contact me = where(); return NetworkBase::connect(me.getName().c_str(), name.c_str()); }
void MainWindow::contactRec(Contact c)//联系人编辑 { //完成编辑 ui->renmai2->show(); ui->renmai1->hide(); ui->lineEdit_name->setText(c.getName()); ui->lineEdit_address->setText(c.getAddress()); ui->lineEdit_job->setText(c.getJob()); ui->lineEdit_phone->setText(c.getPhone()); ui->dateEdit_bir->setDate(c.getBirthday()); ui->comboBox->setCurrentText(c.getType()); ui->lineEdit_email->setText(c.getEmail()); QListWidgetItem *m=ui->listWidget_contact->currentItem(); ui->listWidget_contact->removeItemWidget(m); delete m; //完成编辑后插入数据库 }
bool Port::addOutput(const Contact& contact) { PortCoreAdapter& core = IMPL(); if (core.commitToRead) return false; if (core.isInterrupted()) return false; core.alertOnWrite(); std::string name; if (contact.getPort()<=0) { name = contact.toString(); } else { name = contact.toURI(); } if (!core.isListening()) { return core.addOutput(name, nullptr, nullptr, true); } Contact me = where(); return NetworkBase::connect(me.getName(), name); }
void FloatyWnd::init() { m_style = 0; m_icons = ""; m_unread = 0; Contact *contact = getContacts()->contact(m_id); if (contact == NULL) return; m_text = contact->getName(); m_status = contact->contactInfo(m_style, m_statusIcon, &m_icons); QPainter p(this); unsigned blink = m_blink; m_blink = 1; setFont(&p); m_blink = blink; QRect br = qApp->desktop()->rect(); br = p.boundingRect(br, Qt::AlignLeft | Qt::AlignVCenter, m_text); p.end(); unsigned h = br.height(); unsigned w = br.width() + 5; const QPixmap &pict = Pict(m_statusIcon).pixmap(); w += pict.width() + 2; if ((unsigned)(pict.height()) > h) h = pict.height(); string icons = m_icons; while (icons.length()){ string icon = getToken(icons, ','); const QPixmap &pict = Pict(icon.c_str()).pixmap(); w += pict.width() + 2; if ((unsigned)(pict.height()) > h) h = pict.height(); } w += 8; h += 6; resize(w, h); for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){ if ((*it).contact != m_id) continue; m_unread = (*it).type; m_plugin->startBlink(); break; } }
void ICQSecure::fillListView(ListView *lst, SIM::Data ICQUserData::* field) { lst->clear(); Contact *contact; ContactList::ContactIterator it; while ((contact = ++it) != NULL){ ICQUserData *data; ClientDataIterator it(contact->clientData, m_client); while ((data = m_client->toICQUserData(++it)) != NULL){ if ((data->*field).toULong()){ QString firstName = contact->getFirstName(); QString lastName = contact->getLastName(); firstName = getToken(firstName, '/'); lastName = getToken(lastName, '/'); if (!lastName.isEmpty()){ if (!firstName.isEmpty()) firstName += ' '; firstName += lastName; } QString mails; QString emails = contact->getEMails(); while (emails.length()){ QString mailItem = getToken(emails, ';', false); mailItem = getToken(mailItem, '/'); if (!mails.isEmpty()) mails += ", "; mails += mailItem; } QListViewItem *item = new QListViewItem(lst); item->setText(0,QString::number(data->Uin.toULong())); item->setText(1,contact->getName()); item->setText(2,firstName); item->setText(3,mails); item->setText(4,QString::number(contact->id())); unsigned long status = STATUS_UNKNOWN; unsigned style = 0; QString statusIcon; ((Client*)m_client)->contactInfo(data, status, style, statusIcon); item->setPixmap(0, Pict(statusIcon)); } } } }
void FloatyWnd::init() { m_style = 0; m_icons = ""; m_unread = 0; Contact *contact = getContacts()->contact(m_id); if (contact == NULL) return; m_text = contact->getName(); m_status = contact->contactInfo(m_style, m_statusIcon, &m_icons); QRect br = fontMetrics().boundingRect(m_text); unsigned h = br.height(); unsigned w = br.width() + 5; const QPixmap &pict = Pict(m_statusIcon); w += pict.width() + 2; if ((unsigned)(pict.height()) > h) h = pict.height(); string icons = m_icons; while (icons.length()){ string icon = getToken(icons, ','); const QPixmap &pict = Pict(icon.c_str()); w += pict.width() + 2; if ((unsigned)(pict.height()) > h) h = pict.height(); } w += 8; h += 6; resize(w, h); for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){ if ((*it).contact != m_id) continue; m_unread = (*it).type; m_plugin->startBlink(); break; } }
Contact NameServiceOnTriples::query(const yarp::os::ConstString& portName, NameTripleState& act, const yarp::os::ConstString& prefix, bool nested) { if (!nested) lock(); Triple t; t.setNameValue("port",portName.c_str()); int result = act.mem.find(t, YARP_NULLPTR); TripleContext context; context.setRid(result); if (result!=-1) { ConstString host = ""; if (ConstString(prefix)!="") { printf("LOOKING AT IPS FOR %s\n", prefix.c_str()); t.setNameValue("ips","*"); list<Triple> lst = act.mem.query(t,&context); for (list<Triple>::iterator it=lst.begin();it!=lst.end();it++) { printf("LOOKING AT IPS %s\n", it->value.c_str()); if (it->value.find(prefix)==0) { host = it->value; break; } } } if (host=="") { t.setNameValue("host","*"); list<Triple> lst = act.mem.query(t,&context); if (lst.size()>0) { host = lst.begin()->value.c_str(); } } if (host=="") { host = "localhost"; } t.setNameValue("socket","*"); list<Triple> lst = act.mem.query(t,&context); int sock = 10000; if (lst.size()>0) { sock = atoi(lst.begin()->value.c_str()); } t.setNameValue("carrier","*"); ConstString carrier = "tcp"; lst = act.mem.query(t,&context); if (lst.size()>0) { carrier = lst.begin()->value.c_str(); } t.setNameValue("type","*"); ConstString typ = "*"; lst = act.mem.query(t,&context); if (lst.size()>0) { typ = lst.begin()->value.c_str(); } if (!nested) unlock(); Contact result = Contact(portName, carrier, host, sock); if (typ!="" && typ!="*") { NestedContact nc; nc.fromString(result.getName()); nc.setTypeName(typ); result.setNestedContact(nc); } return result; } if (!nested) unlock(); if (delegate && !nested) { return delegate->queryName(portName); } return Contact(); }
QString MsgViewBase::messageText(Message *msg) { QString color; color.sprintf("%06lX", ((msg->getFlags() & MESSAGE_RECEIVED) ? CorePlugin::m_plugin->getColorReceiver() : CorePlugin::m_plugin->getColorSender()) & 0xFFFFFF); const char *icon = "message"; const CommandDef *def = CorePlugin::m_plugin->messageTypes.find(msg->type()); if (def) icon = def->icon; QString contactName; Client *client = NULL; Contact *contact = getContacts()->contact(msg->contact()); if (contact){ ClientDataIterator it(contact->clientData); void *data; while ((data = ++it) != NULL){ if (it.client()->dataName(data) == msg->client()){ client = it.client(); break; } } } if (msg->type() == MessageStatus){ icon = "empty"; StatusMessage *sm = static_cast<StatusMessage*>(msg); if (client == NULL) client = getContacts()->getClient(0); if (client){ for (def = client->protocol()->statusList(); def->text; def++){ if (def->id == sm->getStatus()){ icon = def->icon; break; } } } } bool bUnread = false; if (msg->getFlags() & MESSAGE_RECEIVED){ if (contact) contactName = contact->getName(); for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){ msg_id &m = (*it); if ((m.id == msg->id()) && (m.contact == msg->contact()) && (m.client == msg->client())){ bUnread = true; break; } } }else{ if (client) contactName = client->ownerName(); if (contactName.isEmpty()) contactName = getContacts()->owner()->getName(); } if (contactName.isEmpty()) contactName = "???"; QString id = QString::number(msg->id()); id += ","; if (msg->getBackground() != msg->getForeground()) id += QString::number(msg->getBackground() & 0xFFFFFF); string client_str; if (msg->client()) client_str = msg->client(); if (!client_str.empty()){ id += ","; id += quoteText(client_str.c_str()); } QString s = QString("<p><nobr>" "<a href=\"msg://%1\"><img src=\"icon:%2\"></a>%3" " %4<font color=\"#%5\">%6</font> " "<font size=-1>%7</font>%8" "</nobr></p>") .arg(id) .arg(icon) .arg((msg->getFlags() & MESSAGE_SECURE) ? "<img src=\"icon:encrypted\">" : "") .arg(bUnread ? "<b>" : "") .arg(color) .arg(quoteString(contactName)) .arg(formatTime(msg->getTime())) .arg(bUnread ? "</b>" : ""); if (msg->type() != MessageStatus){ QString msgText = msg->presentation(); if (msgText.isEmpty()){ unsigned type = msg->type(); for (;;){ CommandDef *cmd = CorePlugin::m_plugin->messageTypes.find(type); if (cmd == NULL) break; MessageDef *def = (MessageDef*)(cmd->param); if (def->base_type){ type = def->base_type; continue; } msgText += "<p>"; msgText += i18n(def->singular, def->plural, 1); msgText += "</p>"; break; } QString text = msg->getRichText(); if (!text.isEmpty()){ msgText += "<p>"; msgText += text; msgText += "</p>"; } } string msg_text; msg_text = msgText.utf8(); Event e(EventEncodeText, &msg_text); e.process(); s += parseText(msg_text.c_str(), CorePlugin::m_plugin->getOwnColors(), CorePlugin::m_plugin->getUseSmiles()); } return s; }