diff options
author | George Hazan <george.hazan@gmail.com> | 2014-09-29 13:01:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-09-29 13:01:32 +0000 |
commit | eb4cd74284c52a9da97119aea2abc66c4c0c363d (patch) | |
tree | 503477c49cf685b527e0d0a2915486516b27f40a /src/core/stdauth | |
parent | 6f20d680f5f175ca2b4669ea7fc27fa34ca7dfd3 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@10626 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdauth')
-rw-r--r-- | src/core/stdauth/auth.cpp | 9 | ||||
-rw-r--r-- | src/core/stdauth/authdialogs.cpp | 87 |
2 files changed, 46 insertions, 50 deletions
diff --git a/src/core/stdauth/auth.cpp b/src/core/stdauth/auth.cpp index d55a16898d..f2cfaa041b 100644 --- a/src/core/stdauth/auth.cpp +++ b/src/core/stdauth/auth.cpp @@ -59,7 +59,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) MCONTACT hContact = DbGetAuthEventContact(&dbei);
- CLISTEVENT cli = {0};
+ CLISTEVENT cli = { 0 };
cli.cbSize = sizeof(cli);
cli.hContact = hContact;
cli.ptszTooltip = szTooltip;
@@ -67,12 +67,12 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) cli.lParam = lParam;
cli.hDbEvent = hDbEvent;
- CONTACTINFO ci = {0};
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.hContact = hContact;
ci.szProto = GetContactProto(hContact);
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
- if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
mir_sntprintf(szUid, SIZEOF(szUid), _T("%s"), ci.pszVal);
@@ -117,7 +117,6 @@ int LoadSendRecvAuthModule(void) HookEvent(ME_DB_EVENT_ADDED, AuthEventAdded);
SkinAddNewSoundEx("AuthRequest", LPGEN("Alerts"), LPGEN("Authorization request"));
- SkinAddNewSoundEx("AddedEvent", LPGEN("Alerts"), LPGEN("Added event"));
-
+ SkinAddNewSoundEx("AddedEvent", LPGEN("Alerts"), LPGEN("Added event"));
return 0;
}
diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 92e5234f89..e8894a8aa6 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -30,14 +30,13 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
-
- hDbEvent = (HANDLE)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ TranslateDialogDefault(hwndDlg);
+ Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
+ Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
+ hDbEvent = (HANDLE)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ {
//blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
@@ -46,10 +45,10 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar DWORD uin = *(PDWORD)dbei.pBlob;
MCONTACT hContact = DbGetAuthEventContact(&dbei);
- char* nick = (char*)dbei.pBlob + sizeof(DWORD)*2;
- char* first = nick + strlen(nick) + 1;
+ char* nick = (char*)dbei.pBlob + sizeof(DWORD) * 2;
+ char* first = nick + strlen(nick) + 1;
char* last = first + strlen(first) + 1;
- char* email = last + strlen(last) + 1;
+ char* email = last + strlen(last) + 1;
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
@@ -69,14 +68,13 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar off = mir_sntprintf(name, SIZEOF(name), _T("%s"), firstT);
else if (lastT[0])
off = mir_sntprintf(name, SIZEOF(name), _T("%s"), lastT);
- if (nickT[0])
- {
+ if (nickT[0]) {
if (off)
mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), nickT);
else
mir_sntprintf(name, SIZEOF(name), _T("%s"), nickT);
}
- if ( !name[0])
+ if (!name[0])
_tcscpy(name, TranslateT("<Unknown>"));
TCHAR hdr[256];
@@ -104,33 +102,34 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_ADD:
- {
- ADDCONTACTSTRUCT acs = {0};
- acs.hDbEvent = hDbEvent;
- acs.handleType = HANDLE_EVENT;
- acs.szProto = "";
- CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
-
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
- if ((hContact == INVALID_CONTACT_ID) || !db_get_b(hContact, "CList", "NotOnList", 0))
- ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hDbEvent = hDbEvent;
+ acs.handleType = HANDLE_EVENT;
+ acs.szProto = "";
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+
+ MCONTACT hContact = (MCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
+ if ((hContact == INVALID_CONTACT_ID) || !db_get_b(hContact, "CList", "NotOnList", 0))
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ }
break;
- }
+
case IDC_DETAILS:
- {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
- CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
+ {
+ MCONTACT hContact = (MCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
+ CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
+ }
break;
- }
case IDOK:
- {
- ADDCONTACTSTRUCT acs = {0};
- acs.hDbEvent = hDbEvent;
- acs.handleType = HANDLE_EVENT;
- acs.szProto = "";
- CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- }
+ {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hDbEvent = hDbEvent;
+ acs.handleType = HANDLE_EVENT;
+ acs.szProto = "";
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+ }
//fall through
case IDCANCEL:
DestroyWindow(hwndDlg);
@@ -169,10 +168,10 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DWORD uin = *(PDWORD)dbei.pBlob;
MCONTACT hContact = DbGetAuthEventContact(&dbei);
- char *nick = (char*)dbei.pBlob + sizeof(DWORD)*2;
- char *first = nick + strlen(nick) + 1;
+ char *nick = (char*)dbei.pBlob + sizeof(DWORD) * 2;
+ char *first = nick + strlen(nick) + 1;
char *last = first + strlen(first) + 1;
- char *email = last + strlen(last) + 1;
+ char *email = last + strlen(last) + 1;
char *reason = email + strlen(email) + 1;
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
@@ -200,7 +199,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else
mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)nickT);
}
- if ( !name[0])
+ if (!name[0])
_tcscpy(name, TranslateT("<Unknown>"));
TCHAR hdr[256];
@@ -222,7 +221,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwndDlg, IDC_DENYREASON), FALSE);
SetDlgItemText(hwndDlg, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
}
- if ( !db_get_b(hContact, "CList", "NotOnList", 0)) {
+ if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_ADDCHECK), FALSE);
CheckDlgButton(hwndDlg, IDC_ADDCHECK, BST_UNCHECKED);
}
@@ -249,7 +248,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK)) {
- ADDCONTACTSTRUCT acs = {0};
+ ADDCONTACTSTRUCT acs = { 0 };
acs.hDbEvent = hDbEvent;
acs.handleType = HANDLE_EVENT;
acs.szProto = "";
@@ -264,14 +263,12 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
- if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON)))
- {
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
TCHAR szReason[256];
GetDlgItemText(hwndDlg, IDC_DENYREASON, szReason, SIZEOF(szReason));
CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, (LPARAM)szReason);
}
- else
- CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, 0);
+ else CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, 0);
}
DestroyWindow(hwndDlg);
break;
|