Exemplo n.º 1
0
void __cdecl gg_remindpasswordthread(GGPROTO *gg, void *param)
{
	// Connection handle
	struct gg_http *h;
	GG_REMIND_PASS *rp = (GG_REMIND_PASS *)param;
	GGTOKEN token;

#ifdef DEBUGMODE
	gg_netlog(gg, "gg_remindpasswordthread(): Starting.");
#endif
	if(!rp || !rp->email || !rp->uin || !strlen(rp->email))
	{
		if(rp) free(rp);
		return;
	}

	// Get token
	if(!gg_gettoken(gg, &token)) return;

	if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0)))
	{
		char error[128];
		mir_snprintf(error, sizeof(error), Translate("Password could not be reminded because of error:\n\t%s"), strerror(errno));
		MessageBox(
			NULL,
			error,
			GG_PROTONAME,
			MB_OK | MB_ICONSTOP
		);
		gg_netlog(gg, "gg_remindpasswordthread(): Password could not be reminded because of \"%s\".", strerror(errno));
	}
	else
	{
		gg_pubdir_free(h);
		gg_netlog(gg, "gg_remindpasswordthread(): Password remind successful.");
		MessageBox(
			NULL,
			Translate("Password was sent to your e-mail."),
			GG_PROTONAME,
			MB_OK | MB_ICONINFORMATION
		);
	}

#ifdef DEBUGMODE
	gg_netlog(gg, "gg_remindpasswordthread(): End.");
#endif
	if(rp) free(rp);
}
Exemplo n.º 2
0
void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass)
{
	// Readup email
	char email[255] = "\0"; DBVARIANT dbv_email;
	// Connection handles
	struct gg_http *h;
	struct gg_pubdir *s;
	GGTOKEN token;

#ifdef DEBUGMODE
	gg->debugLogA("gg_dochpass(): Starting.");
#endif
	if (!uin || !password || !newPass) return NULL;

	if (!gg->getString(GG_KEY_EMAIL, &dbv_email)) 
	{
		strncpy(email, dbv_email.pszVal, sizeof(email));
		db_free(&dbv_email);
	}

	// Load token
	if (!gg->gettoken(&token))
		return NULL;

	if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
	{
		TCHAR error[128];
		mir_sntprintf(error, SIZEOF(error), TranslateT("Your password cannot be changed because of error:\n\t%s"),
			(h && !s) ? http_error_string(h ? h->error : 0) :
			(s ? TranslateT("Invalid data entered") : _tcserror(errno)));
		MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
		gg->debugLogA("gg_dochpass(): Cannot change password. errno=%d: %s", errno, strerror(errno));
	}
	else
	{
		gg_pubdir_free(h);
		gg->setString(GG_KEY_PASSWORD, newPass);
		gg->debugLogA("gg_dochpass(): Password change succesful.");
		MessageBox(NULL, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
	}

#ifdef DEBUGMODE
	gg->debugLogA("gg_dochpass(): End.");
#endif

	return NULL;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
////////////////////////////////////////////////////////////////////////////////
// Remove Account : Proc
void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password)
{
	// Connection handles
	struct gg_http *h;
	struct gg_pubdir *s;
	GGTOKEN token;

#ifdef DEBUGMODE
	gg->debugLogA("gg_dounregister(): Starting.");
#endif
	if (!uin || !password) return NULL;

	// Load token
	if (!gg->gettoken(&token)) return NULL;

	if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin)
	{
		TCHAR error[128];
		mir_sntprintf(error, SIZEOF(error), TranslateT("Your account cannot be removed because of error:\n\t%s"),
			(h && !s) ? http_error_string(h ? h->error : 0) :
			(s ? TranslateT("Bad number or password") : _tcserror(errno)));
		MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
		gg->debugLogA("gg_dounregister(): Cannot remove account. errno=%d: %s", errno, strerror(errno));
	}
	else
	{
		gg_pubdir_free(h);
		gg->delSetting(GG_KEY_PASSWORD);
		gg->delSetting(GG_KEY_UIN);
		gg->debugLogA("gg_dounregister(): Account %d has been removed.", uin);
		MessageBox(NULL, TranslateT("Your account has been removed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
	}

#ifdef DEBUGMODE
	gg->debugLogA("gg_dounregister(): End.");
#endif

	return NULL;
}
Exemplo n.º 5
0
void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *newEmail)
{
	// Connection handles
	struct gg_http *h;
	struct gg_pubdir *s;
	GGTOKEN token;

#ifdef DEBUGMODE
	gg->debugLogA("gg_dochemail(): Starting.");
#endif
	if (!uin || !email || !newEmail) return NULL;

	// Load token
	if (!gg->gettoken(&token)) return NULL;

	if (!(h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
	{
		TCHAR error[128];
		mir_sntprintf(error, SIZEOF(error), TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
			(h && !s) ? http_error_string(h ? h->error : 0) : (s ? TranslateT("Bad old e-mail or password") : _tcserror(errno)));
		MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
		gg->debugLogA("gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, strerror(errno));
	}
	else
	{
		gg_pubdir_free(h);
		gg->setString(GG_KEY_EMAIL, newEmail);
		gg->debugLogA("gg_dochemail(): E-mail change succesful.");
		MessageBox(NULL, TranslateT("Your e-mail has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
	}

#ifdef DEBUGMODE
	gg->debugLogA("gg_dochemail(): End.");
#endif

	return NULL;
}
Exemplo n.º 6
0
/**
 * Zwalnia zasoby po operacji.
 *
 * \note W rzeczywistości funkcja jest makrem rozwijanym do \c gg_pubdir_free().
 *
 * \param h Struktura połączenia
 *
 * \ingroup remind
 */
void gg_remind_free(struct gg_http *h)
{
	return gg_pubdir_free(h);
}
Exemplo n.º 7
0
/**
 * Zwalnia zasoby po operacji.
 *
 * \note W rzeczywistości funkcja jest makrem rozwijanym do \c gg_pubdir_free().
 *
 * \param h Struktura połączenia
 *
 * \ingroup passwd
 */
void gg_change_passwd_free(struct gg_http *h)
{
	return gg_pubdir_free(h);
}
Exemplo n.º 8
0
/**
 * Zwalnia zasoby po operacji.
 *
 * \note W rzeczywistości funkcja jest makrem rozwijanym do \c gg_pubdir_free().
 *
 * \param h Struktura połączenia
 *
 * \ingroup unregister
 */
void gg_unregister_free(struct gg_http *h)
{
	return gg_pubdir_free(h);
}