QString StatusIcons::iconKeyByJid(const Jid &AStreamJid, const Jid &AContactJid) const { bool ask = false; int show = IPresence::Offline; QString subscription = SUBSCRIPTION_NONE; IPresence *presence = FPresenceManager!=NULL ? FPresenceManager->findPresence(AStreamJid) : NULL; if (AStreamJid == AContactJid) { subscription = SUBSCRIPTION_BOTH; show = presence!=NULL ? presence->show() : show; } else if (AStreamJid && AContactJid) { subscription = SUBSCRIPTION_BOTH; show = presence!=NULL ? presence->findItem(AContactJid).show : show; } else { IRoster *roster = FRosterManager!=NULL ? FRosterManager->findRoster(AStreamJid) : NULL; IRosterItem ritem = roster!=NULL ? roster->findItem(AContactJid) : IRosterItem(); ask = !ritem.subscriptionAsk.isEmpty(); subscription = ritem.subscription; show = presence!=NULL ? presence->findItem(AContactJid).show : show; } return iconKeyByStatus(show,subscription,ask); }
void JabberSearch::showSearchDialog(const Jid &AStreamJid, const Jid &AServiceJid, QWidget *AParent) { IPresence *presence = FPresenceManager!=NULL ? FPresenceManager->findPresence(AStreamJid) : NULL; if (presence && presence->isOpen()) { SearchDialog *dialog = new SearchDialog(this,AStreamJid,AServiceJid,AParent); connect(presence->instance(),SIGNAL(closed()),dialog,SLOT(reject())); dialog->show(); } }
Action *Gateways::createDiscoFeatureAction(const Jid &AStreamJid, const QString &AFeature, const IDiscoInfo &ADiscoInfo, QWidget *AParent) { IPresence *presence = FPresencePlugin!=NULL ? FPresencePlugin->findPresence(AStreamJid) : NULL; if (presence && presence->isOpen() && AFeature==NS_JABBER_GATEWAY) { Action *action = new Action(AParent); action->setText(tr("Add Legacy User")); action->setIcon(RSR_STORAGE_MENUICONS,MNI_GATEWAYS_ADD_CONTACT); action->setData(ADR_STREAM_JID,AStreamJid.full()); action->setData(ADR_SERVICE_JID,ADiscoInfo.contactJid.full()); connect(action,SIGNAL(triggered(bool)),SLOT(onAddLegacyUserActionTriggered(bool))); return action; } return NULL; }
void PrivateStorage::notifyDataChanged(const Jid &AStreamJid, const QString &ATagName, const QString &ANamespace) { IPresence *presence = FPresenceManager!=NULL ? FPresenceManager->findPresence(AStreamJid) : NULL; if (FStanzaProcessor && presence && presence->isOpen()) { foreach(const IPresenceItem &item, presence->findItems(AStreamJid)) { if (item.itemJid != AStreamJid) { Stanza notify(STANZA_KIND_MESSAGE); notify.setTo(item.itemJid.full()); QDomElement xElem = notify.addElement("x",NS_VACUUM_PRIVATESTORAGE_UPDATE); xElem.appendChild(notify.createElement(ATagName,ANamespace)); if (FStanzaProcessor->sendStanzaOut(AStreamJid,notify)) LOG_STRM_DEBUG(AStreamJid,QString("Private data updated notify sent, to=%1, ns=%2").arg(item.itemJid.full(),ANamespace)); else LOG_STRM_WARNING(AStreamJid,QString("Failed to send private data updated notify, to=%1, ns=%2").arg(item.itemJid.full(),ANamespace)); } } }
Action *Registration::createDiscoFeatureAction(const Jid &AStreamJid, const QString &AFeature, const IDiscoInfo &ADiscoInfo, QWidget *AParent) { IPresence *presence = FPresenceManager!=NULL ? FPresenceManager->findPresence(AStreamJid) : NULL; if (presence && presence->isOpen() && AFeature==NS_JABBER_REGISTER) { Menu *regMenu = new Menu(AParent); regMenu->setTitle(tr("Registration")); regMenu->setIcon(RSR_STORAGE_MENUICONS,MNI_REGISTRATION); Action *action = new Action(regMenu); action->setText(tr("Register")); action->setIcon(RSR_STORAGE_MENUICONS,MNI_REGISTRATION); action->setData(ADR_STREAM_JID,AStreamJid.full()); action->setData(ADR_SERVICE_JID,ADiscoInfo.contactJid.full()); action->setData(ADR_OPERATION,IRegistration::Register); connect(action,SIGNAL(triggered(bool)),SLOT(onRegisterActionTriggered(bool))); regMenu->addAction(action,AG_DEFAULT,false); action = new Action(regMenu); action->setText(tr("Unregister")); action->setIcon(RSR_STORAGE_MENUICONS,MNI_REGISTRATION_REMOVE); action->setData(ADR_STREAM_JID,AStreamJid.full()); action->setData(ADR_SERVICE_JID,ADiscoInfo.contactJid.full()); action->setData(ADR_OPERATION,IRegistration::Unregister); connect(action,SIGNAL(triggered(bool)),SLOT(onRegisterActionTriggered(bool))); regMenu->addAction(action,AG_DEFAULT,false); action = new Action(regMenu); action->setText(tr("Change password")); action->setIcon(RSR_STORAGE_MENUICONS,MNI_REGISTRATION_CHANGE); action->setData(ADR_STREAM_JID,AStreamJid.full()); action->setData(ADR_SERVICE_JID,ADiscoInfo.contactJid.full()); action->setData(ADR_OPERATION,IRegistration::ChangePassword); connect(action,SIGNAL(triggered(bool)),SLOT(onRegisterActionTriggered(bool))); regMenu->addAction(action,AG_DEFAULT,false); return regMenu->menuAction(); } return NULL; }
Action *ClientInfo::createDiscoFeatureAction(const Jid &AStreamJid, const QString &AFeature, const IDiscoInfo &ADiscoInfo, QWidget *AParent) { IPresence *presence = FPresenceManager!=NULL ? FPresenceManager->findPresence(AStreamJid) : NULL; if (presence && presence->isOpen()) { if (AFeature == NS_JABBER_VERSION) { Action *action = createInfoAction(AStreamJid,ADiscoInfo.contactJid,AFeature,AParent); return action; } else if (AFeature == NS_JABBER_LAST) { Action *action = createInfoAction(AStreamJid,ADiscoInfo.contactJid,AFeature,AParent); return action; } else if (AFeature == NS_XMPP_TIME) { Action *action = createInfoAction(AStreamJid,ADiscoInfo.contactJid,AFeature,AParent); return action; } } return NULL; }
void SchedulerItemDialog::onAccountSelected(int AIndex) { ui->cmbContact->clear(); Jid streamJid(ui->cmbAccount->itemData(AIndex).toString()); IRoster *roster = FRosterManager->findRoster(streamJid); if (roster) { IPresence *presence = FPresenceManager->findPresence(streamJid); if (presence) { QHash<Jid, QString> contacts; QList<Jid> items = presence->itemsJid(); for (QList<Jid>::ConstIterator it=items.constBegin(); it!=items.constEnd(); ++it) { IRosterItem rosterItem = roster->findItem(*it); QString name = (rosterItem.name.isEmpty()?(*it).full():QString("%1 <%2>").arg(rosterItem.name).arg((*it).full())); contacts.insert(*it, name); } for (QHash<Jid, QString>::ConstIterator it=contacts.constBegin(); it!=contacts.constEnd(); ++it) ui->cmbContact->addItem(it.value(), it.key().full()); } } }