summaryrefslogtreecommitdiff
path: root/src/modules/utils/openurl.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-06 13:58:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-06 13:58:20 +0000
commit46a53191c1ad11a41c948594e972568e62d155b4 (patch)
tree7e57e6f7093fb0de766fe13a933d2f9231433e4d /src/modules/utils/openurl.cpp
parent1fe5acae909ea64a1de9ac9f58cae5a3c2d3ad1f (diff)
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@332 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/utils/openurl.cpp')
-rw-r--r--src/modules/utils/openurl.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp
index 02ea139090..d6a4a937f4 100644
--- a/src/modules/utils/openurl.cpp
+++ b/src/modules/utils/openurl.cpp
@@ -46,18 +46,18 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
case WM_DDE_DATA:
UnpackDDElParam(msg,lParam,(PUINT_PTR)&hDdeData,(PUINT_PTR)&hSzItem);
dat->fData=1;
- if(hDdeData) {
+ if (hDdeData) {
DDEDATA *data;
int release;
data=(DDEDATA*)GlobalLock(hDdeData);
- if(data->fAckReq) {
+ if (data->fAckReq) {
DDEACK ack={0};
PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,PackDDElParam(WM_DDE_ACK,*(PUINT)&ack,(UINT)hSzItem));
}
else GlobalDeleteAtom(hSzItem);
release=data->fRelease;
GlobalUnlock(hDdeData);
- if(release) GlobalFree(hDdeData);
+ if (release) GlobalFree(hDdeData);
}
else GlobalDeleteAtom(hSzItem);
return 0;
@@ -73,23 +73,23 @@ static int DoDdeRequest(const char *szItemName,HWND hwndDdeMsg)
struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg,0);
hSzItemName=GlobalAddAtomA(szItemName);
- if(!PostMessage(dat->hwndDde,WM_DDE_REQUEST,(WPARAM)hwndDdeMsg,MAKELPARAM(CF_TEXT,hSzItemName))) {
+ if (!PostMessage(dat->hwndDde,WM_DDE_REQUEST,(WPARAM)hwndDdeMsg,MAKELPARAM(CF_TEXT,hSzItemName))) {
GlobalDeleteAtom(hSzItemName);
return 1;
}
timeoutTick=GetTickCount()+5000;
dat->fData=0; dat->fAcked=0;
do {
- if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
+ if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- if(dat->fData || dat->fAcked) break;
+ if (dat->fData || dat->fAcked) break;
thisTick=GetTickCount();
- if(thisTick>timeoutTick) break;
+ if (thisTick>timeoutTick) break;
} while(MsgWaitForMultipleObjects(0,NULL,FALSE,timeoutTick-thisTick,QS_ALLINPUT)==WAIT_OBJECT_0);
- if(!dat->fData) {
+ if (!dat->fData) {
GlobalDeleteAtom(hSzItemName);
return 1;
}
@@ -107,7 +107,7 @@ static int DdeOpenUrl(const char *szBrowser,char *szUrl,int newWindow,HWND hwndD
hSzBrowser=GlobalAddAtomA(szBrowser);
hSzTopic=GlobalAddAtomA("WWW_OpenURL");
dat->fAcked=0;
- if(!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDdeMsg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,&dwResult)
+ if (!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDdeMsg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,&dwResult)
|| !dat->fAcked) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
@@ -115,7 +115,7 @@ static int DdeOpenUrl(const char *szBrowser,char *szUrl,int newWindow,HWND hwndD
}
szItemName=(char*)mir_alloc(lstrlenA(szUrl)+7);
wsprintfA(szItemName,"\"%s\",,%d",szUrl,newWindow?0:-1);
- if(DoDdeRequest(szItemName,hwndDdeMsg)) {
+ if (DoDdeRequest(szItemName,hwndDdeMsg)) {
mir_free(szItemName);
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
@@ -150,21 +150,21 @@ static void OpenURLThread(void *arg)
hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW,_T(""),0,0,0,0,0,NULL,NULL,hMirandaInst,NULL);
SetWindowLongPtr(hwndDdeMsg,0,(LONG_PTR)&msgWndData);
- if(!_strnicmp(hUrlInfo->szUrl,"ftp:",4) || !_strnicmp(hUrlInfo->szUrl,"ftp.",4)) pszProtocol="ftp";
- if(!_strnicmp(hUrlInfo->szUrl,"mailto:",7)) pszProtocol="mailto";
- if(!_strnicmp(hUrlInfo->szUrl,"news:",5)) pszProtocol="news";
+ if (!_strnicmp(hUrlInfo->szUrl,"ftp:",4) || !_strnicmp(hUrlInfo->szUrl,"ftp.",4)) pszProtocol="ftp";
+ if (!_strnicmp(hUrlInfo->szUrl,"mailto:",7)) pszProtocol="mailto";
+ if (!_strnicmp(hUrlInfo->szUrl,"news:",5)) pszProtocol="news";
else pszProtocol="http";
wsprintfA(szSubkey,"%s\\shell\\open\\command",pszProtocol);
- if(RegOpenKeyExA(HKEY_CURRENT_USER,szSubkey,0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS
+ if (RegOpenKeyExA(HKEY_CURRENT_USER,szSubkey,0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS
|| RegOpenKeyExA(HKEY_CLASSES_ROOT,szSubkey,0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS) {
dataLength=SIZEOF(szCommandName);
- if(RegQueryValueEx(hKey,NULL,NULL,NULL,(PBYTE)szCommandName,&dataLength)==ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey,NULL,NULL,NULL,(PBYTE)szCommandName,&dataLength)==ERROR_SUCCESS) {
_strlwr(szCommandName);
- if(strstr(szCommandName,"mozilla") || strstr(szCommandName,"netscape"))
+ if (strstr(szCommandName,"mozilla") || strstr(szCommandName,"netscape"))
success=(DdeOpenUrl("mozilla",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg)==0 || DdeOpenUrl("netscape",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg)==0);
- else if(strstr(szCommandName,"iexplore") || strstr(szCommandName,"msimn"))
+ else if (strstr(szCommandName,"iexplore") || strstr(szCommandName,"msimn"))
success=0==DdeOpenUrl("iexplore",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg);
- else if(strstr(szCommandName,"opera"))
+ else if (strstr(szCommandName,"opera"))
success=0==DdeOpenUrl("opera",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg);
//opera's the default anyway
}
@@ -172,19 +172,19 @@ static void OpenURLThread(void *arg)
}
DestroyWindow(hwndDdeMsg);
- if(success) return;
+ if (success) return;
//wack a protocol on it
- if((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1]==':') || hUrlInfo->szUrl[0]=='\\') {
+ if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\') {
szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+9);
wsprintfA(szResult,"file:///%s",hUrlInfo->szUrl);
}
else {
int i;
- for(i=0;isalpha(hUrlInfo->szUrl[i]);i++);
- if(hUrlInfo->szUrl[i]==':') szResult=mir_strdup(hUrlInfo->szUrl);
+ for (i=0;isalpha(hUrlInfo->szUrl[i]);i++);
+ if (hUrlInfo->szUrl[i] == ':') szResult=mir_strdup(hUrlInfo->szUrl);
else {
- if(!_strnicmp(hUrlInfo->szUrl,"ftp.",4)) {
+ if (!_strnicmp(hUrlInfo->szUrl,"ftp.",4)) {
szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+7);
wsprintfA(szResult,"ftp://%s",hUrlInfo->szUrl);
}