CustomMailPage::CustomMailPage(IGateways *AGateways, IMessageWidgets *AMessageWidgets, IRosterIndex *AMailIndex, const Jid &AServiceJid, QWidget *AParent) : QWidget(AParent) { ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); setWindowTitle(tr("Write a mail")); StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this,STS_RAMBLERMAILNOTIFY_CUSTOMMAILPAGE); FGateways = AGateways; FMessageWidgets = AMessageWidgets; FMailIndex = AMailIndex; FServiceJid = AServiceJid; FDescriptor = FGateways->serviceDescriptor(streamJid(),serviceJid()); ui.pbtContinue->setEnabled(false); ui.pbtContinue->addTextFlag(TF_LIGHTSHADOW); connect(ui.pbtContinue,SIGNAL(clicked()),SLOT(onContinueButtonClicked())); connect(ui.lneContactMail,SIGNAL(textChanged(const QString &)),SLOT(onContactMailChanged(const QString &))); connect(FGateways->instance(),SIGNAL(userJidReceived(const QString &, const Jid &)), SLOT(onUserJidReceived(const QString &, const Jid &))); connect(FGateways->instance(),SIGNAL(errorReceived(const QString &, const QString &)), SLOT(onErrorReceived(const QString &, const QString &))); connect(FMailIndex->instance(),SIGNAL(dataChanged(IRosterIndex *, int)),SLOT(onMailIndexDataChanged(IRosterIndex *, int))); onMailIndexDataChanged(FMailIndex,Qt::DecorationRole); }
// Trigger request from server for it to return the list of all subscriptions void OnSipXmppBase::getSubscriptions(ResultHandler *resultHandler) { Logger::log_debug("OnSipXmppBase::getSubscriptions"); _checkThread.CheckSameThread(); // Verify we are single threaded for this object // Get the current subscriptions JID serviceJid( "pubsub.active-calls.xmpp.onsip.com" ); _ASSERT( resultHandler != NULL ); m_pubSub->getSubscriptions( serviceJid, resultHandler ); }
void CustomMailPage::onContinueButtonClicked() { QString contact = FGateways->normalizedContactLogin(FDescriptor,ui.lneContactMail->text().trimmed()); FRequestId = FGateways->sendUserJidRequest(streamJid(),serviceJid(),contact); if (!FRequestId.isEmpty()) { ui.pbtContinue->setEnabled(false); ui.lneContactMail->setEnabled(false); } }
// Enable call events on OnSIP PBX // returns the Id used for event // expireTime in XMPP format, e.g. 2006-03-31T23:59Z // can pass empty string to not have field passed in subscribe request string OnSipXmppBase::SubscribeCallEvents(const string& expireTime,ResultHandler* resultHandler) { Logger::log_debug("OnSipXmppBase::SubscribeCallEvents expireTime='%s' rh=%p", expireTime.c_str(), resultHandler ); _checkThread.CheckSameThread(); // Verify we are single threaded for this object JID serviceJid( "pubsub.active-calls.xmpp.onsip.com" ); string node = Strings::stringFormat("/%s/%s", m_login.m_domain.c_str(), m_login.m_name.c_str() ); _ASSERT( resultHandler != NULL ); string id = m_pubSub->subscribe( serviceJid, node, resultHandler, m_gloox->jid().full(), PubSub::SubscriptionItems, 0, expireTime ); Logger::log_debug("OnSipXmppBase::SubscribeCallEvents sending id=%s", id.c_str() ); return id; }
// Unscribe call events on OnSIP PBX, pass the subid // used in the resulting subscribe success // returns the context id for the Iq event long OnSipXmppBase::UnsubscribeCallEvents(const string& nodeid, const string& subid,ResultHandler* resultHandler,IqHandler* iqHandler) { Logger::log_debug("OnSipXmppBase::UnsubscribeCallEvents nodeid=%s subid=%s rh=%p iq=%p", nodeid.c_str(), subid.c_str(), resultHandler, iqHandler ); _checkThread.CheckSameThread(); // Verify we are single threaded for this object JID serviceJid( "pubsub.active-calls.xmpp.onsip.com" ); string node = Strings::stringFormat("/%s/%s", m_login.m_domain.c_str(), m_login.m_name.c_str() ); _ASSERT( resultHandler != NULL ); string id = m_pubSub->unsubscribe( serviceJid, node, subid, resultHandler, m_gloox->jid() ); // Not supposed to use this method, it is depracted. // But could not get gloox to call back on the pubsub events or iq // events without doing this. May be due to PubSub is using newer // subscribe/unsubscribe model than gloox is updated for. // e.g. had to create custom extension (OnSipStanzaExtensions.cpp) // for subscribe to work. long contextId = getUniqueId(); _ASSERT( iqHandler != NULL ); m_gloox->trackID( iqHandler, id, contextId ); Logger::log_debug("OnSipXmppBase::UnsubscribeCallEvents sending id=%s, contextId=%ld", id.c_str(), contextId ); return contextId; }
QString CustomMailPage::tabPageId() const { return "CustomMailPage|"+streamJid().pBare()+"|"+serviceJid().pBare(); }