diff options
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonheaders.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clisttray.cpp | 27 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_skinselector.cpp | 577 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/Include/commonheaders.h | 5 | ||||
-rw-r--r-- | src/modules/clist/clisttray.cpp | 32 |
5 files changed, 287 insertions, 356 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 8a31646f0a..d8723914e8 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -75,6 +75,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <stddef.h>
#include <io.h>
#include <math.h>
+#include <stdio.h>
#include <newpluginapi.h>
#include <m_system_cpp.h>
@@ -94,6 +95,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_xstatus.h>
#include <m_cluiframes.h>
#include <m_modernopt.h>
+#include <m_netlib.h>
#include <m_toptoolbar.h>
#include <m_metacontacts.h>
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 0b38255145..9e8c698f7e 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -32,7 +32,6 @@ int cliShowHide(WPARAM wParam, LPARAM lParam); int g_mutex_bOnTrayRightClick = 0;
BOOL g_bMultiConnectionMode = FALSE;
-static int RefreshTimerId = 0; /////by FYR
static VOID CALLBACK RefreshTimerProc(HWND hwnd,UINT message,UINT idEvent,DWORD dwTime); ///// by FYR
static HMENU hMainMenu, hStatusMenu;
static HANDLE hTrayMenuObject;
@@ -123,26 +122,7 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM wparam, LPARAM lparam) return curstatus ? curstatus : ID_STATUS_OFFLINE;
}
-////////////////////////////////////////////////////////////
-///// Need to refresh trays icon after timely changing/////
-////////////////////////////////////////////////////////////
-
-static VOID CALLBACK RefreshTimerProc(HWND hwnd, UINT message, UINT idEvent, DWORD dwTime)
-{
- if (RefreshTimerId) {
- KillTimer(NULL, RefreshTimerId);
- RefreshTimerId = 0;
- }
-
- int count;
- PROTOACCOUNT **accs;
- ProtoEnumAccounts(&count, &accs);
- for (int i = 0; i < count; i++)
- if (pcli->pfnGetProtocolVisibility(accs[i]->szModuleName))
- pcli->pfnTrayIconUpdateBase(accs[i]->szModuleName);
-
-}
-//////// End by FYR /////////
+/////////////////////////////////////////////////////////////////////////////////////////
int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount)
{
@@ -239,16 +219,17 @@ int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProto int avg = pcli->pfnGetAverageMode(NULL);
int i = pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), szChangedProto);
if (i < 0) {
+ Netlib_Logf(NULL, "Connection icon disabled for %s", szChangedProto);
pcli->pfnTrayIconDestroy(hwnd);
pcli->pfnTrayIconInit(hwnd);
return -1;
}
status = CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0);
- if (g_StatusBarData.bConnectingIcon && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
+ if (g_StatusBarData.bConnectingIcon && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)
if (hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0))
return pcli->pfnTrayIconSetBaseInfo(hIcon, szChangedProto);
- }
+
return i;
}
break;
diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 7748eff498..024872fe0d 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -33,13 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "hdr/modern_commonprototypes.h"
/// IMPLEMENTATIONS
-char * ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize)
+char* ModernMaskToString(MODERNMASK *mm, char *buf, UINT bufsize)
{
- int i=0;
- for (i=0; i < (int)mm->dwParamCnt; i++)
- {
- if (mm->pl_Params[i].bMaskParamFlag)
- {
+ int i = 0;
+ for (i = 0; i < (int)mm->dwParamCnt; i++) {
+ if (mm->pl_Params[i].bMaskParamFlag) {
if (i>0)
mir_snprintf(buf, bufsize, "%s%%", buf);
if (mm->pl_Params[i].bMaskParamFlag &MPF_DIFF)
@@ -51,12 +49,11 @@ char * ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize) }
return buf;
}
+
int SkinSelector_DeleteMask(MODERNMASK *mm)
{
- int i;
if (!mm->pl_Params) return 0;
- for (i=0; i < (int)mm->dwParamCnt; i++)
- {
+ for (int i = 0; i < (int)mm->dwParamCnt; i++) {
free(mm->pl_Params[i].szName);
free(mm->pl_Params[i].szValue);
}
@@ -64,22 +61,20 @@ int SkinSelector_DeleteMask(MODERNMASK *mm) return 1;
}
-BOOL MatchMask(char * name, char * mask)
+BOOL MatchMask(char *name, char *mask)
{
if (!mask || !name) return mask == name;
- if (*mask != '|') return wildcmpi(name,mask);
+ if (*mask != '|') return wildcmpi(name, mask);
{
- int s = 1,e = 1;
- char * temp;
- while (mask[e] != '\0')
- {
+ int s = 1, e = 1;
+ char *temp;
+ while (mask[e] != '\0') {
s = e;
- while(mask[e] != '\0' && mask[e] != '|') e++;
- temp = (char*)malloc(e-s+1);
- memcpy(temp,mask+s,e-s);
- temp[e-s] = '\0';
- if (wildcmpi(name,temp))
- {
+ while (mask[e] != '\0' && mask[e] != '|') e++;
+ temp = (char*)malloc(e - s + 1);
+ memcpy(temp, mask + s, e - s);
+ temp[e - s] = '\0';
+ if (wildcmpi(name, temp)) {
free(temp);
return TRUE;
}
@@ -91,6 +86,7 @@ BOOL MatchMask(char * name, char * mask) }
return FALSE;
}
+
#if __GNUC__
#define NOINLINEASM
#endif
@@ -119,33 +115,33 @@ lph_top: //only 4 of 9 instructions in here don't use AL, so optimal pipe use i xor eax,edx
}
#else
- DWORD hash = 0;
- int i;
- int shift = 0;
- for (i=0;szStr[i]; i++) {
- hash ^= szStr[i] << shift;
- if (shift>24) hash ^= (szStr[i]>>(32-shift))&0x7F;
- shift = (shift+5)&0x1F;
- }
- return hash;
+ DWORD hash = 0;
+ int i;
+ int shift = 0;
+ for (i = 0; szStr[i]; i++) {
+ hash ^= szStr[i] << shift;
+ if (shift > 24) hash ^= (szStr[i] >> (32 - shift)) & 0x7F;
+ shift = (shift + 5) & 0x1F;
+ }
+ return hash;
#endif
}
-int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK * mmTemplateList)
+int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK *mmTemplateList)
{
if (!mmTemplateList || !mm) return -1;
- mmTemplateList->pl_Masks = (MODERNMASK *)mir_realloc(mmTemplateList->pl_Masks,sizeof(MODERNMASK)*(mmTemplateList->dwMaskCnt+1));
- memmove(&(mmTemplateList->pl_Masks[mmTemplateList->dwMaskCnt]),mm,sizeof(MODERNMASK));
+ mmTemplateList->pl_Masks = (MODERNMASK *)mir_realloc(mmTemplateList->pl_Masks, sizeof(MODERNMASK)*(mmTemplateList->dwMaskCnt + 1));
+ memmove(&(mmTemplateList->pl_Masks[mmTemplateList->dwMaskCnt]), mm, sizeof(MODERNMASK));
mmTemplateList->dwMaskCnt++;
- return mmTemplateList->dwMaskCnt-1;
+ return mmTemplateList->dwMaskCnt - 1;
}
-int ClearMaskList(LISTMODERNMASK * mmTemplateList)
+int ClearMaskList(LISTMODERNMASK *mmTemplateList)
{
int i;
if (!mmTemplateList) return -1;
if (!mmTemplateList->pl_Masks) return -1;
- for (i=0; i < (int)mmTemplateList->dwMaskCnt; i++)
+ for (i = 0; i < (int)mmTemplateList->dwMaskCnt; i++)
SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[i]));
mir_free_and_nil(mmTemplateList->pl_Masks);
mmTemplateList->dwMaskCnt = 0;
@@ -156,23 +152,20 @@ int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList) {
if (!mmTemplateList) return -1;
if (mID >= mmTemplateList->dwMaskCnt) return -1;
- if (mmTemplateList->dwMaskCnt == 1)
- {
+ if (mmTemplateList->dwMaskCnt == 1) {
SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[0]));
mir_free_and_nil(mmTemplateList->pl_Masks);
mmTemplateList->pl_Masks = NULL;
mmTemplateList->dwMaskCnt--;
}
- else
- {
+ else {
MODERNMASK *newAlocation;
DWORD i;
SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[mID]));
- newAlocation = (MODERNMASK *)mir_alloc(sizeof(MODERNMASK)*mmTemplateList->dwMaskCnt-1);
- memmove(newAlocation,mmTemplateList->pl_Masks,sizeof(MODERNMASK)*(mID+1));
- for (i = mID; i < mmTemplateList->dwMaskCnt-1; i++)
- {
- newAlocation[i] = mmTemplateList->pl_Masks[i+1];
+ newAlocation = (MODERNMASK *)mir_alloc(sizeof(MODERNMASK)*mmTemplateList->dwMaskCnt - 1);
+ memmove(newAlocation, mmTemplateList->pl_Masks, sizeof(MODERNMASK)*(mID + 1));
+ for (i = mID; i < mmTemplateList->dwMaskCnt - 1; i++) {
+ newAlocation[i] = mmTemplateList->pl_Masks[i + 1];
newAlocation[i].dwMaskId = i;
}
mir_free_and_nil(mmTemplateList->pl_Masks);
@@ -182,7 +175,6 @@ int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList) return mmTemplateList->dwMaskCnt;
}
-
int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK * mmTemplateList)
{
if (!mmTemplateList) return 0;
@@ -203,16 +195,15 @@ int SortMaskList(LISTMODERNMASK * mmList) DWORD pos = 1;
if (mmList->dwMaskCnt < 2) return 0;
do {
- if (mmList->pl_Masks[pos].dwMaskId < mmList->pl_Masks[pos-1].dwMaskId)
- {
- ExchangeMasksByID(pos, pos-1, mmList);
+ if (mmList->pl_Masks[pos].dwMaskId < mmList->pl_Masks[pos - 1].dwMaskId) {
+ ExchangeMasksByID(pos, pos - 1, mmList);
pos--;
if (pos < 1)
pos = 1;
}
else
pos++;
- } while(pos < mmList->dwMaskCnt);
+ } while (pos < mmList->dwMaskCnt);
return 1;
}
@@ -223,14 +214,15 @@ enum EXCEPTION_NOT_EQUAL = 1,
EXCEPTION_WILD = 2,
};
-static BOOL _GetParamValue( char * szText, unsigned int& start, unsigned int length, char* ¶m, unsigned int& paramlen, char* &value, unsigned int& valuelen, int& except )
+
+static BOOL _GetParamValue(char * szText, unsigned int& start, unsigned int length, char* ¶m, unsigned int& paramlen, char* &value, unsigned int& valuelen, int& except)
{
char * curChar = szText + start;
char * lastChar = szText + length;
enum { STATE_PARAM, STATE_VALUE };
int state = STATE_PARAM;
- if ( start >= length ) return FALSE;
+ if (start >= length) return FALSE;
paramlen = 0;
valuelen = 0;
@@ -240,20 +232,17 @@ static BOOL _GetParamValue( char * szText, unsigned int& start, unsigned int len except = EXCEPTION_EQUAL;
param = curChar;
-
BOOL exitLoop = false;
- while (!exitLoop )
- {
- switch ( *curChar )
- {
+ while (!exitLoop) {
+ switch (*curChar) {
case '^':
- if ( state == STATE_VALUE ) break;
+ if (state == STATE_VALUE) break;
except |= EXCEPTION_NOT_EQUAL;
exitLoop = TRUE;
//fall trough
case '=':
- if ( state == STATE_VALUE ) break;
+ if (state == STATE_VALUE) break;
//search value end
paramlen = curChar - param;
exitLoop = TRUE;
@@ -261,9 +250,8 @@ static BOOL _GetParamValue( char * szText, unsigned int& start, unsigned int len case ',':
default:
- if ( *curChar != ',' && curChar < lastChar ) break;
- if ( state == STATE_PARAM )
- {
+ if (*curChar != ',' && curChar < lastChar) break;
+ if (state == STATE_PARAM) {
// no parameter name only value
value = param;
param = NULL;
@@ -273,67 +261,56 @@ static BOOL _GetParamValue( char * szText, unsigned int& start, unsigned int len exitLoop = TRUE;
break;
case '*': case '?':
- if (state == STATE_PARAM ) break;
+ if (state == STATE_PARAM) break;
except |= EXCEPTION_WILD;
break;
}
- if ( exitLoop)
- {
- if (state == STATE_PARAM )
- {
+ if (exitLoop) {
+ if (state == STATE_PARAM) {
paramlen = curChar - param;
state = STATE_VALUE;
curChar++; //skip Sign
value = curChar;
exitLoop = FALSE;
}
- else if ( state == STATE_VALUE )
- {
+ else if (state == STATE_VALUE) {
valuelen = curChar - value;
}
}
- else
- {
- curChar++;
- }
+ else curChar++;
}
-
start = curChar - szText + 1;
// skip spaces
- if ( value && valuelen )
- {
- while ( *value == ' ' || *value == '\t' )
- {
+ if (value && valuelen) {
+ while (*value == ' ' || *value == '\t') {
value++;
valuelen--;
}
- while ( *( value + valuelen - 1) == ' ' || *( value + valuelen -1 ) == '\t' )
+ while (*(value + valuelen - 1) == ' ' || *(value + valuelen - 1) == '\t')
valuelen--;
}
- if ( param && paramlen )
- {
- while (*param == ' ' || *param == '\t' )
- {
+ if (param && paramlen) {
+ while (*param == ' ' || *param == '\t') {
param++;
paramlen--;
}
- while (*(param+paramlen-1) == ' ' || *(param+paramlen-1) == '\t' )
+ while (*(param + paramlen - 1) == ' ' || *(param + paramlen - 1) == '\t')
paramlen--;
}
- return ( value || param );
+ return (value || param);
}
int ParseToModernMask(MODERNMASK *mm, char * szText)
{
if (!mm || !szText) return -1;
- unsigned int textLen = mir_strlen(szText);
+ size_t textLen = mir_strlen(szText);
BYTE curParam = 0;
- MASKPARAM param = {0};
+ MASKPARAM param = { 0 };
unsigned int startPos = 0;
char * pszParam;
@@ -342,52 +319,47 @@ int ParseToModernMask(MODERNMASK *mm, char * szText) unsigned int valuelen;
int except;
- while ( _GetParamValue( szText, startPos, textLen, pszParam, paramlen, pszValue, valuelen, except))
- {
- if ( except & EXCEPTION_NOT_EQUAL )
+ while (_GetParamValue(szText, startPos, textLen, pszParam, paramlen, pszValue, valuelen, except)) {
+ if (except & EXCEPTION_NOT_EQUAL)
param.bMaskParamFlag = MPF_NOT_EQUAL;
else
param.bMaskParamFlag = MPF_EQUAL;
//Get param name
- if ( pszParam && paramlen )
- {
- param.szName = strdupn( pszParam, paramlen);
- param.dwId = mod_CalcHash( param.szName );
+ if (pszParam && paramlen) {
+ param.szName = strdupn(pszParam, paramlen);
+ param.dwId = mod_CalcHash(param.szName);
}
else //ParamName = 'Module'
{
param.szName = _strdup("Module");
- param.dwId = mod_CalcHash( param.szName );
+ param.dwId = mod_CalcHash(param.szName);
}
- param.szValue = strdupn( pszValue, valuelen );
+ param.szValue = strdupn(pszValue, valuelen);
- if (!(except & EXCEPTION_WILD))
- {
- param.dwValueHash = mod_CalcHash( param.szValue );
+ if (!(except & EXCEPTION_WILD)) {
+ param.dwValueHash = mod_CalcHash(param.szValue);
param.bMaskParamFlag |= MPF_HASHED;
}
- if (curParam >= mm->dwParamCnt)
- {
- mm->pl_Params = (MASKPARAM*)realloc(mm->pl_Params,(mm->dwParamCnt+1)*sizeof(MASKPARAM));
+ if (curParam >= mm->dwParamCnt) {
+ mm->pl_Params = (MASKPARAM*)realloc(mm->pl_Params, (mm->dwParamCnt + 1)*sizeof(MASKPARAM));
mm->dwParamCnt++;
}
- memmove(&(mm->pl_Params[curParam]),¶m,sizeof(MASKPARAM));
+ memmove(&(mm->pl_Params[curParam]), ¶m, sizeof(MASKPARAM));
curParam++;
memset(¶m, 0, sizeof(MASKPARAM));
}
return 0;
-};
+}
BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate)
{
//TODO
BOOL res = TRUE;
BYTE pVal = 0, pTemp = 0;
- while (pTemp < mmTemplate->dwParamCnt && pVal < mmValue->dwParamCnt)
- {
+ while (pTemp < mmTemplate->dwParamCnt && pVal < mmValue->dwParamCnt) {
// find pTemp parameter in mValue
DWORD vh, ph;
BOOL finded = 0;
@@ -395,87 +367,83 @@ BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate) ph = p.dwId;
vh = p.dwValueHash;
pVal = 0;
- if ( p.bMaskParamFlag& MPF_HASHED ) //compare by hash
- while (pVal < mmValue->dwParamCnt && mmValue->pl_Params[pVal].bMaskParamFlag != 0)
- {
- if (mmValue->pl_Params[pVal].dwId == ph)
- {
- if (mmValue->pl_Params[pVal].dwValueHash == vh){finded = 1; break;}
- else {finded = 0; break;}
+ if (p.bMaskParamFlag& MPF_HASHED) { //compare by hash
+ while (pVal < mmValue->dwParamCnt && mmValue->pl_Params[pVal].bMaskParamFlag != 0) {
+ if (mmValue->pl_Params[pVal].dwId == ph) {
+ if (mmValue->pl_Params[pVal].dwValueHash == vh) { finded = 1; break; }
+ else { finded = 0; break; }
}
pVal++;
}
- else
- while (mmValue->pl_Params[pVal].bMaskParamFlag != 0)
- {
- if (mmValue->pl_Params[pVal].dwId == ph)
- {
- if (wildcmp(mmValue->pl_Params[pVal].szValue,p.szValue)){finded = 1; break;}
- else {finded = 0; break;}
+ }
+ else {
+ while (mmValue->pl_Params[pVal].bMaskParamFlag != 0) {
+ if (mmValue->pl_Params[pVal].dwId == ph) {
+ if (wildcmp(mmValue->pl_Params[pVal].szValue, p.szValue)) { finded = 1; break; }
+ else { finded = 0; break; }
}
pVal++;
}
- if (!((finded && !(p.bMaskParamFlag&MPF_DIFF)) || (!finded && (p.bMaskParamFlag&MPF_DIFF))))
- {res = FALSE; break;}
+ if (!((finded && !(p.bMaskParamFlag&MPF_DIFF)) || (!finded && (p.bMaskParamFlag&MPF_DIFF)))) {
+ res = FALSE;
+ break;
+ }
pTemp++;
+ }
}
return res;
-};
+}
-BOOL CompareStrWithModernMask(char * szValue,MODERNMASK *mmTemplate)
+BOOL CompareStrWithModernMask(char * szValue, MODERNMASK *mmTemplate)
{
- MODERNMASK mmValue = {0};
+ MODERNMASK mmValue = { 0 };
int res;
- if (!ParseToModernMask(&mmValue, szValue))
- {
- res = CompareModernMask(&mmValue,mmTemplate);
+ if (!ParseToModernMask(&mmValue, szValue)) {
+ res = CompareModernMask(&mmValue, mmTemplate);
SkinSelector_DeleteMask(&mmValue);
return res;
}
else return 0;
-};
+}
//AddingMask
-int AddStrModernMaskToList(DWORD maskID, char * szStr, char * objectName, LISTMODERNMASK * mmTemplateList, void * pObjectList)
+int AddStrModernMaskToList(DWORD maskID, char *szStr, char *objectName, LISTMODERNMASK *mmTemplateList, void *pObjectList)
{
if (!szStr || !mmTemplateList) return -1;
- MODERNMASK mm = {0};
- if (ParseToModernMask(&mm,szStr)) return -1;
+ MODERNMASK mm = { 0 };
+ if (ParseToModernMask(&mm, szStr))
+ return -1;
mm.bObjectFound = FALSE;
mm.szObjectName = mir_strdup(objectName);
//mm.pObject = (void*) ske_FindObjectByName(objectName, OT_ANY, (SKINOBJECTSLIST*) pObjectList);
mm.dwMaskId = maskID;
- return AddModernMaskToList(&mm,mmTemplateList);
+ return AddModernMaskToList(&mm, mmTemplateList);
}
//Searching
-MODERNMASK * FindMaskByStr(char * szValue,LISTMODERNMASK * mmTemplateList)
+MODERNMASK* FindMaskByStr(char *szValue, LISTMODERNMASK *mmTemplateList)
{
//TODO
return NULL;
}
-SKINOBJECTDESCRIPTOR * skin_FindObjectByMask (MODERNMASK *mm,LISTMODERNMASK * mmTemplateList)
+SKINOBJECTDESCRIPTOR* skin_FindObjectByMask(MODERNMASK *mm, LISTMODERNMASK * mmTemplateList)
{
- SKINOBJECTDESCRIPTOR * res = NULL;
- DWORD i=0;
- while (i < mmTemplateList->dwMaskCnt)
- {
- if (CompareModernMask(mm,&(mmTemplateList->pl_Masks[i])))
- {
- res = (SKINOBJECTDESCRIPTOR*) mmTemplateList->pl_Masks[i].pObject;
- return res;
- }
+ DWORD i = 0;
+ while (i < mmTemplateList->dwMaskCnt) {
+ if (CompareModernMask(mm, &(mmTemplateList->pl_Masks[i])))
+ return (SKINOBJECTDESCRIPTOR*)mmTemplateList->pl_Masks[i].pObject;
+
i++;
}
- return res;
+ return NULL;
}
-SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue,LISTMODERNMASK * mmTemplateList)
+SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char * szValue, LISTMODERNMASK * mmTemplateList)
{
- MODERNMASK mm = {0};
+ MODERNMASK mm = { 0 };
SKINOBJECTDESCRIPTOR * res = NULL;
if (!mmTemplateList)
if (g_SkinObjectList.pMaskList)
@@ -484,83 +452,75 @@ SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue,LISTMODERNMASK * return NULL;
if (!mmTemplateList) return NULL;
- ParseToModernMask(&mm,szValue);
- res = skin_FindObjectByMask(&mm,mmTemplateList);
+ ParseToModernMask(&mm, szValue);
+ res = skin_FindObjectByMask(&mm, mmTemplateList);
SkinSelector_DeleteMask(&mm);
return res;
}
-TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
+TCHAR* GetParamNT(char *string, TCHAR *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
{
- char *ansibuf = (char*)mir_alloc(buflen/sizeof(TCHAR));
- GetParamN(string, ansibuf, buflen/sizeof(TCHAR), paramN, Delim, SkipSpaces);
- MultiByteToWideChar(CP_UTF8, 0, ansibuf,-1,buf,buflen);
+ char *ansibuf = (char*)mir_alloc(buflen / sizeof(TCHAR));
+ GetParamN(string, ansibuf, buflen / sizeof(TCHAR), paramN, Delim, SkipSpaces);
+ MultiByteToWideChar(CP_UTF8, 0, ansibuf, -1, buf, buflen);
mir_free(ansibuf);
return buf;
}
WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces)
{
- int i=0;
+ int i = 0;
DWORD start = 0;
DWORD end = 0;
DWORD CurentCount = 0;
DWORD len;
- while (i < mir_tstrlen(string))
- {
- if (string[i] == Delim)
- {
+ while (i < mir_tstrlen(string)) {
+ if (string[i] == Delim) {
if (CurentCount == paramN) break;
- start = i+1;
+ start = i + 1;
CurentCount++;
}
i++;
}
- if (CurentCount == paramN)
- {
- if (SkipSpaces)
- { //remove spaces
+ if (CurentCount == paramN) {
+ if (SkipSpaces) { //remove spaces
while (string[start] == ' ' && (int)start < mir_tstrlen(string))
start++;
- while (i>1 && string[i-1] == ' ' && i>(int)start)
+ while (i>1 && string[i - 1] == ' ' && i > (int)start)
i--;
}
- len = ((int)(i-start) < buflen)?i-start:buflen;
- _tcsncpy(buf, string+start, len);
+ len = ((int)(i - start) < buflen) ? i - start : buflen;
+ _tcsncpy(buf, string + start, len);
buf[len] = '\0';
}
else buf[0] = '\0';
return buf;
}
-char * GetParamN(char * string, char * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
+char* GetParamN(char *string, char *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
{
- int i=0;
+ int i = 0;
DWORD start = 0;
DWORD end = 0;
DWORD CurentCount = 0;
DWORD len;
- while (i < mir_strlen(string))
- {
- if (string[i] == Delim)
- {
+ while (i < mir_strlen(string)) {
+ if (string[i] == Delim) {
if (CurentCount == paramN) break;
- start = i+1;
+ start = i + 1;
CurentCount++;
}
i++;
}
- if (CurentCount == paramN)
- {
- if (SkipSpaces)
- { //remove spaces
+ if (CurentCount == paramN) {
+ if (SkipSpaces) { //remove spaces
while (string[start] == ' ' && (int)start < mir_strlen(string))
start++;
- while (i>1 && string[i-1] == ' ' && i>(int)start)
+ while (i>1 && string[i - 1] == ' ' && i > (int)start)
i--;
}
- len = ((int)(i-start) < buflen)?i-start:buflen;
- strncpy(buf,string+start,len);
+ len = ((int)(i - start) < buflen) ? i - start : buflen;
+ strncpy(buf, string + start, len);
buf[len] = '\0';
}
else buf[0] = '\0';
@@ -570,52 +530,51 @@ char * GetParamN(char * string, char * buf, int buflen, BYTE paramN, char Delim, //Parse DB string and add buttons
int RegisterButtonByParce(char * ObjectName, char * Params)
{
- char buf [255];
+ char buf[255];
int res;
- GetParamN(Params,buf, SIZEOF(buf), 0, ',',0);
- // if (boolstrcmpi("Push",buf)
- { //Push type
- char buf2[20] = {0};
- char pServiceName[255] = {0};
- char pStatusServiceName[255] = {0};
- int Left, Top,Right,Bottom;
- int MinWidth, MinHeight;
- char TL[9] = {0};
- TCHAR Hint[250] = {0};
- char Section[250] = {0};
- char Type[250] = {0};
-
- DWORD alingnto;
- int a = ((int)mir_bool_strcmpi(buf,"Switch"))*2;
-
- GetParamN(Params,pServiceName, SIZEOF(pServiceName),1,',',0);
- // if (a) GetParamN(Params,pStatusServiceName, sizeof(pStatusServiceName),a+1,',',0);
- Left = atoi(GetParamN(Params,buf2, SIZEOF(buf2),a+2,',',0));
- Top = atoi(GetParamN(Params,buf2, SIZEOF(buf2),a+3,',',0));
- Right = atoi(GetParamN(Params,buf2, SIZEOF(buf2),a+4,',',0));
- Bottom = atoi(GetParamN(Params,buf2, SIZEOF(buf2),a+5,',',0));
- GetParamN(Params,TL, SIZEOF(TL),a+6,',',0);
-
- MinWidth = atoi(GetParamN(Params,buf2, SIZEOF(buf2),a+7,',',0));
- MinHeight = atoi(GetParamN(Params,buf2, SIZEOF(buf2),a+8,',',0));
- GetParamNT(Params,Hint, SIZEOF(Hint),a+9,',',0);
- if (a)
- {
- GetParamN(Params,Section, SIZEOF(Section),2,',',0);
- GetParamN(Params,Type, SIZEOF(Type),3,',',0);
- }
- alingnto = ((TL[0] == 'R') ? SBF_ALIGN_TL_RIGHT : 0 )
- +((TL[0] == 'C') ? SBF_ALIGN_TL_HCENTER : 0 )
- +((TL[1] == 'B') ? SBF_ALIGN_TL_BOTTOM : 0 )
- +((TL[1] == 'C') ? SBF_ALIGN_TL_VCENTER : 0 )
- +((TL[2] == 'R') ? SBF_ALIGN_BR_RIGHT : 0 )
- +((TL[2] == 'C') ? SBF_ALIGN_BR_HCENTER : 0 )
- +((TL[3] == 'B') ? SBF_ALIGN_BR_BOTTOM : 0 )
- +((TL[3] == 'C') ? SBF_ALIGN_BR_VCENTER : 0 )
- +((TL[4] == 'I') ? SBF_CALL_ON_PRESS : 0 );
- if (a) res = ModernSkinButton_AddButton(pcli->hwndContactList,ObjectName+1,pServiceName,pStatusServiceName,"\0",Left,Top,Right,Bottom,alingnto,TranslateTS(Hint),Section,Type,MinWidth,MinHeight);
- else res = ModernSkinButton_AddButton(pcli->hwndContactList,ObjectName+1,pServiceName,pStatusServiceName,"\0",Left,Top,Right,Bottom,alingnto,TranslateTS(Hint),NULL,NULL,MinWidth,MinHeight);
+ GetParamN(Params, buf, SIZEOF(buf), 0, ',', 0);
+
+ //Push type
+ char buf2[20] = { 0 };
+ char pServiceName[255] = { 0 };
+ char pStatusServiceName[255] = { 0 };
+ int Left, Top, Right, Bottom;
+ int MinWidth, MinHeight;
+ char TL[9] = { 0 };
+ TCHAR Hint[250] = { 0 };
+ char Section[250] = { 0 };
+ char Type[250] = { 0 };
+
+ DWORD alingnto;
+ int a = ((int)mir_bool_strcmpi(buf, "Switch")) * 2;
+
+ GetParamN(Params, pServiceName, SIZEOF(pServiceName), 1, ',', 0);
+ // if (a) GetParamN(Params,pStatusServiceName, sizeof(pStatusServiceName),a+1,',',0);
+ Left = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 2, ',', 0));
+ Top = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 3, ',', 0));
+ Right = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 4, ',', 0));
+ Bottom = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 5, ',', 0));
+ GetParamN(Params, TL, SIZEOF(TL), a + 6, ',', 0);
+
+ MinWidth = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 7, ',', 0));
+ MinHeight = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 8, ',', 0));
+ GetParamNT(Params, Hint, SIZEOF(Hint), a + 9, ',', 0);
+ if (a) {
+ GetParamN(Params, Section, SIZEOF(Section), 2, ',', 0);
+ GetParamN(Params, Type, SIZEOF(Type), 3, ',', 0);
}
+ alingnto = ((TL[0] == 'R') ? SBF_ALIGN_TL_RIGHT : 0)
+ + ((TL[0] == 'C') ? SBF_ALIGN_TL_HCENTER : 0)
+ + ((TL[1] == 'B') ? SBF_ALIGN_TL_BOTTOM : 0)
+ + ((TL[1] == 'C') ? SBF_ALIGN_TL_VCENTER : 0)
+ + ((TL[2] == 'R') ? SBF_ALIGN_BR_RIGHT : 0)
+ + ((TL[2] == 'C') ? SBF_ALIGN_BR_HCENTER : 0)
+ + ((TL[3] == 'B') ? SBF_ALIGN_BR_BOTTOM : 0)
+ + ((TL[3] == 'C') ? SBF_ALIGN_BR_VCENTER : 0)
+ + ((TL[4] == 'I') ? SBF_CALL_ON_PRESS : 0);
+ if (a) res = ModernSkinButton_AddButton(pcli->hwndContactList, ObjectName + 1, pServiceName, pStatusServiceName, "\0", Left, Top, Right, Bottom, alingnto, TranslateTS(Hint), Section, Type, MinWidth, MinHeight);
+ else res = ModernSkinButton_AddButton(pcli->hwndContactList, ObjectName + 1, pServiceName, pStatusServiceName, "\0", Left, Top, Right, Bottom, alingnto, TranslateTS(Hint), NULL, NULL, MinWidth, MinHeight);
+
return res;
}
@@ -627,90 +586,79 @@ int RegisterButtonByParce(char * ObjectName, char * Params) int RegisterObjectByParce(char * ObjectName, char * Params)
{
if (!ObjectName || !Params) return 0;
- {
- int res = 0;
- SKINOBJECTDESCRIPTOR obj = {0};
- char buf[250];
- obj.szObjectID = mir_strdup(ObjectName);
- GetParamN(Params,buf, SIZEOF(buf), 0, ',',0);
- if (mir_bool_strcmpi(buf,"Glyph"))
- obj.bType = OT_GLYPHOBJECT;
- else if (mir_bool_strcmpi(buf,"Font"))
- obj.bType = OT_FONTOBJECT;
-
- switch (obj.bType)
- {
- case OT_GLYPHOBJECT:
- {
- GLYPHOBJECT gl = {0};
- GetParamN(Params,buf, SIZEOF(buf),1,',',0);
- if (mir_bool_strcmpi(buf,"Solid"))
- {
- //Solid
- int r,g,b;
- gl.Style = ST_BRUSH;
- r = atoi(GetParamN(Params,buf, SIZEOF(buf),2,',',0));
- g = atoi(GetParamN(Params,buf, SIZEOF(buf),3,',',0));
- b = atoi(GetParamN(Params,buf, SIZEOF(buf),4,',',0));
- gl.dwAlpha = atoi(GetParamN(Params,buf, SIZEOF(buf),5,',',0));
- gl.dwColor = RGB(r,g,b);
- }
- else if (mir_bool_strcmpi(buf,"Image"))
- {
- //Image
- gl.Style = ST_IMAGE;
- gl.szFileName = mir_strdup(GetParamN(Params,buf, SIZEOF(buf),2,',',0));
- gl.dwLeft = atoi(GetParamN(Params,buf, SIZEOF(buf),4,',',0));
- gl.dwTop = atoi(GetParamN(Params,buf, SIZEOF(buf),5,',',0));
- gl.dwRight = atoi(GetParamN(Params,buf, SIZEOF(buf),6,',',0));
- gl.dwBottom = atoi(GetParamN(Params,buf, SIZEOF(buf),7,',',0));
- gl.dwAlpha = atoi(GetParamN(Params,buf, SIZEOF(buf),8,',',0));
- GetParamN(Params,buf, SIZEOF(buf),3,',',0);
- if (mir_bool_strcmpi(buf,"TileBoth")) gl.FitMode = FM_TILE_BOTH;
- else if (mir_bool_strcmpi(buf,"TileVert")) gl.FitMode = FM_TILE_VERT;
- else if (mir_bool_strcmpi(buf,"TileHorz")) gl.FitMode = FM_TILE_HORZ;
- else gl.FitMode = 0;
- }
- else if (mir_bool_strcmpi(buf,"Fragment"))
- {
- //Image
- gl.Style = ST_FRAGMENT;
- gl.szFileName = mir_strdup(GetParamN(Params,buf, SIZEOF(buf),2,',',0));
-
- gl.clipArea.x = atoi(GetParamN(Params,buf, SIZEOF(buf),3,',',0));
- gl.clipArea.y = atoi(GetParamN(Params,buf, SIZEOF(buf),4,',',0));
- gl.szclipArea.cx = atoi(GetParamN(Params,buf, SIZEOF(buf),5,',',0));
- gl.szclipArea.cy = atoi(GetParamN(Params,buf, SIZEOF(buf),6,',',0));
-
- gl.dwLeft = atoi(GetParamN(Params,buf, SIZEOF(buf),8,',',0));
- gl.dwTop = atoi(GetParamN(Params,buf, SIZEOF(buf),9,',',0));
- gl.dwRight = atoi(GetParamN(Params,buf, SIZEOF(buf),10, ',',0));
- gl.dwBottom = atoi(GetParamN(Params,buf, SIZEOF(buf),11,',',0));
- gl.dwAlpha = atoi(GetParamN(Params,buf, SIZEOF(buf),12,',',0));
- GetParamN(Params,buf, SIZEOF(buf),7,',',0);
- if (mir_bool_strcmpi(buf,"TileBoth")) gl.FitMode = FM_TILE_BOTH;
- else if (mir_bool_strcmpi(buf,"TileVert")) gl.FitMode = FM_TILE_VERT;
- else if (mir_bool_strcmpi(buf,"TileHorz")) gl.FitMode = FM_TILE_HORZ;
- else gl.FitMode = 0;
- }
- else
- {
- //None
- gl.Style = ST_SKIP;
- }
- obj.Data = ≷
- res = ske_AddDescriptorToSkinObjectList(&obj,NULL);
- mir_free_and_nil(obj.szObjectID);
- mir_free_and_nil(gl.szFileName);
- return res;
- }
- break;
- }
+
+ int res = 0;
+ SKINOBJECTDESCRIPTOR obj = { 0 };
+ char buf[250];
+ obj.szObjectID = mir_strdup(ObjectName);
+ GetParamN(Params, buf, SIZEOF(buf), 0, ',', 0);
+ if (mir_bool_strcmpi(buf, "Glyph"))
+ obj.bType = OT_GLYPHOBJECT;
+ else if (mir_bool_strcmpi(buf, "Font"))
+ obj.bType = OT_FONTOBJECT;
+
+ if (obj.bType != OT_GLYPHOBJECT)
+ return 0;
+
+ GLYPHOBJECT gl = { 0 };
+ GetParamN(Params, buf, SIZEOF(buf), 1, ',', 0);
+ if (mir_bool_strcmpi(buf, "Solid")) {
+ //Solid
+ int r, g, b;
+ gl.Style = ST_BRUSH;
+ r = atoi(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
+ g = atoi(GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0));
+ b = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
+ gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
+ gl.dwColor = RGB(r, g, b);
}
- return 0;
+ else if (mir_bool_strcmpi(buf, "Image")) {
+ //Image
+ gl.Style = ST_IMAGE;
+ gl.szFileName = mir_strdup(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
+ gl.dwLeft = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
+ gl.dwTop = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
+ gl.dwRight = atoi(GetParamN(Params, buf, SIZEOF(buf), 6, ',', 0));
+ gl.dwBottom = atoi(GetParamN(Params, buf, SIZEOF(buf), 7, ',', 0));
+ gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 8, ',', 0));
+ GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0);
+ if (mir_bool_strcmpi(buf, "TileBoth")) gl.FitMode = FM_TILE_BOTH;
+ else if (mir_bool_strcmpi(buf, "TileVert")) gl.FitMode = FM_TILE_VERT;
+ else if (mir_bool_strcmpi(buf, "TileHorz")) gl.FitMode = FM_TILE_HORZ;
+ else gl.FitMode = 0;
+ }
+ else if (mir_bool_strcmpi(buf, "Fragment")) {
+ //Image
+ gl.Style = ST_FRAGMENT;
+ gl.szFileName = mir_strdup(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
+
+ gl.clipArea.x = atoi(GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0));
+ gl.clipArea.y = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
+ gl.szclipArea.cx = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
+ gl.szclipArea.cy = atoi(GetParamN(Params, buf, SIZEOF(buf), 6, ',', 0));
+
+ gl.dwLeft = atoi(GetParamN(Params, buf, SIZEOF(buf), 8, ',', 0));
+ gl.dwTop = atoi(GetParamN(Params, buf, SIZEOF(buf), 9, ',', 0));
+ gl.dwRight = atoi(GetParamN(Params, buf, SIZEOF(buf), 10, ',', 0));
+ gl.dwBottom = atoi(GetParamN(Params, buf, SIZEOF(buf), 11, ',', 0));
+ gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 12, ',', 0));
+ GetParamN(Params, buf, SIZEOF(buf), 7, ',', 0);
+ if (mir_bool_strcmpi(buf, "TileBoth")) gl.FitMode = FM_TILE_BOTH;
+ else if (mir_bool_strcmpi(buf, "TileVert")) gl.FitMode = FM_TILE_VERT;
+ else if (mir_bool_strcmpi(buf, "TileHorz")) gl.FitMode = FM_TILE_HORZ;
+ else gl.FitMode = 0;
+ }
+ else {
+ //None
+ gl.Style = ST_SKIP;
+ }
+ obj.Data = ≷
+ res = ske_AddDescriptorToSkinObjectList(&obj, NULL);
+ mir_free_and_nil(obj.szObjectID);
+ mir_free_and_nil(gl.szFileName);
+ return res;
}
-
int SkinDrawGlyphMask(HDC hdc, RECT *rcSize, RECT *rcClip, MODERNMASK *ModernMask)
{
if (!ModernMask) return 0;
@@ -719,29 +667,28 @@ int SkinDrawGlyphMask(HDC hdc, RECT *rcSize, RECT *rcClip, MODERNMASK *ModernMas rq.hDC = hdc;
rq.rcDestRect = *rcSize;
rq.rcClipRect = *rcClip;
- strncpy(rq.szObjectID,"Masked draw",SIZEOF("Masked draw"));
- return ske_Service_DrawGlyph((WPARAM)&rq,(LPARAM)ModernMask);
+ strncpy(rq.szObjectID, "Masked draw", SIZEOF("Masked draw"));
+ return ske_Service_DrawGlyph((WPARAM)&rq, (LPARAM)ModernMask);
}
-
int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT *rcClip, char * objectID)
{
SKINDRAWREQUEST rq;
- POINT pt = {0};
- RECT rc,r1;
+ POINT pt = { 0 };
+ RECT rc, r1;
HWND hwnd = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
if (!objectID) return 0;
- GetWindowRect(hwndIn,&r1);
+ GetWindowRect(hwndIn, &r1);
pt.x = r1.left;
pt.y = r1.top;
//ClientToScreen(hwndIn,&pt);
- GetWindowRect(hwnd,&rc);
- OffsetRect(&rc,-pt.x ,-pt.y);
+ GetWindowRect(hwnd, &rc);
+ OffsetRect(&rc, -pt.x, -pt.y);
rq.hDC = hdc;
rq.rcDestRect = rc;
rq.rcClipRect = *rcClip;
- strncpy(rq.szObjectID,objectID,SIZEOF(rq.szObjectID));
+ strncpy(rq.szObjectID, objectID, SIZEOF(rq.szObjectID));
///ske_Service_DrawGlyph((WPARAM)&rq,0); //$$$
- return CallService(MS_SKIN_DRAWGLYPH,(WPARAM)&rq,0);
+ return CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0);
}
diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h index eaa1d0505d..e319777cb9 100644 --- a/plugins/Clist_nicer/src/Include/commonheaders.h +++ b/plugins/Clist_nicer/src/Include/commonheaders.h @@ -33,11 +33,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define FASTCALL __fastcall
#include <windows.h>
+#include <shlwapi.h>
+#include <Richedit.h>
+
#include <uxtheme.h>
#include <vssym32.h>
#include <time.h>
-#include <shlwapi.h>
-#include <Richedit.h>
#include <newpluginapi.h>
#include <win2k.h>
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 9144a1c694..8cb1a16d47 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -198,7 +198,7 @@ void fnTrayIconRemove(HWND hwnd, const char *szProto) mir_cslock lck(trayLockCS);
for (int i = 0; i < cli.trayIconCount; i++) {
- struct trayIconInfo_t* pii = &cli.trayIcon[i];
+ trayIconInfo_t *pii = &cli.trayIcon[i];
if (pii->id != 0 && !mir_strcmp(szProto, pii->szProto)) {
NOTIFYICONDATA nid = { SIZEOFNID };
nid.hWnd = hwnd;
@@ -234,14 +234,13 @@ int fnTrayIconInit(HWND hwnd) cli.trayIconCount = 1;
if (netProtoCount) {
- cli.trayIcon = (trayIconInfo_t *)mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount());
+ cli.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount());
int trayIconSetting = db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
if (trayIconSetting == SETTING_TRAYICON_SINGLE) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
- if (!db_get_s(NULL, "CList", "PrimaryStatus", &dbv)
- && (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysPrimary", 0)))
+ if (!db_get_s(NULL, "CList", "PrimaryStatus", &dbv) && (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysPrimary", 0)))
szProto = dbv.pszVal;
else
szProto = NULL;
@@ -268,7 +267,7 @@ int fnTrayIconInit(HWND hwnd) }
}
else {
- cli.trayIcon = (trayIconInfo_t *)mir_calloc(sizeof(trayIconInfo_t));
+ cli.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t));
cli.pfnTrayIconAdd(hwnd, NULL, NULL, CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
}
@@ -299,7 +298,7 @@ int fnTrayIconDestroy(HWND hwnd) return 0;
}
-//called when Explorer crashes and the taskbar is remade
+// called when Explorer crashes and the taskbar is remade
void fnTrayIconTaskbarCreated(HWND hwnd)
{
initcheck;
@@ -329,8 +328,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer if (!hNewIcon)
return -1;
- int i;
- for (i = 0; i < cli.trayIconCount; i++) {
+ for (int i = 0; i < cli.trayIconCount; i++) {
if (cli.trayIcon[i].id == 0)
continue;
if (mir_strcmp(cli.trayIcon[i].szProto, szPreferredProto))
@@ -353,8 +351,8 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer return i;
}
- //if there wasn't a suitable icon, change all the icons
- for (i = 0; i < cli.trayIconCount; i++) {
+ // if there wasn't a suitable icon, change all the icons
+ for (int i = 0; i < cli.trayIconCount; i++) {
if (cli.trayIcon[i].id == 0)
continue;
nid.uID = cli.trayIcon[i].id;
@@ -376,10 +374,12 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer DWORD time1 = db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 200;
DWORD time2 = db_get_w(NULL, "CList", "IconFlashTime", 550) + 1000;
DWORD time = max(max(2000, time1), time2);
- if (RefreshTimerId) {
- KillTimer(NULL, RefreshTimerId); RefreshTimerId = 0;
- }
- RefreshTimerId = SetTimer(NULL, 0, time, RefreshTimerProc); // if unknown base was changed - than show preffered proto icon for 2 sec and reset it to original one after timeout
+ if (RefreshTimerId)
+ KillTimer(NULL, RefreshTimerId);
+
+ // if unknown base was changed - than show preffered proto icon for 2 sec
+ // and reset it to original one after timeout
+ RefreshTimerId = SetTimer(NULL, 0, time, RefreshTimerProc);
}
return i;
}
@@ -415,7 +415,7 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) goto LBL_Error;
}
- //if there wasn't a specific icon, there will only be one suitable
+ // if there wasn't a specific icon, there will only be one suitable
for (int i = 0; i < cli.trayIconCount; i++) {
if (cli.trayIcon[i].id == 0)
continue;
@@ -545,7 +545,7 @@ void fnTrayIconSetToBase(char *szPreferredProto) return;
}
- //if there wasn't a specific icon, there will only be one suitable
+ // if there wasn't a specific icon, there will only be one suitable
for (i = 0; i < cli.trayIconCount; i++) {
if (cli.trayIcon[i].id == 0)
continue;
|