summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin10/lib/mir_core.libbin53506 -> 54206 bytes
-rw-r--r--bin10/lib/mir_core64.libbin48940 -> 49574 bytes
-rw-r--r--bin11/lib/mir_core.libbin53506 -> 54206 bytes
-rw-r--r--bin11/lib/mir_core64.libbin48940 -> 49574 bytes
-rw-r--r--include/delphi/m_core.inc15
-rw-r--r--include/m_core.h5
-rw-r--r--plugins/BossKeyPlus/src/BossKeyIdle.cpp16
-rw-r--r--plugins/CryptoPP/src/GPGw/gpg_main.cpp457
-rw-r--r--plugins/Popup/src/services.cpp87
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp90
-rw-r--r--plugins/YAPP/src/message_pump.cpp94
-rw-r--r--plugins/YAPP/src/message_pump.h1
-rw-r--r--plugins/YAPP/src/notify_imp.cpp3
-rw-r--r--plugins/YAPP/src/options.cpp46
-rw-r--r--plugins/YAPP/src/popwin.cpp141
-rw-r--r--protocols/GTalkExt/src/handlers.cpp3
-rw-r--r--protocols/GTalkExt/src/inbox.cpp2
-rw-r--r--protocols/GTalkExt/src/notifications.cpp20
-rw-r--r--protocols/GTalkExt/src/tipper_items.cpp104
-rw-r--r--src/core/stdidle/idle.cpp59
-rw-r--r--src/mir_core/mir_core.def5
-rw-r--r--src/mir_core/winver.cpp55
22 files changed, 520 insertions, 683 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index ead24d2190..2bb58df787 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 2c7ced7bc6..10026a72a6 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib
index 879e20f9c0..02c2395132 100644
--- a/bin11/lib/mir_core.lib
+++ b/bin11/lib/mir_core.lib
Binary files differ
diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib
index fa4601ab41..9b93107b93 100644
--- a/bin11/lib/mir_core64.lib
+++ b/bin11/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index abc3713971..40298ee87b 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -742,8 +742,17 @@ procedure mir_unsubclassWindow(Wnd:HWND; WndProc:TWNDPROC); stdcall;
external CoreDLL name 'mir_unsubclassWindow';
///////////////////////////////////////////////////////////////////////////////
-
-procedure UnloadCoreModule(); stdcall;
- external CoreDLL name 'UnloadCoreModule';
+// Windows utilities
+
+function IsWinVerVistaPlus():int; stdcall;
+ external CoreDLL name 'IsWinVerVistaPlus';
+function IsWinVer7Plus():int; stdcall;
+ external CoreDLL name 'IsWinVer7Plus';
+function IsFullScreen():int; stdcall;
+ external CoreDLL name 'IsFullScreen';
+function IsWorkstationLocked():int; stdcall;
+ external CoreDLL name 'IsWorkstationLocked';
+function IsScreenSaverRunning():int; stdcall;
+ external CoreDLL name 'IsScreenSaverRunning';
{$ENDIF}
diff --git a/include/m_core.h b/include/m_core.h
index 93e97b1ba6..accab97bf1 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -898,10 +898,15 @@ MIR_CORE_DLL(void) mir_unsubclassWindow(HWND hWnd, WNDPROC wndProc);
MIR_CORE_DLL(void) KillModuleSubclassing(HMODULE hInst);
///////////////////////////////////////////////////////////////////////////////
+// Windows utilities
MIR_CORE_DLL(BOOL) IsWinVerVistaPlus();
MIR_CORE_DLL(BOOL) IsWinVer7Plus();
+MIR_CORE_DLL(BOOL) IsFullScreen();
+MIR_CORE_DLL(BOOL) IsWorkstationLocked();
+MIR_CORE_DLL(BOOL) IsScreenSaverRunning();
+
///////////////////////////////////////////////////////////////////////////////
MIR_CORE_DLL(void) UnloadCoreModule(void);
diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp
index a97bf01abc..806f3820e1 100644
--- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp
+++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp
@@ -29,13 +29,6 @@ UINT mouseidle, minutes;
VOID CALLBACK IdleTimer(HWND hwnd, UINT umsg, UINT idEvent, DWORD dwTime);
-static bool IsScreenSaverRunning()
-{
- bool rc = FALSE;
- SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &rc, FALSE);
- return rc;
-}
-
static bool IsUserIdle()
{
DWORD dwTick;
@@ -53,14 +46,11 @@ static bool IsUserIdle()
return FALSE;
}
-
VOID CALLBACK IdleTimer(HWND hwnd, UINT umsg, UINT_PTR idEvent, DWORD dwTime)
{
- if ( hTimer == idEvent && !g_bWindowHidden &&
- ((g_wMaskAdv & (OPT_HIDEIFWINIDLE | OPT_HIDEIFMIRIDLE) && IsUserIdle()) ||
- (g_wMaskAdv & OPT_HIDEIFSCRSVR && IsScreenSaverRunning())))
-
- BossKeyHideMiranda(0, 0);
+ if ( hTimer == idEvent && !g_bWindowHidden && ((g_wMaskAdv & (OPT_HIDEIFWINIDLE | OPT_HIDEIFMIRIDLE) && IsUserIdle()) ||
+ (g_wMaskAdv & OPT_HIDEIFSCRSVR) && IsScreenSaverRunning()))
+ BossKeyHideMiranda(0, 0);
}
void InitIdleTimer()
diff --git a/plugins/CryptoPP/src/GPGw/gpg_main.cpp b/plugins/CryptoPP/src/GPGw/gpg_main.cpp
index 700e27b691..61c076e8df 100644
--- a/plugins/CryptoPP/src/GPGw/gpg_main.cpp
+++ b/plugins/CryptoPP/src/GPGw/gpg_main.cpp
@@ -15,29 +15,29 @@ char *txtendpgpmessage="-----END PGP MESSAGE-----";
void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint)
{
- char buffer[errormessagesize];
+ char buffer[errormessagesize];
- strcpy(buffer, atext);
- strcat(buffer, " ");
- strcat(buffer, ahint);
- MessageBox(NULL, buffer, alevel, MB_OK);
+ strcpy(buffer, atext);
+ strcat(buffer, " ");
+ strcat(buffer, ahint);
+ MessageBox(NULL, buffer, alevel, MB_OK);
}
void __cdecl LogMessage(const char *astart, const char *atext, const char *aend)
{
- FILE *log;
-
- if(logfile[0]=='\0') return;
-
- log=fopen(logfile, "a");
- if(log!=NULL)
- {
- fputs(astart, log);
- fputs(atext, log);
- fputs(aend, log);
- fclose(log);
- }
+ FILE *log;
+
+ if(logfile[0]=='\0') return;
+
+ log=fopen(logfile, "a");
+ if(log!=NULL)
+ {
+ fputs(astart, log);
+ fputs(atext, log);
+ fputs(aend, log);
+ fclose(log);
+ }
}
int __cdecl _gpg_init()
@@ -62,21 +62,21 @@ int __cdecl _gpg_done()
int __cdecl _gpg_open_keyrings(LPSTR ExecPath, LPSTR HomePath)
{
- if ( !ExecPath || (!*ExecPath && !ShowSelectExecDlg(ExecPath)) ) {
- return 0;
- }
- if ( !HomePath || (!*HomePath && !ShowSelectHomeDlg(HomePath)) ) {
- return 0;
- }
- if ( !existsFile(ExecPath) ) {
-// ErrorMessage(txtwarning, txtinvalidexecutable, txtverifyoptions);
- return 0;
- }
- strcpy(gpgExecutable, ExecPath);
- strcpy(gpgHomeDirectory, HomePath);
- updateKeyUserIDs(publickeyuserid);
- updateKeyUserIDs(secretkeyuserid);
- return 1;
+ if ( !ExecPath || (!*ExecPath && !ShowSelectExecDlg(ExecPath)) ) {
+ return 0;
+ }
+ if ( !HomePath || (!*HomePath && !ShowSelectHomeDlg(HomePath)) ) {
+ return 0;
+ }
+ if ( !existsFile(ExecPath) ) {
+ // ErrorMessage(txtwarning, txtinvalidexecutable, txtverifyoptions);
+ return 0;
+ }
+ strcpy(gpgExecutable, ExecPath);
+ strcpy(gpgHomeDirectory, HomePath);
+ updateKeyUserIDs(publickeyuserid);
+ updateKeyUserIDs(secretkeyuserid);
+ return 1;
}
@@ -94,23 +94,23 @@ LPSTR __cdecl _gpg_get_error()
void __cdecl _gpg_set_log(LPCSTR LogPath)
{
- if(LogPath) strncpy(logfile,LogPath,sizeof(logfile));
- else logfile[0]='\0';
+ if(LogPath) strncpy(logfile,LogPath,sizeof(logfile));
+ else logfile[0]='\0';
}
void __cdecl _gpg_set_tmp(LPCSTR TmpPath)
{
- if(TmpPath) strncpy(temporarydirectory,TmpPath,sizeof(temporarydirectory));
- else GetTempPath(sizeof(temporarydirectory),temporarydirectory);
+ if(TmpPath) strncpy(temporarydirectory,TmpPath,sizeof(temporarydirectory));
+ else GetTempPath(sizeof(temporarydirectory),temporarydirectory);
}
LPSTR __cdecl _gpg_get_passphrases()
{
- size_t i; char *b, x;
+ size_t i; char *b, x;
- b = (char *) LocalAlloc(LPTR,(keyuseridsize+passphrasesize)*passphrasecount+1); *b = '\0';
+ b = (char *) LocalAlloc(LPTR,(keyuseridsize+passphrasesize)*passphrasecount+1); *b = '\0';
for(i=0; i<(size_t)passphrasecount; i++) {
strcat(b,passphrases[i].keyuserid); strcat(b,"\x01");
@@ -124,15 +124,15 @@ LPSTR __cdecl _gpg_get_passphrases()
if ( x>2 ) b[i]=x;
}
- return b;
+ return b;
}
void __cdecl _gpg_set_passphrases(LPCSTR buffer)
{
- size_t i, l = strlen(buffer); char *t, *p, *b, x;
+ size_t i, l = strlen(buffer); char *t, *p, *b, x;
- if ( !l ) return;
+ if ( !l ) return;
b = (char *) LocalAlloc(LPTR,l+1);
strcpy(b, buffer);
@@ -147,12 +147,12 @@ void __cdecl _gpg_set_passphrases(LPCSTR buffer)
while(*b) {
t = strchr(b, '\x02');
if(t) {
- *t = '\0';
+ *t = '\0';
p = strchr(b, '\x01');
*p = '\0';
addPassphrase(b, p+1);
t++;
- }
+ }
b = t;
}
LocalFree(b);
@@ -161,108 +161,105 @@ void __cdecl _gpg_set_passphrases(LPCSTR buffer)
LPSTR __cdecl _gpg_encrypt(LPCSTR message, LPCSTR keyid)
{
- char buffer[ciphertextsize];
- char *encmessage = 0;
- int encmessagelen;
- gpgResult gpgresult;
-
- if(strlen(keyid))
- {
- ZeroMemory(buffer, sizeof(buffer));
- gpgresult=gpgEncrypt(buffer, keyid, message);
-
- if(gpgresult!=gpgSuccess)
- {
-// ErrorMessage(txterror, txtencryptfailed, txtverifyoptions);
- return 0;
- }
- encmessagelen = strlen(buffer)+1;
- encmessage = (char *) LocalAlloc(LPTR,encmessagelen);
- MoveMemory(encmessage, buffer, encmessagelen);
- }
-
- return encmessage;
-}
+ char buffer[ciphertextsize];
+ char *encmessage = 0;
+ int encmessagelen;
+ gpgResult gpgresult;
+
+ if(strlen(keyid))
+ {
+ ZeroMemory(buffer, sizeof(buffer));
+ gpgresult=gpgEncrypt(buffer, keyid, message);
+
+ if(gpgresult!=gpgSuccess)
+ return 0;
+
+ encmessagelen = strlen(buffer)+1;
+ encmessage = (char *) LocalAlloc(LPTR,encmessagelen);
+ MoveMemory(encmessage, buffer, encmessagelen);
+ }
+ return encmessage;
+}
LPSTR __cdecl _gpg_decrypt(LPCSTR message)
{
- char buffer[ciphertextsize];
- char plaintext[plaintextsize];
- char keyuserid[keyuseridsize];
- int dlgresult;
- BOOL useridvalid;
- char *storedpassphrase;
- char passphrase[passphrasesize];
- char *decmessage = 0;
- int decmessagelen;
- gpgResult gpgresult;
-
- const char *begin = strstr(message, txtbeginpgpmessage);
- const char *end = strstr(message, txtendpgpmessage);
-
- if ((begin!=NULL)&&(end!=NULL))
- {
- strcpy(buffer, "");
- strncat(buffer, begin, end-begin+strlen(txtendpgpmessage));
- replace(buffer, "\r", "");
- replace(buffer, "\n", txtcrlf);
-
- ZeroMemory(keyuserid, sizeof(keyuserid));
- gpgresult=gpgDetectUserID(keyuserid, buffer);
- storedpassphrase=NULL;
-
- if(gpgresult!=gpgSuccess)
- {
-// ErrorMessage(txtwarning, txtdetectuseridfailed, txtverifyoptions);
- strcpy(keyuserid, txtunknownuserid);
- useridvalid=FALSE;
- }
- else
- {
- storedpassphrase=getPassphrase(keyuserid);
- useridvalid=TRUE;
- }
-
- if(storedpassphrase!=NULL)
- {
- strcpy(passphrase, storedpassphrase);
- ZeroMemory(plaintext, sizeof(plaintext));
- gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
- }
- else gpgresult=gpgUnknownError;
-
- dlgresult=IDOK;
- while((gpgresult!=gpgSuccess)&&(dlgresult!=IDCANCEL))
- {
- dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, PassphraseDialogProcedure, (LPARAM)keyuserid);
-
- if(dlgresult==IDOK)
- {
- strcpy(passphrase, dlgpassphrase);
- ZeroMemory(dlgpassphrase, passphrasesize);
- strcat(passphrase, txtcrlf);
- ZeroMemory(plaintext, sizeof(plaintext));
- gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
- }
- }
-
- if(gpgresult==gpgSuccess)
- {
- strcpy(buffer, plaintext);
- }
-
- if ( gpgresult==gpgSuccess && useridvalid==TRUE)
- addPassphrase(keyuserid, passphrase);
-
- ZeroMemory(passphrase, sizeof(passphrase));
-
- decmessagelen = strlen(buffer)+1;
- decmessage = (char *) LocalAlloc(LPTR,decmessagelen);
- MoveMemory(decmessage, buffer, decmessagelen);
- }
-
- return decmessage;
+ char buffer[ciphertextsize];
+ char plaintext[plaintextsize];
+ char keyuserid[keyuseridsize];
+ int dlgresult;
+ BOOL useridvalid;
+ char *storedpassphrase;
+ char passphrase[passphrasesize];
+ char *decmessage = 0;
+ int decmessagelen;
+ gpgResult gpgresult;
+
+ const char *begin = strstr(message, txtbeginpgpmessage);
+ const char *end = strstr(message, txtendpgpmessage);
+
+ if ((begin!=NULL)&&(end!=NULL))
+ {
+ strcpy(buffer, "");
+ strncat(buffer, begin, end-begin+strlen(txtendpgpmessage));
+ replace(buffer, "\r", "");
+ replace(buffer, "\n", txtcrlf);
+
+ ZeroMemory(keyuserid, sizeof(keyuserid));
+ gpgresult=gpgDetectUserID(keyuserid, buffer);
+ storedpassphrase=NULL;
+
+ if(gpgresult!=gpgSuccess)
+ {
+ // ErrorMessage(txtwarning, txtdetectuseridfailed, txtverifyoptions);
+ strcpy(keyuserid, txtunknownuserid);
+ useridvalid=FALSE;
+ }
+ else
+ {
+ storedpassphrase=getPassphrase(keyuserid);
+ useridvalid=TRUE;
+ }
+
+ if(storedpassphrase!=NULL)
+ {
+ strcpy(passphrase, storedpassphrase);
+ ZeroMemory(plaintext, sizeof(plaintext));
+ gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
+ }
+ else gpgresult=gpgUnknownError;
+
+ dlgresult=IDOK;
+ while((gpgresult!=gpgSuccess)&&(dlgresult!=IDCANCEL))
+ {
+ dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, PassphraseDialogProcedure, (LPARAM)keyuserid);
+
+ if(dlgresult==IDOK)
+ {
+ strcpy(passphrase, dlgpassphrase);
+ ZeroMemory(dlgpassphrase, passphrasesize);
+ strcat(passphrase, txtcrlf);
+ ZeroMemory(plaintext, sizeof(plaintext));
+ gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
+ }
+ }
+
+ if(gpgresult==gpgSuccess)
+ {
+ strcpy(buffer, plaintext);
+ }
+
+ if ( gpgresult==gpgSuccess && useridvalid==TRUE)
+ addPassphrase(keyuserid, passphrase);
+
+ ZeroMemory(passphrase, sizeof(passphrase));
+
+ decmessagelen = strlen(buffer)+1;
+ decmessage = (char *) LocalAlloc(LPTR,decmessagelen);
+ MoveMemory(decmessage, buffer, decmessagelen);
+ }
+
+ return decmessage;
}
@@ -274,122 +271,124 @@ int __cdecl _gpg_size_keyid()
int __cdecl _gpg_select_keyid(HWND hdlg, LPSTR keyid)
{
- int dlgresult;
+ int dlgresult;
- ZeroMemory(keyid, keyidsize);
- dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTKEY), hdlg, UserIdDialogProcedure, (LPARAM)keyid);
+ ZeroMemory(keyid, keyidsize);
+ dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTKEY), hdlg, UserIdDialogProcedure, (LPARAM)keyid);
- if(dlgresult!=IDOK)
- ZeroMemory(keyid, keyidsize);
+ if(dlgresult!=IDOK)
+ ZeroMemory(keyid, keyidsize);
return (dlgresult==IDOK);
}
-void noBackslash(LPSTR path) {
- LPSTR ptr;
- ptr = path + strlen(path) - 1;
- if ( *ptr=='\\' ) *ptr = '\0';
+void noBackslash(LPSTR path)
+{
+ LPSTR ptr = path + strlen(path) - 1;
+ if ( *ptr=='\\' ) *ptr = '\0';
}
static char buf[MAX_PATH];
-LPSTR GetRegValue(HKEY hKey , LPCSTR szPath, LPCSTR szName){
- DWORD len=MAX_PATH,type;
- LPSTR ret=0;
+LPSTR GetRegValue(HKEY hKey , LPCSTR szPath, LPCSTR szName)
+{
+ DWORD len=MAX_PATH,type;
+ LPSTR ret=0;
- RegOpenKey(hKey,szPath,&hKey);
- if ( RegQueryValueEx(hKey,szName,NULL,&type,(LPBYTE)&buf,&len)==ERROR_SUCCESS ) {
- noBackslash((LPSTR)&buf);
- ret = (LPSTR)&buf;
- }
- RegCloseKey(hKey);
+ RegOpenKey(hKey,szPath,&hKey);
+ if ( RegQueryValueEx(hKey,szName,NULL,&type,(LPBYTE)&buf,&len)==ERROR_SUCCESS ) {
+ noBackslash((LPSTR)&buf);
+ ret = (LPSTR)&buf;
+ }
+ RegCloseKey(hKey);
- return ret;
+ return ret;
}
-LPSTR GetEnvValue(LPCSTR szName){
- LPSTR ret=0;
+LPSTR GetEnvValue(LPCSTR szName)
+{
+ LPSTR ret=0;
- if ( GetEnvironmentVariable(szName, buf, MAX_PATH) > 0 ) {
- noBackslash((LPSTR)&buf);
- ret = (LPSTR)&buf;
- }
+ if ( GetEnvironmentVariable(szName, buf, MAX_PATH) > 0 ) {
+ noBackslash((LPSTR)&buf);
+ ret = (LPSTR)&buf;
+ }
- return ret;
+ return ret;
}
BOOL ShowSelectExecDlg(LPSTR path)
{
- OPENFILENAME ofn;
- ZeroMemory(&ofn,sizeof(ofn));
-
- ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","gpgProgram");
- if ( ofn.lpstrFile && existsFile(ofn.lpstrFile) ) {
- strcpy(path, ofn.lpstrFile);
- return TRUE;
- }
- ofn.lpstrFile = GetRegValue(HKEY_LOCAL_MACHINE,"Software\\GNU\\GnuPG","Install Directory");
- if ( ofn.lpstrFile ) {
- strcat(ofn.lpstrFile,"\\gpg.exe");
- if ( existsFile(ofn.lpstrFile) ) {
- strcpy(path, ofn.lpstrFile);
- return TRUE;
- }
- }
-
- ofn.lStructSize = sizeof(ofn);
- ofn.nMaxFile = MAX_PATH;
- ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
-
- ofn.lpstrFile = path;
- ofn.lpstrFilter = "GnuPG executable (gpg.exe)\0gpg.exe\0All files (*.*)\0*.*\0";
- ofn.lpstrTitle = "Select GnuPG executable";
- if (!GetOpenFileName(&ofn)) return FALSE;
-
- return TRUE;
+ OPENFILENAME ofn;
+ ZeroMemory(&ofn,sizeof(ofn));
+
+ ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","gpgProgram");
+ if ( ofn.lpstrFile && existsFile(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetRegValue(HKEY_LOCAL_MACHINE,"Software\\GNU\\GnuPG","Install Directory");
+ if ( ofn.lpstrFile ) {
+ strcat(ofn.lpstrFile,"\\gpg.exe");
+ if ( existsFile(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ }
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = path;
+ ofn.lpstrFilter = "GnuPG executable (gpg.exe)\0gpg.exe\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Select GnuPG executable";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ return TRUE;
}
BOOL ShowSelectHomeDlg(LPSTR path)
{
- int i;
- OPENFILENAME ofn;
-
- ofn.lpstrFile = GetEnvValue("GNUPGHOME");
- if ( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
- strcpy(path, ofn.lpstrFile);
- return TRUE;
- }
- ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","HomeDir");
- if ( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
- strcpy(path, ofn.lpstrFile);
- return TRUE;
- }
- ofn.lpstrFile = GetEnvValue("APPDATA");
- if ( ofn.lpstrFile ) {
- strcat(ofn.lpstrFile,"\\gnupg");
- if ( existsPath(ofn.lpstrFile) ) {
- strcpy(path, ofn.lpstrFile);
- return TRUE;
- }
- }
-
- ofn.lStructSize = sizeof(ofn);
- ofn.nMaxFile = MAX_PATH;
- ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
-
- ofn.lpstrFile = path;
- ofn.lpstrFilter = "Public key rings (pubring.gpg)\0pubring.gpg\0All files (*.*)\0*.*\0";
- ofn.lpstrTitle = "Open Public Keyring";
- if (!GetOpenFileName(&ofn)) return FALSE;
-
- for(i=strlen(path);i && path[i]!='\\';i--);
- path[i] = 0;
-
- return TRUE;
+ int i;
+ OPENFILENAME ofn;
+
+ ofn.lpstrFile = GetEnvValue("GNUPGHOME");
+ if ( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","HomeDir");
+ if ( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetEnvValue("APPDATA");
+ if ( ofn.lpstrFile ) {
+ strcat(ofn.lpstrFile,"\\gnupg");
+ if ( existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ }
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = path;
+ ofn.lpstrFilter = "Public key rings (pubring.gpg)\0pubring.gpg\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Open Public Keyring";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ for(i=strlen(path);i && path[i]!='\\';i--);
+ path[i] = 0;
+
+ return TRUE;
}
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index 0e7895b09c..e5e6f51687 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -25,59 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int num_classes = 0; //for core class api support
-// isWorkstationLocked() code from core
-bool isWorkstationLocked()
-{
- if (OpenInputDesktop != NULL) {
- HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk == NULL)
- return true;
- if (CloseDesktop != NULL)
- CloseDesktop(hDesk);
- }
- return false;
-}
-
-// isFullScreen() code from core
-static bool isFullScreen()
-{
- RECT rcScreen = {0};
- rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
- rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
-
- if (MonitorFromWindow != NULL) {
- HMONITOR hMon = MonitorFromWindow(GetForegroundWindow(), MONITOR_DEFAULTTONEAREST);
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- if (GetMonitorInfo(hMon, &mi))
- rcScreen = mi.rcMonitor;
- }
-
- HWND hWndDesktop = GetDesktopWindow();
- HWND hWndShell = GetShellWindow();
-
- // check foregroundwindow
- HWND hWnd = GetForegroundWindow();
- if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
- TCHAR tszClassName[128] = _T("");
- GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
- if (_tcscmp(tszClassName, _T("WorkerW"))) {
- RECT rect, rectw, recti;
- GetWindowRect(hWnd, &rectw);
-
- GetClientRect(hWnd, &rect);
- ClientToScreen(hWnd, (LPPOINT)&rect);
- ClientToScreen(hWnd, (LPPOINT)&rect.right);
-
- if (EqualRect(&rect, &rectw) && IntersectRect(&recti, &rect, &rcScreen) &&
- EqualRect(&recti, &rcScreen))
- return true;
- }
- }
-
- return false;
-}
-
//===== Popup/AddPopup
INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam)
{
@@ -166,17 +113,10 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if ( !(lParam & APF_NO_HISTORY))
PopupHistoryAdd(ppd);
- if (PopupThreadIsFull())
+ if ( PopupThreadIsFull())
return -1;
- #ifdef _DEBUG
- char temp[128];
- OutputDebugStringA("isWorkstationLocked: \t");
- OutputDebugStringA(isWorkstationLocked() ? "true":"false");
- OutputDebugStringA("\n");
- #endif
-
- if (isWorkstationLocked())
+ if ( IsWorkstationLocked())
return -1;
// Check if contact handle is valid.
@@ -192,25 +132,11 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if (bShowMode != PU_SHOWMODE_FAVORITE) {
if (!PopupOptions.ModuleIsEnabled)
return -1;
- #ifdef _DEBUG
- _itoa(PopupOptions.DisableWhenFullscreen,temp,10);
- OutputDebugStringA("PopupOptions.DisableWhenFullscreen: \t");
- OutputDebugStringA(temp);
- OutputDebugStringA("\n");
- _itoa(bShowMode,temp,10);
- OutputDebugStringA("bShowMode: \t");
- OutputDebugStringA(temp);
- OutputDebugStringA("\n");
- OutputDebugStringA("isFullScreen: \t");
- OutputDebugStringA(isFullScreen() ? "true":"false");
- OutputDebugStringA("\n");
- #endif
-
- if (PopupOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && isFullScreen())
+
+ if (PopupOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && IsFullScreen())
return -1;
- if (db_get_dw(NULL, MODULNAME, LPGEN("Global Status"), 0) &
- Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
+ if (db_get_dw(NULL, MODULNAME, LPGEN("Global Status"), 0) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
return -1;
if ((disableWhen & 0x0000FFFF) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
@@ -219,8 +145,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if (proto) {
char prefix[128];
mir_snprintf(prefix, sizeof(prefix), LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact));
- if (db_get_dw(NULL, MODULNAME, prefix, 0) &
- Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
+ if (db_get_dw(NULL, MODULNAME, prefix, 0) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
return -1;
if (((disableWhen >> 16) & 0xFFFF0000) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
return -1;
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp
index 56ae26d20d..7e372640ab 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp
@@ -191,38 +191,25 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
int OnAccChanged(WPARAM wParam,LPARAM lParam)
{
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )lParam;
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)lParam;
switch( wParam ) {
case PRAC_ADDED:
- autoAwaySettings->insert( new TAAAProtoSetting( pa ));
+ autoAwaySettings->insert( new TAAAProtoSetting(pa));
break;
case PRAC_REMOVED:
- {
- for ( int i=0; i < autoAwaySettings->getCount(); i++ ) {
- if ( !lstrcmpA( (*autoAwaySettings)[i].szName, pa->szModuleName )) {
- autoAwaySettings->remove( i );
- break;
- } } }
+ for (int i=0; i < autoAwaySettings->getCount(); i++) {
+ if ( !lstrcmpA( (*autoAwaySettings)[i].szName, pa->szModuleName )) {
+ autoAwaySettings->remove( i );
+ break;
+ }
+ }
break;
}
return 0;
}
-/* this function is from the original auto-away module */
-static BOOL IsWorkstationLocked (void)
-{
- BOOL rc = FALSE;
-
- HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk == NULL)
- rc = TRUE;
- else
- CloseDesktop(hDesk);
- return rc;
-}
-
static char* status2descr( int status )
{
switch( status ) {
@@ -274,7 +261,7 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
int statusChanged = FALSE;
int confirm = FALSE;
- for ( int i=0; i < autoAwaySettings->getCount(); i++ ) {
+ for (int i=0; i < autoAwaySettings->getCount(); i++) {
TAAAProtoSetting& aas = (*autoAwaySettings)[i];
aas.status = ID_STATUS_DISABLED;
@@ -316,7 +303,8 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
- } }
+ }
+ }
if (aas.curState == STATUS1_SET) {
if (( mouseStationaryTimer < sts1Time && !screenSaver && !locked ) && !(aas.optionFlags & FLAG_RESET )) {
@@ -337,7 +325,8 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
- } }
+ }
+ }
if ( aas.curState == STATUS2_SET ) {
if ( mouseStationaryTimer < sts2Time && !screenSaver && !locked && ( aas.optionFlags & FLAG_RESET )) {
@@ -349,7 +338,8 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
/* Remember: after status1 is set, and "only on inactive" is NOT set, it implies !reset. */
changeState(aas, HIDDEN_ACTIVE);
aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
- } }
+ }
+ }
if ( aas.curState == HIDDEN_ACTIVE ) {
if ( aas.mStatus ) {
@@ -383,11 +373,9 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
if ( confirm || statusChanged ) {
OBJLIST<TAAAProtoSetting> ps = *autoAwaySettings;
-
- int i;
- for ( i=0; i < ps.getCount(); i++ ) {
- if ( ps[i].szMsg )
- ps[i].szMsg = _tcsdup( ps[i].szMsg );
+ for (int i=0; i < ps.getCount(); i++) {
+ if (ps[i].szMsg)
+ ps[i].szMsg = _tcsdup(ps[i].szMsg);
if (ps[i].status == ID_STATUS_DISABLED)
ps[i].szName = "";
@@ -405,15 +393,15 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
static int HookWindowsHooks(int hookMiranda, int hookAll)
{
if (hookMiranda) {
- if ( monitorKeyboard && hMirandaKeyBoardHook == NULL )
+ if (monitorKeyboard && hMirandaKeyBoardHook == NULL)
hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD,MirandaKeyBoardHookFunction,NULL,GetCurrentThreadId());
- if ( monitorMouse && hMirandaMouseHook == NULL )
+ if (monitorMouse && hMirandaMouseHook == NULL)
hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE,MirandaMouseHookFunction,NULL,GetCurrentThreadId());
}
if (hookAll) {
- if ( monitorKeyboard && hKeyBoardHook == NULL )
+ if (monitorKeyboard && hKeyBoardHook == NULL)
hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, 0, GetCurrentThreadId());
- if ( monitorMouse && hMouseHook == NULL )
+ if (monitorMouse && hMouseHook == NULL)
hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, 0, GetCurrentThreadId());
}
@@ -428,7 +416,6 @@ static int UnhookWindowsHooks()
UnhookWindowsHookEx(hMirandaKeyBoardHook);
hMouseHook = hKeyBoardHook = hMirandaMouseHook = hMirandaKeyBoardHook = NULL;
-
return 0;
}
@@ -447,7 +434,8 @@ static LRESULT CALLBACK MirandaMouseHookFunction(int code, WPARAM wParam, LPARAM
if (pt.x!=lastMousePos.x || pt.y!=lastMousePos.y) {
lastMousePos = pt;
lastMirandaInput = GetTickCount();
- } }
+ }
+ }
return CallNextHookEx(hMirandaMouseHook, code, wParam, lParam);
}
@@ -455,17 +443,19 @@ static LRESULT CALLBACK MirandaMouseHookFunction(int code, WPARAM wParam, LPARAM
static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPARAM lParam)
{
if (code >= 0) {
- if (ignoreAltCombo) {//&& ((HIWORD(lParam)&KF_ALTDOWN) || (wParam == VK_MENU))) {
- if ( ((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
- ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
- ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
- ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
- ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
- ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
- ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN))) {
+ if (ignoreAltCombo) {
+ if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
+ ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
+ ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
+ ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
+ ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
+ ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
+ ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
+ {
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
}
}
+
switch (wParam) {
case VK_NUMLOCK:
case VK_CAPITAL:
@@ -488,7 +478,8 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPA
default:
lastMirandaInput = GetTickCount();
break;
- } }
+ }
+ }
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
}
@@ -514,17 +505,19 @@ static LRESULT CALLBACK MouseHookFunction(int code, WPARAM wParam, LPARAM lParam
static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lParam)
{
if (code >= 0) {
- if (ignoreAltCombo) {//&& ((HIWORD(lParam)&KF_ALTDOWN) || (wParam == VK_MENU))) {
+ if (ignoreAltCombo) {
if ( ((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
- ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN))) {
+ ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
+ {
return CallNextHookEx(hKeyBoardHook, code, wParam, lParam);
}
}
+
switch (wParam) {
case VK_NUMLOCK:
case VK_CAPITAL:
@@ -547,7 +540,8 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa
default:
lastInput = GetTickCount();
break;
- } }
+ }
+ }
return CallNextHookEx(hKeyBoardHook, code, wParam, lParam);
}
diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp
index a08fb213f7..73dd3fbf1b 100644
--- a/plugins/YAPP/src/message_pump.cpp
+++ b/plugins/YAPP/src/message_pump.cpp
@@ -9,69 +9,12 @@ HANDLE hMPEvent;
#define MAX_POPUPS 100
-// from popups, popup2 implementation, slightly modified
-// return true if there is a full-screen application (e.g. game) running
-bool is_full_screen() {
- int w = GetSystemMetrics(SM_CXSCREEN);
- int h = GetSystemMetrics(SM_CYSCREEN);
- // use ClientRect instead of WindowRect so that it works normally for maximized applications - thx Nikto
- RECT ClientRect;
- HWND hWnd;
-
- HWND hWndDesktop = GetDesktopWindow();
- HWND hWndShell = GetShellWindow();
-
- // check foregroundwindow
- hWnd = GetForegroundWindow();
- if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
- GetClientRect(hWnd, &ClientRect);
- if ((ClientRect.right - ClientRect.left) >= w && (ClientRect.bottom - ClientRect.top) >= h)
- return true;
- }
-
- // check other top level windows
- while ((hWnd = FindWindowEx(NULL, hWnd, NULL, NULL))) {
- if (IsWindowVisible(hWnd) == 0 || IsIconic(hWnd) || hWnd == hWndDesktop || hWnd == hWndShell)
- continue;
-
-// if (db_get_b(0, MODULE, "ShowForNonTopmostFullscreenWindows", 0) == 1) {
- if (!(GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST))
- continue;
-// }
-
- // not sure if this could be done more simply using 'IsZoomed'?
- GetClientRect(hWnd, &ClientRect);
- if ((ClientRect.right - ClientRect.left) < w || (ClientRect.bottom - ClientRect.top) < h)
- continue;
-
- return true;
- }
-
- return false;
-}
-
-bool is_workstation_locked()
-{
- bool rc = false;
- HDESK hDesk = OpenDesktop((TCHAR*)_T("default"), 0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk != 0) {
- HDESK hDeskInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDeskInput == 0) {
- rc = true;
- } else
- CloseDesktop(hDeskInput);
-
- CloseDesktop(hDesk);
- }
-
- return rc;
-}
-
unsigned __stdcall MessagePumpThread(void* param)
{
- if (param) SetEvent((HANDLE)param);
+ if (param)
+ SetEvent((HANDLE)param);
- MSG hwndMsg = {0};
+ MSG hwndMsg = { 0 };
while(GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) {
if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) {
switch(hwndMsg.message) {
@@ -81,22 +24,21 @@ unsigned __stdcall MessagePumpThread(void* param)
int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
if (status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE])
enabled = false;
- if ((options.disable_full_screen && is_full_screen()) || is_workstation_locked())
+ if ((options.disable_full_screen && IsFullScreen()) || IsWorkstationLocked())
enabled = false;
- PopupData *pd = (PopupData *)hwndMsg.lParam;
+ PopupData *pd = (PopupData*)hwndMsg.lParam;
if (enabled && num_popups < MAX_POPUPS) {
//HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam);
HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
num_popups++;
if (hwndMsg.wParam) // set notifyer handle
SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
- } else {
- if (pd) {
- mir_free(pd->pwzTitle);
- mir_free(pd->pwzText);
- mir_free(pd);
- }
+ }
+ else if (pd) {
+ mir_free(pd->pwzTitle);
+ mir_free(pd->pwzText);
+ mir_free(pd);
}
}
break;
@@ -112,17 +54,11 @@ unsigned __stdcall MessagePumpThread(void* param)
break;
case MUM_NMUPDATE:
- {
- HANDLE hNotify = (HANDLE)hwndMsg.wParam;
- BroadcastMessage(PUM_UPDATENOTIFY, (WPARAM)hNotify, 0);
- }
+ BroadcastMessage(PUM_UPDATENOTIFY, hwndMsg.wParam, 0);
break;
case MUM_NMREMOVE:
- {
- HANDLE hNotify = (HANDLE)hwndMsg.wParam;
- BroadcastMessage(PUM_KILLNOTIFY, (WPARAM)hNotify, 0);
- }
+ BroadcastMessage(PUM_KILLNOTIFY, hwndMsg.wParam, 0);
break;
case MUM_NMAVATAR:
@@ -153,11 +89,10 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam)
// will post a message to the message queue which will set the hwnd value
// and then set the event...so create an event, call this function and then wait on the event
// when the event is signalled, the hwnd will be valid
-void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd);
void InitMessagePump()
{
- WNDCLASS popup_win_class = {0};
+ WNDCLASS popup_win_class = { 0 };
popup_win_class.lpfnWndProc = PopupWindowProc;
popup_win_class.hInstance = hInst;
popup_win_class.lpszClassName = POP_WIN_CLASS;
@@ -172,6 +107,7 @@ void InitMessagePump()
CloseHandle(hMPEvent);
}
-void DeinitMessagePump() {
+void DeinitMessagePump()
+{
PostMPMessage(WM_QUIT, 0, 0);
}
diff --git a/plugins/YAPP/src/message_pump.h b/plugins/YAPP/src/message_pump.h
index 6acb371080..fc3d889a0a 100644
--- a/plugins/YAPP/src/message_pump.h
+++ b/plugins/YAPP/src/message_pump.h
@@ -40,7 +40,6 @@ struct PopupData
// will post a message to the message queue which will set the hwnd value
// and then set the event...so create an event, call this function and then wait on the event
// when the event is signalled, the hwnd will be valid
-void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd);
void InitMessagePump();
void DeinitMessagePump();
diff --git a/plugins/YAPP/src/notify_imp.cpp b/plugins/YAPP/src/notify_imp.cpp
index 0be4fbd15f..32298027df 100644
--- a/plugins/YAPP/src/notify_imp.cpp
+++ b/plugins/YAPP/src/notify_imp.cpp
@@ -92,8 +92,7 @@ INT_PTR CALLBACK DlgProcPopups(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
int NotifyOptionsInitialize(WPARAM wParam,LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY);
odp.pszTitle = LPGEN("YAPP Popups");
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp
index 08e3dfce8c..497bbc4b18 100644
--- a/plugins/YAPP/src/options.cpp
+++ b/plugins/YAPP/src/options.cpp
@@ -111,8 +111,8 @@ void ShowExamplePopups() {
}
}
-static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
+static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
switch ( msg ) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
@@ -138,7 +138,8 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (ServiceExists(MS_AV_DRAWAVATAR)) {
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar"));
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar"));
- } else {
+ }
+ else {
HWND hw = GetDlgItem(hwndDlg, IDC_CMB_AV);
EnableWindow(hw, FALSE);
hw = GetDlgItem(hwndDlg, IDC_SPIN_AVSIZE);
@@ -206,12 +207,16 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT);
EnableWindow(hw, FALSE);
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, 7, FALSE);
- } else {
+ }
+ else {
CheckDlgButton(hwndDlg, IDC_RAD_TIMEOUT, TRUE);
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, options.default_timeout, FALSE);
}
- if (options.right_icon) CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE);
- else CheckDlgButton(hwndDlg, IDC_RAD_LEFTICON, TRUE);
+
+ if (options.right_icon)
+ CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE);
+ else
+ CheckDlgButton(hwndDlg, IDC_RAD_LEFTICON, TRUE);
if (ServiceExists(MS_AV_DRAWAVATAR)) {
switch(options.av_layout) {
@@ -219,7 +224,8 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case PAV_RIGHT: CheckDlgButton(hwndDlg, IDC_RAD_RIGHTAV, TRUE); break;
case PAV_LEFT: CheckDlgButton(hwndDlg, IDC_RAD_LEFTAV, TRUE); break;
}
- } else {
+ }
+ else {
CheckDlgButton(hwndDlg, IDC_RAD_NOAV, TRUE);
HWND hw = GetDlgItem(hwndDlg, IDC_RAD_RIGHTAV);
EnableWindow(hw, FALSE);
@@ -255,16 +261,16 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
return FALSE;
case WM_COMMAND:
- if ( HIWORD( wParam ) == CBN_SELCHANGE)
+ if ( HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
+ else if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if ( HIWORD( wParam ) == BN_CLICKED ) {
+ else if ( HIWORD(wParam) == BN_CLICKED ) {
if (LOWORD(wParam) == IDC_BTN_PREVIEW)
ShowExamplePopups();
else {
HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT);
- switch( LOWORD( wParam )) {
+ switch( LOWORD(wParam)) {
case IDC_RAD_NOTIMEOUT:
EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_RAD_TIMEOUT));
break;
@@ -283,7 +289,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case LVN_ITEMCHANGED:
NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
}
}
@@ -367,7 +373,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
return FALSE;
case WM_COMMAND:
- if ( LOWORD(wParam) == IDC_LST_CLASSES && HIWORD( wParam ) == LBN_SELCHANGE) {
+ if ( LOWORD(wParam) == IDC_LST_CLASSES && HIWORD(wParam) == LBN_SELCHANGE) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PREVIEW), index != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_COL_TEXT), index != -1);
@@ -383,7 +389,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), index != -1 && IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT));
return TRUE;
}
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
if (index != -1) {
int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
@@ -407,17 +413,17 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
else arNewClasses[i]->iSeconds = -1;
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, arNewClasses[i]->iSeconds, TRUE);
}
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
case IDC_COL_TEXT:
arNewClasses[i]->colorText = SendDlgItemMessage(hwndDlg, IDC_COL_TEXT, CPM_GETCOLOUR, 0, 0);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
case IDC_COL_BG:
arNewClasses[i]->colorBack = SendDlgItemMessage(hwndDlg, IDC_COL_BG, CPM_GETCOLOUR, 0, 0);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
case IDC_BTN_PREVIEW:
@@ -428,7 +434,8 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
d.pwszTitle = L"Preview";
d.pwszText = L"The quick brown fox jumps over the lazy dog.";
CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
- } else {
+ }
+ else {
POPUPCLASS pc = *arNewClasses[i];
pc.PluginWindowProc = 0;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
@@ -443,7 +450,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
arClasses = arNewClasses;
char setting[256];
for (int i = 0; i < arClasses.getCount(); i++) {
@@ -483,7 +490,6 @@ int OptInit(WPARAM wParam, LPARAM lParam)
odp.pszTab = LPGEN("Classes");
odp.pfnDlgProc = DlgProcOptsClasses;
Options_AddPage(wParam, &odp);
-
return 0;
}
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp
index abb3ba2010..3112f17459 100644
--- a/plugins/YAPP/src/popwin.cpp
+++ b/plugins/YAPP/src/popwin.cpp
@@ -79,13 +79,11 @@ void AddWindowToStack(HWND hwnd) {
RECT wa_rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa_rect, 0);
- if (options.use_mim_monitor)
- {
+ if (options.use_mim_monitor) {
RECT clr;
GetWindowRect((HWND)CallService(MS_CLUI_GETHWND, 0, 0), &clr);
HMONITOR hMonitor = MonitorFromRect(&clr, MONITOR_DEFAULTTONEAREST);
- if (hMonitor)
- {
+ if (hMonitor) {
MONITORINFO mi;
mi.cbSize = sizeof(mi);
if (GetMonitorInfo(hMonitor, &mi))
@@ -93,41 +91,40 @@ void AddWindowToStack(HWND hwnd) {
}
}
- switch (options.animate)
- {
- case ANIMATE_NO:
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right - options.win_width - 1;
- else
- pop_start_x = wa_rect.left + 1;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom;
- else
- pop_start_y = wa_rect.top + 1;
- break;
- case ANIMATE_HORZ:
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right;
- else
- pop_start_x = wa_rect.left - options.win_width;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom;
- else
- pop_start_y = wa_rect.top + 1;
- break;
- case ANIMATE_VERT:
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right - options.win_width - 1;
- else
- pop_start_x = wa_rect.left + 1;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom;
- else
- pop_start_y = wa_rect.top - height + 1;
- break;
+ switch (options.animate) {
+ case ANIMATE_NO:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right - options.win_width - 1;
+ else
+ pop_start_x = wa_rect.left + 1;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top + 1;
+ break;
+ case ANIMATE_HORZ:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right;
+ else
+ pop_start_x = wa_rect.left - options.win_width;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top + 1;
+ break;
+ case ANIMATE_VERT:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right - options.win_width - 1;
+ else
+ pop_start_x = wa_rect.left + 1;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top - height + 1;
+ break;
}
SetWindowPos(hwnd, 0, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
@@ -159,9 +156,7 @@ void RemoveWindowFromStack(HWND hwnd)
// Если после удаления в стеке остались окна, то нужно провести сжатие:
// сдвинуть все окна к верхнему/нижнему краю экрана.
if (hwnd_stack_top)
- {
RepositionWindows();
- }
}
void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam)
@@ -244,16 +239,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pwd);
- if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1)) {
- // make a really long timeout - say 7 days? ;)
+ // make a really long timeout - say 7 days? ;)
+ if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1))
SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
- } else {
- if (pd->timeout == 0) {
- SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
- } else {
- SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
- }
- }
+ else if (pd->timeout == 0)
+ SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
+ else
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
AddWindowToStack(hwnd); // this updates our size
}
@@ -311,7 +303,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
PostMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
}
return TRUE;
- } else if (wParam == ID_MOVETIMER) {
+ }
+
+ if (wParam == ID_MOVETIMER) {
RECT r;
GetWindowRect(hwnd, &r);
@@ -333,6 +327,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return TRUE;
}
break;
+
case WM_ERASEBKGND:
{
HDC hdc = (HDC) wParam;
@@ -364,9 +359,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SelectObject(hdc, hOldBrush);
SelectObject(hdc, hOldPen);
}
-
}
return TRUE;
+
case WM_PAINT:
{
RECT r;
@@ -388,7 +383,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (pwd->have_av) avr.right = avr.left + pwd->real_av_width;
else avr.right = avr.left + pwd->time_width;
r.left = avr.right;
- } else if (options.av_layout == PAV_RIGHT) {
+ }
+ else if (options.av_layout == PAV_RIGHT) {
avr.right = r.right - options.av_padding;
if (pwd->have_av && options.time_layout == PT_WITHAV) avr.left = avr.right - max(pwd->real_av_width, pwd->time_width);
else if (pwd->have_av) avr.left = avr.right - pwd->real_av_width;
@@ -432,7 +428,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (options.right_icon) {
iconx = r.right - (16 + options.padding);
textxmax -= 16 + options.padding;
- } else {
+ }
+ else {
iconx = r.left + options.padding;
textxmin += 16 + options.padding;
}
@@ -457,8 +454,6 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
textxmax -= pwd->time_width + options.padding;
DrawText(ps.hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &ttr, DT_VCENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
break;
- default:
- break;
}
}
@@ -535,11 +530,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
HRGN hRgn1;
RECT r;
- int v,h;
- int w=11;
+ int w = 11;
GetWindowRect(hwnd,&r);
- h=(r.right-r.left)>(w*2)?w:(r.right-r.left);
- v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top);
+ int h = (r.right-r.left) > (w*2)?w:(r.right-r.left);
+ int v = (r.bottom-r.top) > (w*2)?w:(r.bottom-r.top);
h=(h<v)?h:v;
hRgn1=CreateRoundRectRgn(0,0,(r.right-r.left) + 1,(r.bottom-r.top) + 1,h,h);
SetWindowRgn(hwnd,hRgn1,FALSE);
@@ -552,7 +546,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->new_x = (int)wParam;
pwd->new_y = (int)lParam;
SetTimer(hwnd, ID_MOVETIMER, 10, 0);
- } else {
+ }
+ else {
SetWindowPos(hwnd, 0, (int)wParam, (int)lParam, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
if (!IsWindowVisible(hwnd)) {
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
@@ -569,15 +564,16 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
case PUM_GETCONTACT:
{
- HANDLE *phContact = (HANDLE *)wParam;
+ HANDLE *phContact = (HANDLE*)wParam;
*phContact = pd->hContact;
- if (lParam) SetEvent((HANDLE)lParam);
+ if (lParam)
+ SetEvent((HANDLE)lParam);
}
return TRUE;
case PUM_GETHEIGHT:
{
- int *pHeight = (int *)wParam;
+ int *pHeight = (int*)wParam;
HDC hdc = GetDC(hwnd);
SIZE size;
HFONT hOldFont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
@@ -675,16 +671,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
pwd->pd = pd = (PopupData *)lParam;
- if (pd->timeout != -1) {
- if (pd->timeout == 0) {
- SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
- } else {
- SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
- }
- } else {
- // make a really long timeout - say 7 days? ;)
+ // make a really long timeout - say 7 days? ;)
+ if (pd->timeout == -1)
SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
- }
+ else if (pd->timeout == 0)
+ SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
+ else
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
@@ -714,8 +707,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
}
-
return TRUE;
+
case PUM_KILLNOTIFY:
if (pwd->hNotify != (HANDLE)wParam)
return TRUE;
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp
index 0587df041b..aa8f45371e 100644
--- a/protocols/GTalkExt/src/handlers.cpp
+++ b/protocols/GTalkExt/src/handlers.cpp
@@ -312,7 +312,8 @@ BOOL DiscoverHandler(IJabberInterface *ji, HXML node, void *pUserData)
node = xi.getChildByAttrValue(node, NODENAME_QUERY, ATTRNAME_XMLNS, DISCOVERY_XMLNS);
HXML child = xi.getChildByAttrValue(node, NODENAME_FEATURE, ATTRNAME_VAR, SETTING_FEATURE_XMLNS);
- if (child) SetNotificationSetting(jid, ji);
+ if (child)
+ SetNotificationSetting(jid, ji);
child = xi.getChildByAttrValue(node, NODENAME_FEATURE, ATTRNAME_VAR, NOTIFY_FEATURE_XMLNS);
if (child) {
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp
index 4343ae6fe2..9fd82a5aec 100644
--- a/protocols/GTalkExt/src/inbox.cpp
+++ b/protocols/GTalkExt/src/inbox.cpp
@@ -242,7 +242,7 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
void OpenContactInbox(HANDLE hContact)
{
LPSTR acc = GetContactProto(hContact);
- if (!acc)
+ if (acc == NULL)
return;
ptrT tszJid( db_get_tsa(0, acc, "jid"));
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp
index 373ca1cbba..59743a2a57 100644
--- a/protocols/GTalkExt/src/notifications.cpp
+++ b/protocols/GTalkExt/src/notifications.cpp
@@ -54,17 +54,13 @@ LPCSTR GetJidAcc(LPCTSTR jid)
int count = 0;
PROTOACCOUNT **protos;
ProtoEnumAccounts(&count, &protos);
-
- DBVARIANT dbv;
- for (int i=0; i < count; i++)
- if (getJabberApi(protos[i]->szModuleName))
- if (!db_get_ts(0, protos[i]->szModuleName, "jid", &dbv))
- __try {
- if (!lstrcmpi(jid, dbv.ptszVal)) return protos[i]->szModuleName;
- }
- __finally {
- db_free(&dbv);
- }
+ for (int i=0; i < count; i++) {
+ if ( getJabberApi(protos[i]->szModuleName)) {
+ ptrT tszJid( db_get_tsa(0, protos[i]->szModuleName, "jid"));
+ if ( !lstrcmpi(jid, tszJid))
+ return protos[i]->szModuleName;
+ }
+ }
return NULL;
}
@@ -246,7 +242,7 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP
data->PluginWindowProc = PopupProc;
int lurl = (lstrlen(url) + 1) * sizeof(TCHAR);
int ljid = (lstrlen(jid) + 1) * sizeof(TCHAR);
-
+
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
ppdh->MarkRead = FALSE;
ppdh->hContact = hCnt;
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp
index d774cc8401..869243e905 100644
--- a/protocols/GTalkExt/src/tipper_items.cpp
+++ b/protocols/GTalkExt/src/tipper_items.cpp
@@ -76,80 +76,64 @@ void SetLabelProp(int index, LPSTR setting)
{
sprintf(setting, LABEL_SETTING_PROP, index); //!!!!!!!!!!!!!!
- DBVARIANT dbv1 = {0};
- if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
- __try {
- DBVARIANT dbv2 = {0};
- if (!db_get_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2))
- __try {
- if (!lstrcmp(dbv1.ptszVal, dbv2.ptszVal)) {
- LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
- db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
- db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, label);
- }
- }
- __finally {
- db_free(&dbv2);
- }
- }
- __finally {
- db_free(&dbv1);
- }
+ ptrT tszProp( db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
+ if (tszProp == NULL)
+ return;
+
+ ptrT tszLastWritten( db_get_tsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING));
+ if (tszLastWritten == NULL)
+ return;
+
+ if ( !lstrcmp(tszProp, tszLastWritten)) {
+ LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
+ db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
+ db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, label);
+ }
}
void AddTipperItem()
{
- unsigned short itemCount = db_get_w(0, TIPPER_ITEMS_MOD_NAME,
- TIPPER_ITEM_COUNT_SETTING , unsigned short(-1));
- if (unsigned short(-1) == itemCount) return;
+ WORD itemCount = db_get_w(0, TIPPER_ITEMS_MOD_NAME, TIPPER_ITEM_COUNT_SETTING, WORD(-1));
+ if (itemCount == WORD(-1))
+ return;
int i, l = 0;
for (i = itemCount; i > 0; i /= 10) l++; // var setting path
l += 30; // const setting part
- LPSTR setting = (LPSTR)malloc(l * sizeof(TCHAR));
- __try {
- for (i = 0; i < itemCount; i++) {
- mir_snprintf(setting, l, VALUE_SETTING_PROP, i);
-
- DBVARIANT dbv = {0};
- if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
- __try {
- if (!lstrcmp(UNREAD_THREADS_RAW, dbv.ptszVal)) {
- SetLabelProp(i, setting);
- return;
- }
- }
- __finally {
- db_free(&dbv);
- }
+ LPSTR setting = (LPSTR)_alloca(l * sizeof(TCHAR));
+
+ for (i = 0; i < itemCount; i++) {
+ mir_snprintf(setting, l, VALUE_SETTING_PROP, i);
+ ptrT tszSetting( db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
+ if (tszSetting) {
+ if ( !lstrcmp(UNREAD_THREADS_RAW, tszSetting)) {
+ SetLabelProp(i, setting);
+ return;
+ }
}
+ }
- for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++)
- ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
+ for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++)
+ ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
- #define WRITE_TIPPER_PROPS(index, value)\
- mir_snprintf(setting, l, TipperItemProps[##index##], 0);\
- db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
- #define WRITE_TIPPER_PROPB(index, value)\
- mir_snprintf(setting, l, TipperItemProps[##index##], 0);\
- db_set_b(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
+ #define WRITE_TIPPER_PROPS(index, value)\
+ mir_snprintf(setting, l, TipperItemProps[##index##], 0);\
+ db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
+ #define WRITE_TIPPER_PROPB(index, value)\
+ mir_snprintf(setting, l, TipperItemProps[##index##], 0);\
+ db_set_b(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
- LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
+ LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
- db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
+ db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
- WRITE_TIPPER_PROPS(0, label);
- WRITE_TIPPER_PROPB(1, 0);
- WRITE_TIPPER_PROPB(2, 0);
- WRITE_TIPPER_PROPB(3, 0);
- WRITE_TIPPER_PROPS(4, UNREAD_THREADS_RAW);
- WRITE_TIPPER_PROPB(5, 1);
- }
- __finally {
- free(setting);
- }
+ WRITE_TIPPER_PROPS(0, label);
+ WRITE_TIPPER_PROPB(1, 0);
+ WRITE_TIPPER_PROPB(2, 0);
+ WRITE_TIPPER_PROPB(3, 0);
+ WRITE_TIPPER_PROPS(4, UNREAD_THREADS_RAW);
+ WRITE_TIPPER_PROPB(5, 1);
- db_set_w(0, TIPPER_ITEMS_MOD_NAME,
- TIPPER_ITEM_COUNT_SETTING, itemCount + 1);
+ db_set_w(0, TIPPER_ITEMS_MOD_NAME, TIPPER_ITEM_COUNT_SETTING, itemCount+1);
} \ No newline at end of file
diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp
index 5dff57cefc..15981a872d 100644
--- a/src/core/stdidle/idle.cpp
+++ b/src/core/stdidle/idle.cpp
@@ -208,65 +208,6 @@ static int IdleObject_IsUserIdle(IdleObject * obj)
return FALSE;
}
-static bool IsWorkstationLocked (void)
-{
- bool rc = false;
-
- HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk == NULL)
- rc = true;
- else
- CloseDesktop(hDesk);
- return rc;
-}
-
-static bool IsScreenSaverRunning(void)
-{
- BOOL rc = FALSE;
- SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &rc, FALSE);
- return rc != 0;
-}
-
-bool IsFullScreen(void)
-{
- RECT rcScreen = {0};
-
- rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
- rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
-
- HMONITOR hMon = MonitorFromWindow(pcli->hwndContactList, MONITOR_DEFAULTTONEAREST);
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- if (GetMonitorInfo(hMon, &mi))
- rcScreen = mi.rcMonitor;
-
- HWND hWndDesktop = GetDesktopWindow();
- HWND hWndShell = GetShellWindow();
-
- // check foregroundwindow
- HWND hWnd = GetForegroundWindow();
- if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell)
- {
- TCHAR tszClassName[128] = _T("");
- GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
- if (_tcscmp(tszClassName, _T("WorkerW")))
- {
- RECT rect, rectw, recti;
- GetWindowRect(hWnd, &rectw);
-
- GetClientRect(hWnd, &rect);
- ClientToScreen(hWnd, (LPPOINT)&rect);
- ClientToScreen(hWnd, (LPPOINT)&rect.right);
-
- if (EqualRect(&rect, &rectw) && IntersectRect(&recti, &rect, &rcScreen) &&
- EqualRect(&recti, &rcScreen))
- return true;
- }
- }
-
- return false;
-}
-
static void IdleObject_Tick(IdleObject * obj)
{
bool idle = false;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index bfd34cb47d..add3c18cf3 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -238,3 +238,8 @@ mirstr_getNil @235
mirstr_lock @236
mirstr_release @237
mirstr_unlock @238
+IsWinVerVistaPlus @239
+IsWinVer7Plus @240
+IsFullScreen @241
+IsWorkstationLocked @242
+IsScreenSaverRunning @243
diff --git a/src/mir_core/winver.cpp b/src/mir_core/winver.cpp
index b980d5138e..03a6e62a28 100644
--- a/src/mir_core/winver.cpp
+++ b/src/mir_core/winver.cpp
@@ -34,3 +34,58 @@ MIR_CORE_DLL(BOOL) IsWinVer7Plus()
{
return dwWinVer >= _WIN32_WINNT_WIN7;
}
+
+MIR_CORE_DLL(BOOL) IsFullScreen()
+{
+ RECT rcScreen = {0};
+
+ rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
+ rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
+
+ HMONITOR hMon = MonitorFromWindow(GetForegroundWindow(), MONITOR_DEFAULTTONEAREST);
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ if (GetMonitorInfo(hMon, &mi))
+ rcScreen = mi.rcMonitor;
+
+ HWND hWndDesktop = GetDesktopWindow();
+ HWND hWndShell = GetShellWindow();
+
+ // check foregroundwindow
+ HWND hWnd = GetForegroundWindow();
+ if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
+ TCHAR tszClassName[128] = _T("");
+ GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
+ if ( _tcscmp(tszClassName, _T("WorkerW"))) {
+ RECT rect, rectw, recti;
+ GetWindowRect(hWnd, &rectw);
+
+ GetClientRect(hWnd, &rect);
+ ClientToScreen(hWnd, (LPPOINT)&rect);
+ ClientToScreen(hWnd, (LPPOINT)&rect.right);
+
+ if (EqualRect(&rect, &rectw) && IntersectRect(&recti, &rect, &rcScreen) &&
+ EqualRect(&recti, &rcScreen))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+MIR_CORE_DLL(BOOL) IsWorkstationLocked(void)
+{
+ HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
+ if (hDesk == NULL)
+ return true;
+
+ CloseDesktop(hDesk);
+ return false;
+}
+
+MIR_CORE_DLL(BOOL) IsScreenSaverRunning(void)
+{
+ BOOL rc = FALSE;
+ SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &rc, FALSE);
+ return rc != 0;
+}