diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
commit | d154673f93ad95197bce8cadb995daa5bc39f5d8 (patch) | |
tree | 191522aa88f9f845a9c27b1ddb86116b87033c4b /src/modules/protocols | |
parent | be50a70bfd8b3f3daf0c3351fdce6e2fea515bd7 (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@7820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/protocols')
-rw-r--r-- | src/modules/protocols/protoaccs.cpp | 34 | ||||
-rw-r--r-- | src/modules/protocols/protochains.cpp | 8 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 16 | ||||
-rw-r--r-- | src/modules/protocols/protoopts.cpp | 20 |
4 files changed, 39 insertions, 39 deletions
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 6c763fc08b..57cd4cad41 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -45,8 +45,8 @@ LIST<PROTOACCOUNT> accounts(10, CompareAccounts); static int EnumDbModules(const char *szModuleName, DWORD ofsModuleName, LPARAM lParam)
{
DBVARIANT dbv;
- if ( !db_get_s(NULL, szModuleName, "AM_BaseProto", &dbv)) {
- if ( !Proto_GetAccount(szModuleName)) {
+ if (!db_get_s(NULL, szModuleName, "AM_BaseProto", &dbv)) {
+ if (!Proto_GetAccount(szModuleName)) {
PROTOACCOUNT* pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
pa->cbSize = sizeof(*pa);
pa->szModuleName = mir_strdup(szModuleName);
@@ -92,7 +92,7 @@ void LoadDbAccounts(void) if (ver >= 4) {
db_free(&dbv);
_itoa(OFFSET_NAME+i, buf, 10);
- if ( !db_get_ts(NULL, "Protocols", buf, &dbv)) {
+ if (!db_get_ts(NULL, "Protocols", buf, &dbv)) {
pa->tszAccountName = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -100,19 +100,19 @@ void LoadDbAccounts(void) _itoa(OFFSET_ENABLED+i, buf, 10);
pa->bIsEnabled = db_get_dw(NULL, "Protocols", buf, 1);
- if ( !db_get_s(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) {
+ if (!db_get_s(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) {
pa->szProtoName = mir_strdup(dbv.pszVal);
db_free(&dbv);
}
}
else pa->bIsEnabled = TRUE;
- if ( !pa->szProtoName) {
+ if (!pa->szProtoName) {
pa->szProtoName = mir_strdup(pa->szModuleName);
db_set_s(NULL, pa->szModuleName, "AM_BaseProto", pa->szProtoName);
}
- if ( !pa->tszAccountName)
+ if (!pa->tszAccountName)
pa->tszAccountName = mir_a2t(pa->szModuleName);
accounts.insert(pa);
@@ -225,12 +225,12 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) for (int i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !pa->ppro || !Proto_IsAccountEnabled(pa))
+ if (!pa->ppro || !Proto_IsAccountEnabled(pa))
continue;
pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
- if ( !pa->bOldProto)
+ if (!pa->bOldProto)
count++;
}
@@ -247,7 +247,7 @@ static int UninitializeStaticAccounts(WPARAM, LPARAM) {
for (int i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !pa->ppro || !Proto_IsAccountEnabled(pa))
+ if (!pa->ppro || !Proto_IsAccountEnabled(pa))
continue;
pa->ppro->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0);
@@ -268,10 +268,10 @@ int LoadAccountsModule(void) if (pa->ppro)
continue;
- if ( !Proto_IsAccountEnabled(pa))
+ if (!Proto_IsAccountEnabled(pa))
continue;
- if ( !ActivateAccount(pa))
+ if (!ActivateAccount(pa))
pa->bDynDisabled = TRUE;
}
@@ -462,15 +462,15 @@ BOOL ActivateAccount(PROTOACCOUNT* pa) CreateProtoServiceEx(pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro);
CreateProtoServiceEx(pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro);
- if ( !ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFO))
+ if (!ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFO))
if ( ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFOW))
CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro);
- if ( !ProtoServiceExists(pa->szModuleName, PS_GETMYAVATAR))
+ if (!ProtoServiceExists(pa->szModuleName, PS_GETMYAVATAR))
if ( ProtoServiceExists(pa->szModuleName, PS_GETMYAVATARW))
CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro);
- if ( !ProtoServiceExists(pa->szModuleName, PS_SETMYAVATAR))
+ if (!ProtoServiceExists(pa->szModuleName, PS_SETMYAVATAR))
if ( ProtoServiceExists(pa->szModuleName, PS_SETMYAVATARW))
CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro);
@@ -570,7 +570,7 @@ void EraseAccount(const char* pszModuleName) if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)h1, (LPARAM)&dbcgs))
continue;
- if ( !lstrcmpA(szProtoName, pszModuleName))
+ if (!lstrcmpA(szProtoName, pszModuleName))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)h1, 0);
}
@@ -589,7 +589,7 @@ void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase) // szModuleName should be freed only on a program's exit.
// otherwise many plugins dependand on static protocol names will crash!
// do NOT fix this 'leak', please
- if ( !bIsDynamic) {
+ if (!bIsDynamic) {
mir_free(pa->szModuleName);
mir_free(pa);
}
@@ -597,7 +597,7 @@ void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase) void UnloadAccountsModule()
{
- if ( !bModuleInitialized) return;
+ if (!bModuleInitialized) return;
for (int i = accounts.getCount()-1; i >= 0; i--) {
PROTOACCOUNT* pa = accounts[ i ];
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index 95392c4331..56080253dc 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -197,12 +197,12 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam) return 0;
char szContactProto[40];
- if ( !GetProtocolP((HANDLE)wParam, szContactProto, sizeof(szContactProto)))
- if ( !_stricmp(szProto, szContactProto))
+ if (!GetProtocolP((HANDLE)wParam, szContactProto, sizeof(szContactProto)))
+ if (!_stricmp(szProto, szContactProto))
return -1;
for (int i=0; i < filters.getCount(); i++)
- if ( !strcmp(szProto, filters[i]->szName))
+ if (!strcmp(szProto, filters[i]->szName))
return i+1;
return 0;
@@ -241,7 +241,7 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam, LPARAM lParam) int LoadProtoChains(void)
{
- if ( !db_get_b(NULL, "Compatibility", "Filters", 0)) {
+ if (!db_get_b(NULL, "Compatibility", "Filters", 0)) {
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)"_Filters");
db_set_b(NULL, "Compatibility", "Filters", 1);
}
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 4c86dead15..8ef8aadb2d 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -102,7 +102,7 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam) return 1;
p = (PROTOCOLDESCRIPTOR*)mir_alloc(sizeof(PROTOCOLDESCRIPTOR));
- if ( !p)
+ if (!p)
return 2;
if (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) {
@@ -205,7 +205,7 @@ static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam) static int Proto_ValidTypingContact(HANDLE hContact, char *szProto)
{
- if ( !hContact || !szProto)
+ if (!hContact || !szProto)
return 0;
return (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
@@ -215,7 +215,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) {
if (lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON) {
char *szProto = GetContactProto((HANDLE)wParam);
- if ( !szProto)
+ if (!szProto)
return 0;
if (Proto_ValidTypingContact((HANDLE)wParam, szProto))
@@ -229,7 +229,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) {
int type = (int)lParam;
char *szProto = GetContactProto((HANDLE)wParam);
- if ( !szProto)
+ if (!szProto)
return 0;
if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_TYPINGNOTIFY))
@@ -566,9 +566,9 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s }
}
- if ( !strcmp(szService, PS_ADDTOLIST)) {
+ if (!strcmp(szService, PS_ADDTOLIST)) {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if ( !(psr->flags & PSR_UNICODE)) {
+ if (!(psr->flags & PSR_UNICODE)) {
PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
memcpy(psra, psr, psr->cbSize);
psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
@@ -591,7 +591,7 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s if (res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr(szService, 'W')) {
TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
- if ( !item) return res;
+ if (!item) return res;
switch(item->id) {
case 100:
@@ -721,7 +721,7 @@ int LoadProtocolsModule(void) void UnloadProtocolsModule()
{
- if ( !bModuleInitialized) return;
+ if (!bModuleInitialized) return;
if (hAccListChanged) {
DestroyHookableEvent(hAccListChanged);
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index eddded512c..61fdd46177 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -184,7 +184,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam }
pa->szModuleName = mir_strdup(buf);
- if ( !pa->tszAccountName[0]) {
+ if (!pa->tszAccountName[0]) {
mir_free(pa->tszAccountName);
pa->tszAccountName = mir_a2t(buf);
}
@@ -194,7 +194,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam if ( ActivateAccount(pa)) {
pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
- if ( !db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
+ if (!db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
}
@@ -278,7 +278,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct TAccListData *dat = (struct TAccListData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if ( !dat)
+ if (!dat)
return DefWindowProc(hwnd, msg, wParam, lParam);
switch (msg) {
@@ -329,7 +329,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA RECT rc;
struct TAccMgrData *parentDat = (struct TAccMgrData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwnd, ListBox_GetCurSel(hwnd));
- if ( !pa || pa->bOldProto || pa->bDynDisabled)
+ if (!pa || pa->bOldProto || pa->bDynDisabled)
return 0;
ListBox_GetItemRect(hwnd, ListBox_GetCurSel(hwnd), &rc);
@@ -423,7 +423,7 @@ static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat) ShowWindow( GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_HIDE);
ShowWindow(pa->hwndAccMgrUI, SW_SHOW);
}
- else if ( !pa->ppro) {
+ else if (!pa->ppro) {
ShowWindow( GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW);
SetWindowText( GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT("Account is disabled. Please activate it to access options."));
}
@@ -625,7 +625,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM ci.hContact = NULL;
ci.szProto = acc->szModuleName;
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(text, size, _T("%s: %s"), tszIdName, ci.pszVal);
@@ -711,7 +711,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (iItem != LB_ERR) {
PROTOACCOUNT* pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, iItem);
HMENU hMenu = CreatePopupMenu();
- if ( !pa->bOldProto && !pa->bDynDisabled)
+ if (!pa->bOldProto && !pa->bDynDisabled)
AppendMenu(hMenu, MF_STRING, 1, TranslateT("Rename"));
AppendMenu(hMenu, MF_STRING, 3, TranslateT("Delete"));
@@ -775,7 +775,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (pa->bIsEnabled) {
if (ActivateAccount(pa)) {
pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
- if ( !db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
+ if (!db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
}
@@ -791,7 +791,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM }
}
- if ( !pa->bIsEnabled)
+ if (!pa->bIsEnabled)
DeactivateAccount(pa, true, false);
}
@@ -1034,7 +1034,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM static INT_PTR OptProtosShow(WPARAM, LPARAM)
{
- if ( !hAccMgr)
+ if (!hAccMgr)
hAccMgr = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGR), NULL, AccMgrDlgProc, 0);
ShowWindow(hAccMgr, SW_RESTORE);
|