void RegisterCommand::execute() { if ( state != RegisterStateGotToken || email_.isEmpty() || password_.isEmpty() || tokenString.isEmpty() ) { // get token first || fill information kDebug(14100) << "not enough info to run execute, state: " << state << " , email: " << email_ << ", password present " << !password_.isEmpty() << ", token string:" << tokenString; return; } session_ = gg_register3( email_.toAscii(), password_.toAscii(), tokenId.toAscii(), tokenString.toAscii(), 1 ); if ( !session_ ) { error( i18n( "Gadu-Gadu" ), i18n( "Registration FAILED" ) ); return; } state = RegisterStateWaitingForNumber; connect( this, SIGNAL(socketReady()), SLOT(watcher()) ); checkSocket( session_->fd, session_->check ); }
void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) { // Connection handles struct gg_http *h = NULL; struct gg_pubdir *s = NULL; GGTOKEN token; #ifdef DEBUGMODE gg->debugLogA("gg_doregister(): Starting."); #endif if (!newPass || !newEmail) return NULL; // Load token if (!gg->gettoken(&token)) return NULL; if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) { TCHAR error[128]; mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot register new account because of error:\n\t%s"), (h && !s) ? http_error_string(h ? h->error : 0) : (s ? TranslateT("Registration rejected") : _tcserror(errno))); MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP); gg->debugLogA("gg_doregister(): Cannot register. errno=%d: %s", errno, strerror(errno)); } else { gg->setDword(GG_KEY_UIN, s->uin); gg->checknewuser(s->uin, newPass); gg->setString(GG_KEY_PASSWORD, newPass); gg->setString(GG_KEY_EMAIL, newEmail); gg_pubdir_free(h); gg->debugLogA("gg_doregister(): Account registration succesful."); MessageBox( NULL, TranslateT("You have registered new account.\nPlease fill up your personal details in \"M->View/Change My Details...\""), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION); } #ifdef DEBUGMODE gg->debugLogA("gg_doregister(): End."); #endif return NULL; }