diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-17 23:15:57 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-17 23:15:57 +0000 |
commit | 65cf85ee6e83594f4de5d6d06012bde070b6c6b1 (patch) | |
tree | 50b3747038b77088ee0bef29f6594a74807397c3 /protocols/Gadu-Gadu/src | |
parent | 2d26921c87c663de4725963d7da87c6eacd1e3d3 (diff) |
GaduGadu: Cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@14241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r-- | protocols/Gadu-Gadu/src/avatar.cpp | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 5 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/dialogs.cpp | 3 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/filetransfer.cpp | 6 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.cpp | 60 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 33 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 4 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/import.cpp | 5 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/services.cpp | 5 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/token.cpp | 17 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/userutils.cpp | 22 |
11 files changed, 77 insertions, 85 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index c1d4936588..4f04649a6a 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -324,7 +324,7 @@ void __cdecl GGPROTO::getOwnAvatarThread(void*) char *AvatarURL, *AvatarTs;
if (getAvatarFileInfo(getDword(GG_KEY_UIN, 0), &AvatarURL, &AvatarTs)) {
- if (AvatarURL != NULL && AvatarTs != NULL > 0) {
+ if (AvatarURL != NULL && AvatarTs != NULL) {
setString(GG_KEY_AVATARURL, AvatarURL);
setString(GG_KEY_AVATARTS, AvatarTs);
mir_free(AvatarURL); mir_free(AvatarTs);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index f37120f268..0a4883ba4b 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1561,10 +1561,9 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) if (szNick)
setTString(hContact, GG_KEY_NICK, szNick);
else if (isonline()) {
- gg_pubdir50_t req;
-
// Search for that nick
- if (req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)) {
+ gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
+ if (req) {
// Add uin and search it
gg_pubdir50_add(req, GG_PUBDIR50_UIN, ditoa(uin));
gg_pubdir50_seq_set(req, GG_SEQ_GETNICK);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 1c57a0b590..aecff512e9 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -816,7 +816,6 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, break; { TCHAR text[256]; - gg_pubdir50_t req; GGPROTO *gg = dat->gg; if (!gg->isonline()) @@ -829,7 +828,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_SAVE), FALSE); - req = gg_pubdir50_new(GG_PUBDIR50_WRITE); + gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_WRITE); GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text)); if (mir_tstrlen(text)) diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 61d8ab6014..932aa9f94e 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -908,7 +908,6 @@ int GGPROTO::RecvFile(MCONTACT hContact, PROTORECVFILET* pre) HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
{
char *bslash, *filename;
- struct gg_dcc *dcc;
DWORD ip, ver;
WORD port;
uin_t myuin, uin;
@@ -928,10 +927,10 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** // Use DCC7 if a contact is using at least version 7.6 or unknown version
if ((ver & 0x00ffffff) >= 0x29 || !ver) {
- struct gg_dcc7 *dcc7;
gg_EnterCriticalSection(&sess_mutex, "SendFile", 46, "sess_mutex", 1);
- if (!(dcc7 = gg_dcc7_send_file(sess, uin, filename, NULL, NULL))) {
+ struct gg_dcc7 *dcc7 = gg_dcc7_send_file(sess, uin, filename, NULL, NULL);
+ if (!dcc7) {
gg_LeaveCriticalSection(&sess_mutex, "SendFile", 46, 1, "sess_mutex", 1);
debugLogA("SendFile(): Failed to send file \"%s\".", filename);
mir_free(filename);
@@ -967,6 +966,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** }
// Try to connect if not ask user to connect me
+ struct gg_dcc *dcc = NULL;
if ((ip && port >= 10 && !(dcc = gg_dcc_send_file(ip, port, myuin, uin))) || (port < 10 && port > 0))
{
// Make fake dcc structure
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 0b1aa1d837..1d62a341fd 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -147,38 +147,34 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO void GGPROTO::cleanuplastplugin(DWORD version)
{
- // Store current plugin version
- setDword(GG_PLUGINVERSION, pluginInfo.version);
-
- //1. clean files: %miranda_avatarcache%\GG\*.(null)
- if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){
- debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
-
- TCHAR avatarsPath[MAX_PATH];
- mir_sntprintf(avatarsPath, SIZEOF(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
-
- debugLog(_T("cleanuplastplugin() 1: miranda_avatarcache = %s"), avatarsPath);
-
- if (avatarsPath != NULL){
- HANDLE hFind = INVALID_HANDLE_VALUE;
- TCHAR spec[MAX_PATH + 10];
- mir_sntprintf(spec, SIZEOF(spec), _T("%s\\*.(null)"), avatarsPath);
- WIN32_FIND_DATA ffd;
- hFind = FindFirstFile(spec, &ffd);
- if (hFind != INVALID_HANDLE_VALUE) {
- do {
- TCHAR filePathT [2*MAX_PATH + 10];
- mir_sntprintf(filePathT, SIZEOF(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName);
- if (!_taccess(filePathT, 0)){
- debugLog(_T("cleanuplastplugin() 1: remove file = %s"), filePathT);
- _tremove(filePathT);
- }
- } while (FindNextFile(hFind, &ffd) != 0);
- FindClose(hFind);
- }
- }
- }
-
+ // Store current plugin version
+ setDword(GG_PLUGINVERSION, pluginInfo.version);
+
+ //1. clean files: %miranda_avatarcache%\GG\*.(null)
+ if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){
+ debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
+
+ TCHAR avatarsPath[MAX_PATH];
+ mir_sntprintf(avatarsPath, SIZEOF(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
+
+ debugLog(_T("cleanuplastplugin() 1: miranda_avatarcache = %s"), avatarsPath);
+
+ TCHAR spec[MAX_PATH + 10];
+ mir_sntprintf(spec, SIZEOF(spec), _T("%s\\*.(null)"), avatarsPath);
+ WIN32_FIND_DATA ffd;
+ HANDLE hFind = FindFirstFile(spec, &ffd);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ TCHAR filePathT [2*MAX_PATH + 10];
+ mir_sntprintf(filePathT, SIZEOF(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName);
+ if (!_taccess(filePathT, 0)){
+ debugLog(_T("cleanuplastplugin() 1: remove file = %s"), filePathT);
+ _tremove(filePathT);
+ }
+ } while (FindNextFile(hFind, &ffd) != 0);
+ FindClose(hFind);
+ }
+ }
}
//////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 7c98ed6bc9..509fddb0ff 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -265,10 +265,10 @@ void __cdecl GGPROTO::searchthread(void *) HANDLE GGPROTO::SearchBasic(const TCHAR *id)
{
if (!isonline())
- return (HANDLE)0;
+ return 0;
- gg_pubdir50_t req;
- if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) {
+ gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
+ if (!req) {
#ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread");
#endif
@@ -374,15 +374,12 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
{
- gg_pubdir50_t req;
- TCHAR text[64];
- unsigned long crc;
-
// Check if connected
if (!isonline())
- return (HWND)0;
+ return 0;
- if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
+ gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
+ if (!req)
{
#ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread");
@@ -394,6 +391,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) CMStringA szQuery;
// Fetch search data
+ TCHAR text[64];
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
if (mir_tstrlen(text))
{
@@ -482,10 +480,10 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // No data entered
if (szQuery.GetLength() <= 7 || (szQuery.GetLength() == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)))
- return (HWND)0;
+ return 0;
// Count crc & check if the data was equal if yes do same search with shift
- crc = crc_get(szQuery.GetBuffer());
+ unsigned long crc = crc_get(szQuery.GetBuffer());
if (crc == last_crc && next_uin)
gg_pubdir50_add(req, GG_PUBDIR50_START, ditoa(next_uin));
@@ -547,9 +545,9 @@ typedef struct void __cdecl GGPROTO::sendackthread(void *ack)
{
+ GG_SEQ_ACK *pAck = (GG_SEQ_ACK *)ack;
gg_sleep(100, FALSE, "sendackthread", 105, 1);
- ProtoBroadcastAck(((GG_SEQ_ACK *)ack)->hContact,
- ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) ((GG_SEQ_ACK *)ack)->seq, 0);
+ ProtoBroadcastAck(pAck->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) pAck->seq, 0);
mir_free(ack);
}
@@ -616,19 +614,20 @@ int GGPROTO::SetStatus(int iNewStatus) //////////////////////////////////////////////////////////
// when away message is requested
-void __cdecl GGPROTO::getawaymsgthread(void *hContact)
+void __cdecl GGPROTO::getawaymsgthread(void *arg)
{
DBVARIANT dbv;
+ MCONTACT hContact = (MCONTACT) arg;
debugLogA("getawaymsgthread(): started");
gg_sleep(100, FALSE, "getawaymsgthread", 106, 1);
- if (!db_get_s((MCONTACT)hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR))
+ if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR))
{
- ProtoBroadcastAck((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
debugLog(_T("getawaymsgthread(): Reading away msg <%s>."), dbv.ptszVal);
db_free(&dbv);
} else {
- ProtoBroadcastAck((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)NULL);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
debugLogA("getawaymsgthread(): end");
}
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 1a1983e4e5..279fea7174 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -289,7 +289,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count if (chat->ignore)
{
// Copy recipient list
- chat->recipients_count = recipients_count + (sender ? 1 : 0);
+ chat->recipients_count = recipients_count + 1;
chat->recipients = (uin_t *)calloc(chat->recipients_count, sizeof(uin_t));
for(i = 0; i < recipients_count; i++)
chat->recipients[i] = recipients[i];
@@ -480,7 +480,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa free(participants);
}
}
-
+ // fall through
case IDCANCEL:
DestroyWindow(hwndDlg);
break;
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index b82a30418f..6922b85c2c 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -385,6 +385,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) mir_free(contacts);
MessageBox(NULL, TranslateT("List import successful."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
+ return 0;
}
else
{
@@ -392,9 +393,9 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) mir_sntprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(_T("import_text(): Cannot import list from file \"%s\". errno=%d: %s"), str, errno, strerror(errno));
+ fclose(f);
+ return 0;
}
-
- return 0;
}
INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 834ccc8876..220d71a884 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -251,7 +251,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) }
else if ((wParam & GAIF_FORCE) != 0) {
if (AvatarHash == NULL && AvatarSavedHash != NULL) {
- getAvatarFilename(pai->hContact, pai->filename, sizeof(pai->filename));
+ getAvatarFilename(pai->hContact, pai->filename, SIZEOF(pai->filename));
if (_tremove(pai->filename) != 0){
debugLog(_T("getavatarinfo(): delete. _tremove file %s error. errno=%d: %s"), pai->filename, errno, strerror(errno));
TCHAR error[512];
@@ -351,10 +351,9 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam) INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam)
{
INT_PTR res = 0;
- TCHAR *szMsg;
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1);
- szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
+ TCHAR *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
if (isonline() && szMsg)
res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szMsg) : (INT_PTR)mir_t2a(szMsg);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 11f72ef8ce..14dc02b004 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -106,16 +106,12 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l // Gets GG token
int GGPROTO::gettoken(GGTOKEN *token)
{
- struct gg_http *h = NULL;
- struct gg_token *t = NULL;
- IMGSRVC_MEMIO memio = {0};
- GGTOKENDLGDATA dat = {0};
-
// Zero tokens
mir_strcpy(token->id, "");
mir_strcpy(token->val, "");
- if (!(h = gg_token(0)) || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
+ struct gg_http *h = gg_token(0);
+ if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
TCHAR error[128];
mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -123,22 +119,25 @@ int GGPROTO::gettoken(GGTOKEN *token) return FALSE;
}
- if (!(t = (struct gg_token *)h->data) || (!h->body)) {
+ struct gg_token *t = (struct gg_token *)h->data;
+ if (!t || !h->body) {
TCHAR error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
+ mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
}
// Return token id
+ GGTOKENDLGDATA dat = {0};
strncpy(dat.id, t->tokenid, sizeof(dat.id));
dat.width = t->width;
dat.height = t->height;
// Load bitmap
+ IMGSRVC_MEMIO memio = {0};
memio.iLen = h->body_size;
- memio.pBuf = (void *)h->body;
+ memio.pBuf = h->body;
memio.fif = FIF_UNKNOWN; /* detect */
memio.flags = 0;
dat.hBitmap = (HBITMAP) CallService(MS_IMG_LOADFROMMEM, (WPARAM) &memio, 0);
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index ec4441b2a3..3f3f06d14c 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -41,7 +41,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) 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, TranslateT("Cannot register new account because of error:\n\t%s"),
- (h && !s) ? http_error_string(h ? h->error : 0) :
+ (h && !s) ? http_error_string(h->error) :
(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));
@@ -86,7 +86,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) {
TCHAR error[128];
mir_sntprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
- (h && !s) ? http_error_string(h ? h->error : 0) :
+ (h && !s) ? http_error_string(h->error) :
(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));
@@ -138,7 +138,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) {
TCHAR error[128];
mir_sntprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
- (h && !s) ? http_error_string(h ? h->error : 0) :
+ (h && !s) ? http_error_string(h->error) :
(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));
@@ -163,24 +163,24 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) 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;
+ GGTOKEN 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)
+ // Connection handles
+ struct gg_pubdir *s;
+ struct gg_http *h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0);
+ if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
TCHAR error[128];
mir_sntprintf(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)));
+ (h && !s) ? http_error_string(h->error) : (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));
}
|