void Registration::stanzaRequestResult(const Jid &AStreamJid, const Stanza &AStanza) { XmppStanzaError err = AStanza.type()!="result" ? XmppStanzaError(AStanza) : XmppStanzaError::null; if (FSendRequests.contains(AStanza.id())) { QDomElement queryElem = AStanza.firstElement("query",NS_JABBER_REGISTER); IRegisterFields fields = readFields(AStanza.from(),queryElem); if (AStanza.type()=="result" || (fields.fieldMask & IRegisterFields::Form)>0) { LOG_STRM_INFO(AStreamJid,QString("Registration fields loaded, from=%1, id=%2").arg(AStanza.from(),AStanza.id())); emit registerFields(AStanza.id(),fields); } else { LOG_STRM_WARNING(AStreamJid,QString("Failed to load registration fields from=%1, id=%2: %3").arg(AStanza.from(),AStanza.id(),err.condition())); emit registerError(AStanza.id(),err); } FSendRequests.removeAll(AStanza.id()); } else if (FSubmitRequests.contains(AStanza.id())) { if (AStanza.type()=="result") { LOG_STRM_INFO(AStreamJid,QString("Registration submit accepted, from=%1, id=%2").arg(AStanza.from(),AStanza.id())); emit registerSuccess(AStanza.id()); } else { LOG_STRM_WARNING(AStreamJid,QString("Registration submit rejected, from=%1, id=%2: %3").arg(AStanza.from(),AStanza.id(),err.condition())); emit registerError(AStanza.id(),err); } FSubmitRequests.removeAll(AStanza.id()); } }
RegisterDialog::RegisterDialog(QWidget *parent) : QDialog(parent){ setupUi(this); QIcon icon; icon.addFile(QString::fromUtf8(":/icons/z-logo.gif"), QSize(), QIcon::Normal, QIcon::On); this->setWindowIcon(icon); rm = RegisterManager::getRegisterManager(); connect(OKButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(rm, SIGNAL(registerSuccess()), this,SLOT(registerSuccess())); connect(rm, SIGNAL(registerError()), this,SLOT(registerError())); }
void WindowManager::onRegister(bool success, uint code) { qDebug() << "WindowManager: Register response from server:" << code; if (success) { emit registerSuccess(); } else { emit registerFailed(code); } }