summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/clist_modern.vcxproj5
-rw-r--r--plugins/ListeningTo/src/players/generic.cpp149
-rw-r--r--plugins/MyDetails/src/data.cpp3
-rw-r--r--plugins/PasteIt/src/PasteToWeb.cpp6
-rw-r--r--plugins/QuickMessages/src/options.cpp5
-rw-r--r--plugins/Rate/src/main.cpp14
-rw-r--r--plugins/SeenPlugin/src/options.cpp6
-rw-r--r--plugins/SendScreenshotPlus/SendSS.vcxproj1
-rw-r--r--plugins/SkypeStatusChange/src/main.cpp127
-rw-r--r--plugins/SplashScreen/src/bitmap_funcs.cpp4
-rw-r--r--plugins/SplashScreen/src/main.cpp115
-rw-r--r--plugins/SplashScreen/src/options.cpp634
-rw-r--r--plugins/SplashScreen/src/splash.cpp6
-rwxr-xr-xplugins/StopSpamMod/src/options.cpp323
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp188
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp32
-rw-r--r--plugins/TipperYM/src/mir_smileys.cpp11
-rw-r--r--plugins/TopToolBar/src/toolbar.cpp6
-rw-r--r--plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp855
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp55
-rw-r--r--plugins/UserInfoEx/src/psp_anniversary.cpp1
-rw-r--r--plugins/Utils/mir_options.cpp4
-rw-r--r--plugins/Variables/src/contact.cpp127
-rwxr-xr-xplugins/Watrack_MPD/src/main.cpp2
-rw-r--r--plugins/Weather/src/weather_addstn.cpp32
-rw-r--r--plugins/Weather/src/weather_mwin.cpp84
-rw-r--r--plugins/Weather/src/weather_svcs.cpp48
-rw-r--r--plugins/WebView/src/webview.cpp108
-rw-r--r--plugins/WebView/src/webview.h2
-rw-r--r--plugins/WebView/src/webview_getdata.cpp14
-rw-r--r--plugins/WebView/src/webview_opts.cpp85
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp23
-rw-r--r--plugins/WhoUsesMyFiles/src/wumfplug.cpp8
-rw-r--r--plugins/WinterSpeak/src/DialogConfigActive.cpp242
-rw-r--r--plugins/XSoundNotify/src/dialog.cpp202
35 files changed, 1627 insertions, 1900 deletions
diff --git a/plugins/Clist_modern/clist_modern.vcxproj b/plugins/Clist_modern/clist_modern.vcxproj
index 8c88af5879..da7a7228b6 100644
--- a/plugins/Clist_modern/clist_modern.vcxproj
+++ b/plugins/Clist_modern/clist_modern.vcxproj
@@ -25,4 +25,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <DisableSpecificWarnings>4458;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ </ItemDefinitionGroup>
</Project> \ No newline at end of file
diff --git a/plugins/ListeningTo/src/players/generic.cpp b/plugins/ListeningTo/src/players/generic.cpp
index dcf7ba02df..df0a14304e 100644
--- a/plugins/ListeningTo/src/players/generic.cpp
+++ b/plugins/ListeningTo/src/players/generic.cpp
@@ -104,95 +104,94 @@ GenericPlayer::~GenericPlayer()
void GenericPlayer::ProcessReceived()
{
- {
- mir_cslock lck(cs);
+ mir_cslockfull lck(cs);
- // Do the processing
- // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0"
+ // Do the processing
+ // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0"
- WCHAR *p1 = wcsstr(received, L"\\0");
- if (IsEmpty(received) || p1 == NULL)
- return;
+ WCHAR *p1 = wcsstr(received, L"\\0");
+ if (IsEmpty(received) || p1 == NULL)
+ return;
- // Process string
- WCHAR *parts[11] = { 0 };
- int pCount = 0;
- WCHAR *p = received;
- do {
- *p1 = _T('\0');
- parts[pCount] = p;
- pCount++;
- p = p1 + 2;
- p1 = wcsstr(p, _T("\\0"));
- } while (p1 != NULL && pCount < 10);
- if (p1 != NULL)
- *p1 = _T('\0');
+ // Process string
+ WCHAR *parts[11] = { 0 };
+ int pCount = 0;
+ WCHAR *p = received;
+ do {
+ *p1 = _T('\0');
parts[pCount] = p;
+ pCount++;
+ p = p1 + 2;
+ p1 = wcsstr(p, _T("\\0"));
+ } while (p1 != NULL && pCount < 10);
+ if (p1 != NULL)
+ *p1 = _T('\0');
+ parts[pCount] = p;
+
+ if (pCount < 5)
+ return;
- if (pCount < 5)
- return;
-
- // See if player is enabled
- Player *player = this;
- for (int i = FIRST_PLAYER; i < NUM_PLAYERS; i++) {
+ // See if player is enabled
+ Player *player = this;
+ for (int i = FIRST_PLAYER; i < NUM_PLAYERS; i++) {
- WCHAR *player_name = players[i]->name;
+ WCHAR *player_name = players[i]->name;
- if (_wcsicmp(parts[1], player_name) == 0) {
- player = players[i];
- break;
- }
+ if (_wcsicmp(parts[1], player_name) == 0) {
+ player = players[i];
+ break;
}
+ }
- player->FreeData();
+ player->FreeData();
- if (wcscmp(L"1", parts[0]) != 0 || IsEmpty(parts[1]) || (IsEmpty(parts[3]) && IsEmpty(parts[4]))) {
- // Stoped playing or not enought info
- }
- else {
- mir_cslock lck(player->GetLock());
- LISTENINGTOINFO *li = player->GetInfo();
-
- li->cbSize = sizeof(listening_info);
- li->dwFlags = LTI_TCHAR;
- li->ptszType = U2TD(parts[2], _T("Music"));
- li->ptszTitle = U2T(parts[3]);
- li->ptszArtist = U2T(parts[4]);
- li->ptszAlbum = U2T(parts[5]);
- li->ptszTrack = U2T(parts[6]);
- li->ptszYear = U2T(parts[7]);
- li->ptszGenre = U2T(parts[8]);
-
- if (player == this)
- li->ptszPlayer = mir_u2t(parts[1]);
- else
- li->ptszPlayer = mir_tstrdup(player->name);
-
- if (parts[9] != NULL) {
- long length = _wtoi(parts[9]);
- if (length > 0) {
- li->ptszLength = (TCHAR*)mir_alloc(10 * sizeof(TCHAR));
-
- int s = length % 60;
- int m = (length / 60) % 60;
- int h = (length / 60) / 60;
-
- if (h > 0)
- mir_sntprintf(li->ptszLength, 9, _T("%d:%02d:%02d"), h, m, s);
- else
- mir_sntprintf(li->ptszLength, 9, _T("%d:%02d"), m, s);
- }
+ if (wcscmp(L"1", parts[0]) != 0 || IsEmpty(parts[1]) || (IsEmpty(parts[3]) && IsEmpty(parts[4]))) {
+ // Stoped playing or not enought info
+ }
+ else {
+ mir_cslock plck(player->GetLock());
+ LISTENINGTOINFO *li = player->GetInfo();
+
+ li->cbSize = sizeof(listening_info);
+ li->dwFlags = LTI_TCHAR;
+ li->ptszType = U2TD(parts[2], _T("Music"));
+ li->ptszTitle = U2T(parts[3]);
+ li->ptszArtist = U2T(parts[4]);
+ li->ptszAlbum = U2T(parts[5]);
+ li->ptszTrack = U2T(parts[6]);
+ li->ptszYear = U2T(parts[7]);
+ li->ptszGenre = U2T(parts[8]);
+
+ if (player == this)
+ li->ptszPlayer = mir_u2t(parts[1]);
+ else
+ li->ptszPlayer = mir_tstrdup(player->name);
+
+ if (parts[9] != NULL) {
+ long length = _wtoi(parts[9]);
+ if (length > 0) {
+ li->ptszLength = (TCHAR*)mir_alloc(10 * sizeof(TCHAR));
+
+ int s = length % 60;
+ int m = (length / 60) % 60;
+ int h = (length / 60) / 60;
+
+ if (h > 0)
+ mir_sntprintf(li->ptszLength, 9, _T("%d:%02d:%02d"), h, m, s);
+ else
+ mir_sntprintf(li->ptszLength, 9, _T("%d:%02d"), m, s);
}
}
+ }
- // Put back the '\\'s
- for (int i = 1; i <= pCount; i++)
- *(parts[i] - 2) = L'\\';
- if (p1 != NULL)
- *p1 = L'\\';
+ // Put back the '\\'s
+ for (int i = 1; i <= pCount; i++)
+ *(parts[i] - 2) = L'\\';
+ if (p1 != NULL)
+ *p1 = L'\\';
- wcscpy(last_received, received);
- }
+ wcscpy(last_received, received);
+ lck.unlock();
NotifyInfoChanged();
}
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index aaaa94358e..1bd0754b8f 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -144,8 +144,6 @@ int Protocol::GetStatus()
void Protocol::SetStatus(int aStatus)
{
- TCHAR status_msg[256];
-
if (ServiceExists(MS_CS_SETSTATUSEX)) {
// BEGIN From commomstatus.cpp (KeepStatus)
int i, count, pCount;
@@ -170,6 +168,7 @@ void Protocol::SetStatus(int aStatus)
pse[0]->status = aStatus;
pse[0]->szName = name;
+ TCHAR status_msg[256];
GetStatusMsg(aStatus, status_msg, _countof(status_msg));
pse[0]->szMsg = status_msg;
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp
index 52f7c8f147..c57cd58c38 100644
--- a/plugins/PasteIt/src/PasteToWeb.cpp
+++ b/plugins/PasteIt/src/PasteToWeb.cpp
@@ -284,9 +284,9 @@ void PasteToWeb::FromClipboard()
if (mir_strlen(cStr) > str.length())
{
str = L"";
- LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP);
- str.append(wStr, wStr + mir_wstrlen(wStr));
- mir_free(wStr);
+ LPWSTR p = mir_a2u_cp(cStr, CP_ACP);
+ str.append(p, p + mir_wstrlen(p));
+ mir_free(p);
}
GlobalUnlock(obj);
}
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp
index 6a21be954f..e3d2abfa1e 100644
--- a/plugins/QuickMessages/src/options.cpp
+++ b/plugins/QuickMessages/src/options.cpp
@@ -111,7 +111,6 @@ void SetMenuEntryProperties(HWND hdlg)
{
TVITEM tvi;
HTREEITEM hItem = NULL;
- ButtonData* bd = NULL;
int pos = 0;
if (TreeView_GetCount(hButtonsList) && (tvi.hItem = TreeView_GetSelection(hButtonsList))) {
@@ -137,7 +136,7 @@ void SetMenuEntryProperties(HWND hdlg)
TreeView_GetItem(hMenuTree, &tvi);
if (tvi.lParam) {
- ButtonData* bd = (ButtonData*)tvi.lParam;
+ ButtonData *bd = (ButtonData*)tvi.lParam;
TCHAR szValue[256];
GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
if (mir_tstrlen(szValue)) {
@@ -154,7 +153,7 @@ void SetMenuEntryProperties(HWND hdlg)
}
while (tvi.hItem) {
TreeView_GetItem(hMenuTree, &tvi);
- bd = (ButtonData*)tvi.lParam;
+ ButtonData *bd = (ButtonData*)tvi.lParam;
bd->dwOPPos = pos++;
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp
index d4e34a913e..9b8cb8a990 100644
--- a/plugins/Rate/src/main.cpp
+++ b/plugins/Rate/src/main.cpp
@@ -38,11 +38,11 @@
HINSTANCE g_hInst;
static HANDLE hExtraIcon = NULL;
-byte bRate = 0;
int hLangpack;
-PLUGININFOEX pluginInfo={
- sizeof(PLUGININFOEX),
+PLUGININFOEX pluginInfo =
+{
+ sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
__DESCRIPTION,
@@ -50,15 +50,15 @@ PLUGININFOEX pluginInfo={
__AUTHOREMAIL,
__COPYRIGHT,
__AUTHORWEB,
- UNICODE_AWARE,
+ UNICODE_AWARE,
// {45230488-977B-405B-856D-EA276D7083B7}
- {0x45230488, 0x977b, 0x405b, {0x85, 0x6d, 0xea, 0x27, 0x6d, 0x70, 0x83, 0xb7}}
+ {0x45230488, 0x977b, 0x405b, {0x85, 0x6d, 0xea, 0x27, 0x6d, 0x70, 0x83, 0xb7}}
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
- g_hInst = hinstDLL;
- return TRUE;
+ g_hInst = hinstDLL;
+ return TRUE;
}
// плагининфо
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp
index e704a9f8c2..89aeb04247 100644
--- a/plugins/SeenPlugin/src/options.cpp
+++ b/plugins/SeenPlugin/src/options.cpp
@@ -76,17 +76,15 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
else if (HIWORD(wparam) == CPN_COLOURCHANGED) {
WORD idText, idBack;
- POPUPDATAT ppd = { 0 };
- DBVARIANT dbv = { 0 };
- DWORD temp;
if (LOWORD(wparam) > ID_STATUS_OUTTOLUNCH) // we have clicked a text color
idText = wparam, idBack = wparam - 20;
else
idText = wparam + 20, idBack = wparam;
+ POPUPDATAT ppd = { 0 };
ppd.colorBack = SendDlgItemMessage(hdlg, idBack, CPM_GETCOLOUR, 0, 0);
ppd.colorText = SendDlgItemMessage(hdlg, idText, CPM_GETCOLOUR, 0, 0);
- temp = GetDWordFromColors(ppd.colorBack, ppd.colorText);
+ DWORD temp = GetDWordFromColors(ppd.colorBack, ppd.colorText);
GetColorsFromDWord(&ppd.colorBack, &ppd.colorText, temp);
SendDlgItemMessage(hdlg, idBack, CPM_SETCOLOUR, 0, ppd.colorBack);
SendDlgItemMessage(hdlg, idText, CPM_SETCOLOUR, 0, ppd.colorText);
diff --git a/plugins/SendScreenshotPlus/SendSS.vcxproj b/plugins/SendScreenshotPlus/SendSS.vcxproj
index 888122204d..666cd45526 100644
--- a/plugins/SendScreenshotPlus/SendSS.vcxproj
+++ b/plugins/SendScreenshotPlus/SendSS.vcxproj
@@ -27,6 +27,7 @@
</ImportGroup>
<ItemDefinitionGroup>
<ClCompile>
+ <DisableSpecificWarnings>4458;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
</ClCompile>
</ItemDefinitionGroup>
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp
index ab63f7ba5f..b8ab4b47ba 100644
--- a/plugins/SkypeStatusChange/src/main.cpp
+++ b/plugins/SkypeStatusChange/src/main.cpp
@@ -47,7 +47,7 @@ enum
LPCTSTR g_pszSkypeWndClassName = _T("SkypeHelperWindow{155198f0-8749-47b7-ac53-58f2ac70844c}");
-const CMirandaStatus2SkypeStatus g_aStatusCode[10] =
+const CMirandaStatus2SkypeStatus g_aStatusCode[10] =
{
{ID_STATUS_AWAY, "AWAY",_T("Away")},
{ID_STATUS_NA, "AWAY",_T("NA")}, // removed in Skype 5
@@ -61,21 +61,21 @@ const CMirandaStatus2SkypeStatus g_aStatusCode[10] =
{ID_STATUS_OUTTOLUNCH,"DND",_T("Out to lunch")}
};
-enum{INVALID_INDEX = 0xFFFFFFFF};
-
+enum { INVALID_INDEX = 0xFFFFFFFF };
+
class CStatusInfo
{
public:
- CStatusInfo() : m_nStatusIndex(INVALID_INDEX){m_szModule[0] = '\0';}
+ CStatusInfo() : m_nStatusIndex(INVALID_INDEX) { m_szModule[0] = '\0'; }
- size_t StatusIndex()const{return m_nStatusIndex;}
- void StatusIndex(size_t val){m_nStatusIndex = val;}
+ size_t StatusIndex()const { return m_nStatusIndex; }
+ void StatusIndex(size_t val) { m_nStatusIndex = val; }
- const char* Module()const{return m_szModule;}
+ const char* Module()const { return m_szModule; }
void Module(const char* val)
{
if (val)
- strncpy_s(m_szModule,val,mir_strlen(val));
+ strncpy_s(m_szModule, val, mir_strlen(val));
else
m_szModule[0] = '\0';
}
@@ -99,27 +99,26 @@ int SSC_OnProtocolAck(WPARAM, LPARAM lParam)
return 0;
if (!g_Options.IsProtocolExcluded(pAckData->szModule)) {
- int nStatus = CallProtoService(pAckData->szModule,PS_GETSTATUS,0,0);
- for(size_t i = 0; i < _countof(g_aStatusCode); ++i) {
+ int nStatus = CallProtoService(pAckData->szModule, PS_GETSTATUS, 0, 0);
+ for (size_t i = 0; i < _countof(g_aStatusCode); ++i) {
const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[i];
if (ms.m_nMirandaStatus == nStatus) {
int nPrevStatus;
- if ((false == g_Options.IsProtocolStatusExcluded(pAckData->szModule,nStatus))
- && ((false == g_Options.GetSyncStatusStateFlag())
- || (false == g_Options.GetPreviousStatus(pAckData->szModule,nPrevStatus))
- || (nPrevStatus != nStatus)))
- {
- {
- mir_cslock guard(g_csStatusInfo);
- g_CurrStatusInfo.StatusIndex(i);
- g_CurrStatusInfo.Module(pAckData->szModule);
- }
- if (0 == ::PostMessage(HWND_BROADCAST,g_MsgIDSkypeControlAPIDiscover,(WPARAM)g_wndMainWindow,0)) {
- mir_cslock guard(g_csStatusInfo);
- g_CurrStatusInfo.StatusIndex(INVALID_INDEX);
- g_CurrStatusInfo.Module(NULL);
- }
- else g_Options.SetPreviousStatus(pAckData->szModule,nStatus);
+ if ((false == g_Options.IsProtocolStatusExcluded(pAckData->szModule, nStatus))
+ && ((false == g_Options.GetSyncStatusStateFlag())
+ || (false == g_Options.GetPreviousStatus(pAckData->szModule, nPrevStatus))
+ || (nPrevStatus != nStatus))) {
+ {
+ mir_cslock guard(g_csStatusInfo);
+ g_CurrStatusInfo.StatusIndex(i);
+ g_CurrStatusInfo.Module(pAckData->szModule);
+ }
+ if (0 == ::PostMessage(HWND_BROADCAST, g_MsgIDSkypeControlAPIDiscover, (WPARAM)g_wndMainWindow, 0)) {
+ mir_cslock guard(g_csStatusInfo);
+ g_CurrStatusInfo.StatusIndex(INVALID_INDEX);
+ g_CurrStatusInfo.Module(NULL);
+ }
+ else g_Options.SetPreviousStatus(pAckData->szModule, nStatus);
}
break;
}
@@ -129,31 +128,31 @@ int SSC_OnProtocolAck(WPARAM, LPARAM lParam)
return 0;
}
-static void ThreadFunc(void*)
-{
+static void ThreadFunc(void*)
+{
while (true) {
MSG msg;
- if (TRUE == ::PeekMessage(&msg,g_wndMainWindow,0,0,PM_NOREMOVE)) {
- while(::GetMessage(&msg,g_wndMainWindow,0,0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ if (TRUE == ::PeekMessage(&msg, g_wndMainWindow, 0, 0, PM_NOREMOVE)) {
+ while (::GetMessage(&msg, g_wndMainWindow, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
}
else {
- DWORD dwResult = ::MsgWaitForMultipleObjects(1,&g_hEventShutdown,FALSE,INFINITE,QS_ALLEVENTS);
+ DWORD dwResult = ::MsgWaitForMultipleObjects(1, &g_hEventShutdown, FALSE, INFINITE, QS_ALLEVENTS);
_ASSERT(WAIT_FAILED != dwResult);
if (WAIT_OBJECT_0 == dwResult)
break;
}
}
-}
+}
LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
LRESULT lReturnCode = 0;
bool bIssueDefProc = false;
- switch(msg) {
+ switch (msg) {
case WM_DESTROY:
g_wndMainWindow = NULL;
break;
@@ -163,7 +162,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
default:
if (msg == g_MsgIDSkypeControlAPIAttach) {
- switch(lp) {
+ switch (lp) {
case SKYPECONTROLAPI_ATTACH_SUCCESS:
{
CStatusInfo si;
@@ -175,40 +174,38 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[si.StatusIndex()];
HWND wndSkypeAPIWindow = reinterpret_cast<HWND>(wp);
- enum{BUFFER_SIZE = 256};
+ enum { BUFFER_SIZE = 256 };
char szSkypeCmd[BUFFER_SIZE];
const char szSkypeCmdSetStatus[] = "SET USERSTATUS ";
- ::strncpy_s(szSkypeCmd,szSkypeCmdSetStatus,sizeof(szSkypeCmdSetStatus)/sizeof(szSkypeCmdSetStatus[0]));
+ ::strncpy_s(szSkypeCmd, szSkypeCmdSetStatus, sizeof(szSkypeCmdSetStatus) / sizeof(szSkypeCmdSetStatus[0]));
::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd));
DWORD cLength = static_cast<DWORD>(mir_strlen(szSkypeCmd));
COPYDATASTRUCT oCopyData;
- oCopyData.dwData=0;
+ oCopyData.dwData = 0;
oCopyData.lpData = szSkypeCmd;
- oCopyData.cbData = cLength+1;
- SendMessage(wndSkypeAPIWindow,WM_COPYDATA,(WPARAM)hWnd,(LPARAM)&oCopyData);
+ oCopyData.cbData = cLength + 1;
+ SendMessage(wndSkypeAPIWindow, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&oCopyData);
if (g_Options.GetSyncStatusMsgFlag()) {
TCHAR* pszStatusMsg = NULL;
- if ( ProtoServiceExists(si.Module(), PS_GETMYAWAYMSG))
- pszStatusMsg = reinterpret_cast<TCHAR*>(CallProtoService(si.Module(),PS_GETMYAWAYMSG,(WPARAM)ms.m_nMirandaStatus,SGMA_TCHAR));
+ if (ProtoServiceExists(si.Module(), PS_GETMYAWAYMSG))
+ pszStatusMsg = reinterpret_cast<TCHAR*>(CallProtoService(si.Module(), PS_GETMYAWAYMSG, (WPARAM)ms.m_nMirandaStatus, SGMA_TCHAR));
- if ((NULL == pszStatusMsg) || (CALLSERVICE_NOTFOUND == reinterpret_cast<int>(pszStatusMsg)))
- pszStatusMsg = reinterpret_cast<TCHAR*>(CallService(MS_AWAYMSG_GETSTATUSMSGT,(WPARAM)ms.m_nMirandaStatus,0));
+ if ((NULL == pszStatusMsg) || (CALLSERVICE_NOTFOUND == INT_PTR(pszStatusMsg)))
+ pszStatusMsg = reinterpret_cast<TCHAR*>(CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)ms.m_nMirandaStatus, 0));
if (pszStatusMsg && reinterpret_cast<LPARAM>(pszStatusMsg) != CALLSERVICE_NOTFOUND) {
T2Utf pMsg(pszStatusMsg);
mir_free(pszStatusMsg);
const char szSkypeCmdSetStatusMsg[] = "SET PROFILE MOOD_TEXT ";
- ::strncpy_s(szSkypeCmd,szSkypeCmdSetStatusMsg,sizeof(szSkypeCmdSetStatusMsg)/sizeof(szSkypeCmdSetStatusMsg[0]));
+ ::strncpy_s(szSkypeCmd, szSkypeCmdSetStatusMsg, sizeof(szSkypeCmdSetStatusMsg) / sizeof(szSkypeCmdSetStatusMsg[0]));
::strncat_s(szSkypeCmd, pMsg, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd));
-
- DWORD cLength = static_cast<DWORD>(mir_strlen(szSkypeCmd));
- oCopyData.dwData=0;
+ oCopyData.dwData = 0;
oCopyData.lpData = szSkypeCmd;
- oCopyData.cbData = cLength+1;
- SendMessage(wndSkypeAPIWindow,WM_COPYDATA,(WPARAM)hWnd,(LPARAM)&oCopyData);
+ oCopyData.cbData = static_cast<DWORD>(mir_strlen(szSkypeCmd)) + 1;
+ SendMessage(wndSkypeAPIWindow, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&oCopyData);
}
}
}
@@ -227,12 +224,12 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
case SKYPECONTROLAPI_ATTACH_API_AVAILABLE:
break;
}
- lReturnCode=1;
+ lReturnCode = 1;
}
else bIssueDefProc = true;
break;
}
-
+
if (true == bIssueDefProc)
lReturnCode = DefWindowProc(hWnd, msg, wp, lp);
@@ -245,7 +242,7 @@ int SSC_OnPreShutdown(WPARAM/* wParam*/, LPARAM/* lParam*/)
BOOL b = SetEvent(g_hEventShutdown);
_ASSERT(b && "SetEvent failed");
- DWORD dwResult = ::WaitForSingleObject(g_hThread,INFINITE);
+ DWORD dwResult = ::WaitForSingleObject(g_hThread, INFINITE);
_ASSERT(WAIT_FAILED != dwResult);
b = ::CloseHandle(g_hEventShutdown);
@@ -257,7 +254,7 @@ int SSC_OnPreShutdown(WPARAM/* wParam*/, LPARAM/* lParam*/)
g_wndMainWindow = NULL;
}
- UnregisterClass(g_pszSkypeWndClassName,g_hModule);
+ UnregisterClass(g_pszSkypeWndClassName, g_hModule);
return 0;
}
@@ -282,31 +279,31 @@ extern "C" int __declspec(dllexport) Load()
g_MsgIDSkypeControlAPIAttach = ::RegisterWindowMessage(_T("SkypeControlAPIAttach"));
g_MsgIDSkypeControlAPIDiscover = ::RegisterWindowMessage(_T("SkypeControlAPIDiscover"));
- if ((0 == g_MsgIDSkypeControlAPIAttach)|| (0 == g_MsgIDSkypeControlAPIDiscover))
+ if ((0 == g_MsgIDSkypeControlAPIAttach) || (0 == g_MsgIDSkypeControlAPIDiscover))
return 1;
WNDCLASS oWindowClass = { 0 };
- oWindowClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
+ oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
oWindowClass.lpfnWndProc = (WNDPROC)&SkypeAPI_WindowProc;
oWindowClass.hInstance = g_hModule;
oWindowClass.lpszClassName = g_pszSkypeWndClassName;
if (!RegisterClass(&oWindowClass))
return 1;
- g_wndMainWindow = CreateWindowEx( WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,
- g_pszSkypeWndClassName,_T(""), WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,
+ g_wndMainWindow = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
+ g_pszSkypeWndClassName, _T(""), WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, g_hModule, 0);
if (g_wndMainWindow == NULL)
return 1;
-
+
g_bMirandaIsShutdown = false;
- g_hEventShutdown = ::CreateEvent(NULL,TRUE,FALSE,NULL);
+ g_hEventShutdown = ::CreateEvent(NULL, TRUE, FALSE, NULL);
g_hThread = mir_forkthread(ThreadFunc, NULL);
- HookEvent(ME_PROTO_ACK,SSC_OnProtocolAck);
- HookEvent(ME_SYSTEM_PRESHUTDOWN,SSC_OnPreShutdown);
- HookEvent(ME_OPT_INITIALISE,SSC_OptInitialise);
+ HookEvent(ME_PROTO_ACK, SSC_OnProtocolAck);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, SSC_OnPreShutdown);
+ HookEvent(ME_OPT_INITIALISE, SSC_OptInitialise);
return 0;
}
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp
index 5359adc3d2..46e8ee86c7 100644
--- a/plugins/SplashScreen/src/bitmap_funcs.cpp
+++ b/plugins/SplashScreen/src/bitmap_funcs.cpp
@@ -133,9 +133,9 @@ bool MyBitmap::loadFromFile(TCHAR *fn)
HBITMAP hBmpLoaded = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)fn, IMGL_TCHAR);
if (!hBmpLoaded) {
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("MyBitmap::loadFromFile"), _T("Bitmap load failed"));
-#endif
+ #endif
return false;
}
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp
index 4f7007a5ab..88dd563466 100644
--- a/plugins/SplashScreen/src/main.cpp
+++ b/plugins/SplashScreen/src/main.cpp
@@ -1,21 +1,21 @@
/*
- Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
- (c) 2004-2007 nullbie, (c) 2005-2007 Thief
+Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
+(c) 2004-2007 nullbie, (c) 2005-2007 Thief
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
#include "stdafx.h"
@@ -62,14 +62,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
void SplashMain()
{
- if (bstartup)
- {
+ if (bstartup) {
// Retrive path to exe of current running Miranda is located
szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
mir_sntprintf(szhAdvaimgPath, _countof(szhAdvaimgPath), _T("%s\\plugins\\advaimg.dll"), szMirDir);
CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
-#ifdef _DEBUG
+ #ifdef _DEBUG
mir_sntprintf(szLogFile, _countof(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
initLog();
TCHAR *mirandaVerString = mir_a2t(szVersion);
@@ -77,24 +76,21 @@ void SplashMain()
mir_free(mirandaVerString);
logMessage(_T("Dll Name"), _T(__FILENAME));
logMessage(_T("Advaimg path"), szhAdvaimgPath);
-#endif
+ #endif
ReadDbConfig();
}
- if (bstartup & (options.active == 1))
- {
+ if (bstartup & (options.active == 1)) {
DBVARIANT dbv = { 0 };
- if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv))
- {
+ if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv)) {
mir_tstrcpy(szPrefix, dbv.ptszVal);
db_free(&dbv);
}
else
mir_tstrcpy(szPrefix, _T(""));
- if (!db_get_ts(NULL, MODNAME, "Path", &dbv))
- {
+ if (!db_get_ts(NULL, MODNAME, "Path", &dbv)) {
mir_tstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
@@ -112,8 +108,7 @@ void SplashMain()
else
mir_tstrcpy(szSplashFile, inBuf);
- if (!db_get_ts(NULL, MODNAME, "Sound", &dbv))
- {
+ if (!db_get_ts(NULL, MODNAME, "Sound", &dbv)) {
mir_tstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
@@ -131,9 +126,9 @@ void SplashMain()
else
mir_tstrcpy(szSoundFile, inBuf);
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("SoundFilePath"), szSoundFile);
-#endif
+ #endif
TCHAR szOldPath[MAX_PATH] = { 0 };
@@ -155,30 +150,27 @@ void SplashMain()
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
hFind = FindFirstFile(szSearch, &ffd);
- if (hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
- {
-#ifdef _DEBUG
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
+ #ifdef _DEBUG
logMessage(_T("Found file"), ffd.cFileName);
-#endif
+ #endif
//files = new char[mir_strlen(ffd.cFileName)];
//files[filescount] = new char[mir_strlen(ffd.cFileName)];
TCHAR ext[5];
wmemcpy(ext, ffd.cFileName + (mir_tstrlen(ffd.cFileName) - 4), 5);
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("Extention"), ext);
-#endif
+ #endif
if (mir_tstrcmpi(ext, _T(".png")) & mir_tstrcmpi(ext, _T(".bmp")))
continue;
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("File has valid ext"), ext);
-#endif
+ #endif
mir_tstrcpy(files[filescount++], ffd.cFileName);
} //if
} while (FindNextFile(hFind, &ffd));
@@ -189,9 +181,9 @@ void SplashMain()
mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szSplashDir, files[r - 1]);
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("final file"), szSplashFile);
-#endif
+ #endif
FindClose(hFind);
} //if
}
@@ -204,33 +196,30 @@ void SplashMain()
int PlugDisableHook(WPARAM wParam, LPARAM lParam)
{
-#ifdef _DEBUG
+ #ifdef _DEBUG
TCHAR buf[128];
-#endif
+ #endif
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
TCHAR *tszModule = mir_a2t(cws->szModule), *tszSetting = mir_a2t(cws->szSetting);
- if (options.inheritGS)
- {
- if (!mir_tstrcmp(tszModule, _T("Skin")) & !mir_tstrcmp(tszSetting, _T("UseSound")))
- {
+ if (options.inheritGS) {
+ if (!mir_tstrcmp(tszModule, _T("Skin")) & !mir_tstrcmp(tszSetting, _T("UseSound"))) {
db_set_b(NULL, MODNAME, "PlaySound", cws->value.bVal);
-#ifdef _DEBUG
+ #ifdef _DEBUG
cws->value.bVal ? _DebugPopup(NULL, _T("Sounds enabled."), _T("")) : _DebugPopup(NULL, _T("Sounds disabled."), _T(""));
logMessage(_T("Module"), tszModule);
logMessage(_T("Setting"), tszSetting);
logMessage(_T("Value"), _itot(cws->value.bVal, buf, 10));
-#endif
+ #endif
}
- if (!mir_tstrcmp(tszModule, _T("PluginDisable")) & (!mir_tstrcmp(tszSetting, szDllName)))
- {
+ if (!mir_tstrcmp(tszModule, _T("PluginDisable")) & (!mir_tstrcmp(tszSetting, szDllName))) {
db_set_b(NULL, MODNAME, "Active", cws->value.bVal);
-#ifdef _DEBUG
+ #ifdef _DEBUG
cws->value.bVal ? _DebugPopup(NULL, _T("Disabled."), "") : _DebugPopup(NULL, _T("Enabled."), _T(""));
logMessage(_T("PlugDisableHook"), _T("Triggered"));
logMessage(_T("Module"), tszModule);
logMessage(_T("Setting"), tszSetting);
logMessage(_T("Value"), _itot(cws->value.bVal, buf, 10));
-#endif
+ #endif
}
}
mir_free(tszModule);
@@ -243,13 +232,11 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
bmodulesloaded = true; // all modules are loaded now, let other parts know about this fact
- if (hwndSplash)
- {
- if (PostMessage(hwndSplash, WM_LOADED, 0, 0))
- {
-#ifdef _DEBUG
+ if (hwndSplash) {
+ if (PostMessage(hwndSplash, WM_LOADED, 0, 0)) {
+ #ifdef _DEBUG
logMessage(_T("Posted WM_LOADED message"), _T("done"));
-#endif
+ #endif
}
}
@@ -260,9 +247,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
// Service to call splash
CreateServiceFunction(MS_SHOWSPLASH, ShowSplashService);
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("Loading modules"), _T("done"));
-#endif
+ #endif
return 0;
}
@@ -293,9 +280,9 @@ extern "C" int __declspec(dllexport) Unload(void)
if (hAdvaimg)
FreeLibrary(hAdvaimg);
-#ifdef _DEBUG
+ #ifdef _DEBUG
logMessage(_T("Unload"), _T("Job done"));
-#endif
+ #endif
return 0;
}
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp
index 95a3f09e75..70f0b2bb3e 100644
--- a/plugins/SplashScreen/src/options.cpp
+++ b/plugins/SplashScreen/src/options.cpp
@@ -43,384 +43,350 @@ BOOL Exists(LPCTSTR strName)
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- if (!png2dibavail) {
- ShowWindow(GetDlgItem(hwndDlg, IDC_PNG2DIBWARN), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVE), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RANDOM), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SPLASHPATH), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSESPLASH), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWVERSION), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWTIME), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ST_SPIN), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FADEIN), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FADEOUT), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), false);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), false);
- }
- else {
- ReadDbConfig();
- TCHAR inBuf[80];
- DBVARIANT dbv = { 0 };
- if (!db_get_ts(NULL, MODNAME, "Path", &dbv))
- {
- mir_tstrcpy(inBuf, dbv.ptszVal);
- db_free(&dbv);
- }
- else
- mir_tstrcpy(inBuf, _T("splash\\splash.png"));
- SetDlgItemText(hwndDlg, IDC_SPLASHPATH, inBuf);
-
- if (!db_get_ts(NULL, MODNAME, "Sound", &dbv))
- {
- mir_tstrcpy(inBuf, dbv.ptszVal);
- db_free(&dbv);
- }
- else
- mir_tstrcpy(inBuf, _T("sounds\\startup.wav"));
- SetDlgItemText(hwndDlg, IDC_SNDPATH, inBuf);
-
- if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv))
- {
- mir_tstrcpy(inBuf, dbv.ptszVal);
- db_free(&dbv);
- }
- else
- mir_tstrcpy(inBuf, _T(""));
- SetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, inBuf);
-
- if (options.active)
- CheckDlgButton(hwndDlg, IDC_ACTIVE, BST_CHECKED);
- if (options.playsnd && !options.inheritGS)
- CheckDlgButton(hwndDlg, IDC_PLAYSND, BST_INDETERMINATE);
- else if (options.playsnd)
- CheckDlgButton(hwndDlg, IDC_PLAYSND, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOOPSOUND), false);
- if (options.fadein)
- CheckDlgButton(hwndDlg, IDC_FADEIN, BST_CHECKED);
- if (options.fadeout)
- CheckDlgButton(hwndDlg, IDC_FADEOUT, BST_CHECKED);
- if (options.random)
- CheckDlgButton(hwndDlg, IDC_RANDOM, BST_CHECKED);
- if (options.showversion)
- CheckDlgButton(hwndDlg, IDC_SHOWVERSION, BST_CHECKED);
-
- SetDlgItemText(hwndDlg, IDC_SHOWTIME, _itot(options.showtime, inBuf, 10));
- SetDlgItemText(hwndDlg, IDC_FISTEP, _itot(options.fisteps, inBuf, 10));
- SetDlgItemText(hwndDlg, IDC_FOSTEP, _itot(options.fosteps, inBuf, 10));
-
- SendDlgItemMessage(hwndDlg, IDC_SHOWTIME, EM_LIMITTEXT, 5, 0);
- }
-
- return TRUE;
- }
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_PREVIEW:
- {
- ShowSplash(true);
- break;
- }
-
- case IDC_ACTIVE:
- case IDC_PLAYSND:
- case IDC_LOOPSOUND:
- case IDC_FADEIN:
- case IDC_FADEOUT:
- case IDC_SHOWTIME:
- case IDC_RANDOM:
- case IDC_SHOWVERSION:
- case IDC_FISTEP:
- case IDC_FOSTEP:
{
- if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), true);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), true);
- }
- else
- {
+ TranslateDialogDefault(hwndDlg);
+ if (!png2dibavail) {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PNG2DIBWARN), SW_SHOW);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVE), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RANDOM), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPLASHPATH), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSESPLASH), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWVERSION), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWTIME), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ST_SPIN), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FADEIN), false);
EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), false);
EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), false);
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), true);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), true);
- }
- else
- {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FADEOUT), false);
EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), false);
EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), false);
}
-
- if ((HWND)lParam != GetFocus())
- return 0;
else {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ ReadDbConfig();
+ TCHAR inBuf[80];
+ DBVARIANT dbv = { 0 };
+ if (!db_get_ts(NULL, MODNAME, "Path", &dbv)) {
+ mir_tstrcpy(inBuf, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ mir_tstrcpy(inBuf, _T("splash\\splash.png"));
+ SetDlgItemText(hwndDlg, IDC_SPLASHPATH, inBuf);
+
+ if (!db_get_ts(NULL, MODNAME, "Sound", &dbv)) {
+ mir_tstrcpy(inBuf, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ mir_tstrcpy(inBuf, _T("sounds\\startup.wav"));
+ SetDlgItemText(hwndDlg, IDC_SNDPATH, inBuf);
+
+ if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv)) {
+ mir_tstrcpy(inBuf, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ mir_tstrcpy(inBuf, _T(""));
+ SetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, inBuf);
+
+ if (options.active)
+ CheckDlgButton(hwndDlg, IDC_ACTIVE, BST_CHECKED);
+ if (options.playsnd && !options.inheritGS)
+ CheckDlgButton(hwndDlg, IDC_PLAYSND, BST_INDETERMINATE);
+ else if (options.playsnd)
+ CheckDlgButton(hwndDlg, IDC_PLAYSND, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOOPSOUND), false);
+ if (options.fadein)
+ CheckDlgButton(hwndDlg, IDC_FADEIN, BST_CHECKED);
+ if (options.fadeout)
+ CheckDlgButton(hwndDlg, IDC_FADEOUT, BST_CHECKED);
+ if (options.random)
+ CheckDlgButton(hwndDlg, IDC_RANDOM, BST_CHECKED);
+ if (options.showversion)
+ CheckDlgButton(hwndDlg, IDC_SHOWVERSION, BST_CHECKED);
+
+ SetDlgItemText(hwndDlg, IDC_SHOWTIME, _itot(options.showtime, inBuf, 10));
+ SetDlgItemText(hwndDlg, IDC_FISTEP, _itot(options.fisteps, inBuf, 10));
+ SetDlgItemText(hwndDlg, IDC_FOSTEP, _itot(options.fosteps, inBuf, 10));
+
+ SendDlgItemMessage(hwndDlg, IDC_SHOWTIME, EM_LIMITTEXT, 5, 0);
}
- break;
+
+ return TRUE;
}
- case IDC_CHOOSESPLASH:
+ case WM_COMMAND:
{
- TCHAR szTempPath[MAX_PATH], initDir[MAX_PATH];
- TCHAR *pos;
-
- if (Exists(szSplashFile))
- {
- mir_tstrcpy(initDir, szSplashFile);
- pos = _tcsrchr(initDir, _T('\\'));
- if (pos != NULL) *pos = 0;
- }
- else
- {
- szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
- mir_tstrcpy(initDir, szMirDir);
- mir_free(szMirDir);
- }
+ switch (LOWORD(wParam)) {
+ case IDC_PREVIEW:
+ {
+ ShowSplash(true);
+ break;
+ }
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, _countof(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
- ofn.lpstrFile = szTempPath;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY;
- ofn.lpstrInitialDir = initDir;
- *szTempPath = '\0';
- ofn.lpstrDefExt = _T("");
-
- if (GetOpenFileName(&ofn))
- {
- mir_tstrcpy(szSplashFile, szTempPath);
-
-#ifdef _DEBUG
- logMessage(_T("Set path"), szSplashFile);
-#endif
-
- // Make path relative
- int result = PathToRelativeT(szTempPath, szPath2Spash);
- if (result && mir_tstrlen(szPath2Spash) > 0)
+ case IDC_ACTIVE:
+ case IDC_PLAYSND:
+ case IDC_LOOPSOUND:
+ case IDC_FADEIN:
+ case IDC_FADEOUT:
+ case IDC_SHOWTIME:
+ case IDC_RANDOM:
+ case IDC_SHOWVERSION:
+ case IDC_FISTEP:
+ case IDC_FOSTEP:
{
- if (options.random)
- {
- TCHAR *pos;
- pos = _tcsrchr(szPath2Spash, _T('\\'));
+ if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), true);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), false);
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), true);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), false);
+ }
+
+ if ((HWND)lParam != GetFocus())
+ return 0;
+ else {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+ }
+
+ case IDC_CHOOSESPLASH:
+ {
+ TCHAR szTempPath[MAX_PATH], initDir[MAX_PATH];
+
+ if (Exists(szSplashFile)) {
+ mir_tstrcpy(initDir, szSplashFile);
+ TCHAR *pos = _tcsrchr(initDir, _T('\\'));
if (pos != NULL)
- {
*pos = 0;
- mir_tstrcat(szPath2Spash, _T("\\"));
+ }
+ else {
+ szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ mir_tstrcpy(initDir, szMirDir);
+ mir_free(szMirDir);
+ }
+
+ TCHAR tmp[MAX_PATH];
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0);
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.lpstrFilter = tmp;
+ ofn.lpstrFile = szTempPath;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY;
+ ofn.lpstrInitialDir = initDir;
+ *szTempPath = '\0';
+ ofn.lpstrDefExt = _T("");
+
+ if (GetOpenFileName(&ofn)) {
+ mir_tstrcpy(szSplashFile, szTempPath);
+
+ #ifdef _DEBUG
+ logMessage(_T("Set path"), szSplashFile);
+ #endif
+ // Make path relative
+ int result = PathToRelativeT(szTempPath, szPath2Spash);
+ if (result && mir_tstrlen(szPath2Spash) > 0) {
+ if (options.random) {
+ TCHAR *pos = _tcsrchr(szPath2Spash, _T('\\'));
+ if (pos != NULL) {
+ *pos = 0;
+ mir_tstrcat(szPath2Spash, _T("\\"));
+ }
+ }
+
+ SetDlgItemText(hwndDlg, IDC_SPLASHPATH, szPath2Spash);
}
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- SetDlgItemText(hwndDlg, IDC_SPLASHPATH, szPath2Spash);
+ break;
}
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
-
- break;
- }
+ case IDC_CHOOSESND:
+ {
+ TCHAR szTempPath[MAX_PATH], initDir[MAX_PATH];
+ TCHAR *pos;
- case IDC_CHOOSESND:
- {
- TCHAR szTempPath[MAX_PATH], initDir[MAX_PATH];
- TCHAR *pos;
-
- if (Exists(szSoundFile))
- {
- mir_tstrcpy(initDir, szSoundFile);
- pos = _tcsrchr(initDir, _T('\\'));
- if (pos != NULL) *pos = 0;
- }
- else
- {
- szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
- mir_tstrcpy(initDir, szMirDir);
- mir_free(szMirDir);
- }
+ if (Exists(szSoundFile)) {
+ mir_tstrcpy(initDir, szSoundFile);
+ pos = _tcsrchr(initDir, _T('\\'));
+ if (pos != NULL) *pos = 0;
+ }
+ else {
+ szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ mir_tstrcpy(initDir, szMirDir);
+ mir_free(szMirDir);
+ }
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
- ofn.lpstrFile = szTempPath;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY;
- ofn.lpstrInitialDir = initDir;
- *szTempPath = '\0';
- ofn.lpstrDefExt = _T("");
-
- if (GetOpenFileName(&ofn))
- {
- mir_tstrcpy(szSoundFile, szTempPath);
-
-#ifdef _DEBUG
- logMessage(_T("Set sound path"), szSoundFile);
-#endif
-
- // Make path relative
- int result = PathToRelativeT(szTempPath, szSoundFilePath);
- if (result && mir_tstrlen(szSoundFile) > 0)
- SetDlgItemText(hwndDlg, IDC_SNDPATH, szSoundFilePath);
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ TCHAR tmp[MAX_PATH];
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0);
+ ofn.lpstrFilter = tmp;
+ ofn.hwndOwner = 0;
+ ofn.lpstrFile = szTempPath;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY;
+ ofn.lpstrInitialDir = initDir;
+ *szTempPath = '\0';
+ ofn.lpstrDefExt = _T("");
+
+ if (GetOpenFileName(&ofn)) {
+ mir_tstrcpy(szSoundFile, szTempPath);
+
+ #ifdef _DEBUG
+ logMessage(_T("Set sound path"), szSoundFile);
+ #endif
+
+ // Make path relative
+ int result = PathToRelativeT(szTempPath, szSoundFilePath);
+ if (result && mir_tstrlen(szSoundFile) > 0)
+ SetDlgItemText(hwndDlg, IDC_SNDPATH, szSoundFilePath);
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
}
- break;
+ default:
+ {
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
+ return 0;
+ else
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
+ break;
}
- default:
- {
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return 0;
- else
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
-
case WM_NOTIFY:
- {
- if (((LPNMHDR)lParam)->idFrom == 0)
- switch (((LPNMHDR)lParam)->code)
{
- case PSN_APPLY:
- {
- TCHAR tmp[MAX_PATH];
+ if (((LPNMHDR)lParam)->idFrom == 0)
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
+ TCHAR tmp[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, _countof(tmp));
- db_set_ts(NULL, MODNAME, "Path", tmp);
+ GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, _countof(tmp));
+ db_set_ts(NULL, MODNAME, "Path", tmp);
- GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, _countof(tmp));
- db_set_ts(NULL, MODNAME, "Sound", tmp);
+ GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, _countof(tmp));
+ db_set_ts(NULL, MODNAME, "Sound", tmp);
- GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp));
- db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
- mir_tstrcpy(szPrefix, tmp);
+ GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp));
+ db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
+ mir_tstrcpy(szPrefix, tmp);
- GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp));
- db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
- options.showtime = _ttoi(tmp);
+ GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp));
+ db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
+ options.showtime = _ttoi(tmp);
- GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, _countof(tmp));
- db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
- options.fisteps = _ttoi(tmp);
+ GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, _countof(tmp));
+ db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
+ options.fisteps = _ttoi(tmp);
- GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, _countof(tmp));
- db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
- options.fosteps = _ttoi(tmp);
+ GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, _countof(tmp));
+ db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
+ options.fosteps = _ttoi(tmp);
- if (IsDlgButtonChecked(hwndDlg, IDC_ACTIVE))
- {
- db_set_b(NULL, MODNAME, "Active", 1);
- options.active = 1;
- }
- else
- {
- db_set_b(NULL, MODNAME, "Active", 0);
- options.active = 0;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_ACTIVE)) {
+ db_set_b(NULL, MODNAME, "Active", 1);
+ options.active = 1;
+ }
+ else {
+ db_set_b(NULL, MODNAME, "Active", 0);
+ options.active = 0;
+ }
- if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND))
- {
- db_set_b(NULL, MODNAME, "PlaySound", 1);
- options.playsnd = 1;
- db_set_b(NULL, MODNAME, "InheritGlobalSound", 1);
- options.inheritGS = 1;
- }
- else
- {
- db_set_b(NULL, MODNAME, "PlaySound", 0);
- options.playsnd = 0;
- db_set_b(NULL, MODNAME, "InheritGlobalSound", 0);
- options.inheritGS = 0;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND)) {
+ db_set_b(NULL, MODNAME, "PlaySound", 1);
+ options.playsnd = 1;
+ db_set_b(NULL, MODNAME, "InheritGlobalSound", 1);
+ options.inheritGS = 1;
+ }
+ else {
+ db_set_b(NULL, MODNAME, "PlaySound", 0);
+ options.playsnd = 0;
+ db_set_b(NULL, MODNAME, "InheritGlobalSound", 0);
+ options.inheritGS = 0;
+ }
- if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND) == BST_INDETERMINATE)
- {
- db_set_b(NULL, MODNAME, "PlaySound", 1);
- options.playsnd = 1;
- db_set_b(NULL, MODNAME, "InheritGlobalSound", 0);
- options.inheritGS = 0;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND) == BST_INDETERMINATE) {
+ db_set_b(NULL, MODNAME, "PlaySound", 1);
+ options.playsnd = 1;
+ db_set_b(NULL, MODNAME, "InheritGlobalSound", 0);
+ options.inheritGS = 0;
+ }
- /*
- if (IsDlgButtonChecked(hwndDlg, IDC_LOOPSOUND))
- {
- WritePrivateProfileString("Splash","LoopSound","1",szIniFile);
- options.loopsnd = 1;
- }
- else
- {
- WritePrivateProfileString("Splash","LoopSound","0",szIniFile);
- options.loopsnd = 0;
- }
- */
+ /*
+ if (IsDlgButtonChecked(hwndDlg, IDC_LOOPSOUND))
+ {
+ WritePrivateProfileString("Splash","LoopSound","1",szIniFile);
+ options.loopsnd = 1;
+ }
+ else
+ {
+ WritePrivateProfileString("Splash","LoopSound","0",szIniFile);
+ options.loopsnd = 0;
+ }
+ */
- if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN))
- {
- db_set_b(NULL, MODNAME, "FadeIn", 1);
- options.fadein = 1;
- }
- else
- {
- db_set_b(NULL, MODNAME, "FadeIn", 0);
- options.fadein = 0;
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT))
- {
- db_set_b(NULL, MODNAME, "FadeOut", 1);
- options.fadeout = 1;
- }
- else
- {
- db_set_b(NULL, MODNAME, "FadeOut", 0);
- options.fadeout = 0;
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_RANDOM))
- {
- db_set_b(NULL, MODNAME, "Random", 1);
- options.random = 1;
- }
- else
- {
- db_set_b(NULL, MODNAME, "Random", 0);
- options.random = 0;
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_SHOWVERSION))
- {
- db_set_b(NULL, MODNAME, "ShowVersion", 1);
- options.showversion = 1;
- }
- else
- {
- db_set_b(NULL, MODNAME, "ShowVersion", 0);
- options.showversion = 0;
+ if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN)) {
+ db_set_b(NULL, MODNAME, "FadeIn", 1);
+ options.fadein = 1;
+ }
+ else {
+ db_set_b(NULL, MODNAME, "FadeIn", 0);
+ options.fadein = 0;
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT)) {
+ db_set_b(NULL, MODNAME, "FadeOut", 1);
+ options.fadeout = 1;
+ }
+ else {
+ db_set_b(NULL, MODNAME, "FadeOut", 0);
+ options.fadeout = 0;
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_RANDOM)) {
+ db_set_b(NULL, MODNAME, "Random", 1);
+ options.random = 1;
+ }
+ else {
+ db_set_b(NULL, MODNAME, "Random", 0);
+ options.random = 0;
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_SHOWVERSION)) {
+ db_set_b(NULL, MODNAME, "ShowVersion", 1);
+ options.showversion = 1;
+ }
+ else {
+ db_set_b(NULL, MODNAME, "ShowVersion", 0);
+ options.showversion = 0;
+ }
+ return TRUE;
+ }
}
- return TRUE;
- }
}
- }
case WM_DESTROY:
break;
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp
index df0f3367e9..6550f5fda0 100644
--- a/plugins/SplashScreen/src/splash.cpp
+++ b/plugins/SplashScreen/src/splash.cpp
@@ -263,8 +263,8 @@ void __cdecl SplashThread(void *arg)
blend.SourceConstantAlpha = 255;
UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
- if (DWORD(arg) > 0) {
- if (SetTimer(hwndSplash, 6, DWORD(arg), 0)) {
+ if (DWORD_PTR(arg) > 0) {
+ if (SetTimer(hwndSplash, 6, DWORD_PTR(arg), 0)) {
#ifdef _DEBUG
logMessage(_T("Timer TimeToShow"), _T("set"));
#endif
@@ -338,4 +338,4 @@ BOOL ShowSplash(BOOL bpreview)
logMessage(_T("Thread"), _T("end"));
#endif
return 1;
-} \ No newline at end of file
+}
diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp
index 5b05c9696b..8b1698f996 100755
--- a/plugins/StopSpamMod/src/options.cpp
+++ b/plugins/StopSpamMod/src/options.cpp
@@ -19,124 +19,106 @@
int CreateCListGroup(TCHAR* szGroupName);
-char * pluginDescription = LPGEN("No more spam! Robots can't go! Only human beings invited!\r\n\r\nThis plugin works pretty simple:\r\nWhile messages from users on your contact list go as there is no any anti-spam software, messages from unknown users are not delivered to you. But also they are not ignored, this plugin replies with a simple question, and if user gives the right answer, plugin adds him to your contact list so that he can contact you.");
-TCHAR const * defQuestion = TranslateT("Spammers made me to install small anti-spam system you are now speaking with.\r\nPlease reply \"nospam\" without quotes and spaces if you want to contact me.");
+char *pluginDescription = LPGEN("No more spam! Robots can't go! Only human beings invited!\r\n\r\nThis plugin works pretty simple:\r\nWhile messages from users on your contact list go as there is no any anti-spam software, messages from unknown users are not delivered to you. But also they are not ignored, this plugin replies with a simple question, and if user gives the right answer, plugin adds him to your contact list so that he can contact you.");
+TCHAR const *defQuestion = TranslateT("Spammers made me to install small anti-spam system you are now speaking with.\r\nPlease reply \"nospam\" without quotes and spaces if you want to contact me.");
INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
- {
- SetDlgItemTextA(hwnd, ID_DESCRIPTION, pluginDescription);
- TranslateDialogDefault(hwnd);
- SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, gbMaxQuestCount, FALSE);
- CheckDlgButton(hwnd, ID_INFTALKPROT, gbInfTalkProtection ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_ADDPERMANENT, gbAddPermanent ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_HANDLEAUTHREQ, gbHandleAuthReq ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_HIDECONTACTS, gbHideContacts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_IGNORESPAMMERS, gbIgnoreContacts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_LOGSPAMTOFILE, gbLogToFile ? BST_CHECKED : BST_UNCHECKED);
- }
+ SetDlgItemTextA(hwnd, ID_DESCRIPTION, pluginDescription);
+ TranslateDialogDefault(hwnd);
+ SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, gbMaxQuestCount, FALSE);
+ CheckDlgButton(hwnd, ID_INFTALKPROT, gbInfTalkProtection ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_ADDPERMANENT, gbAddPermanent ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_HANDLEAUTHREQ, gbHandleAuthReq ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_HIDECONTACTS, gbHideContacts ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_IGNORESPAMMERS, gbIgnoreContacts ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_LOGSPAMTOFILE, gbLogToFile ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
- case WM_COMMAND:{
- switch (LOWORD(wParam))
- {
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
case ID_MAXQUESTCOUNT:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
- }
+ if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
+ return FALSE;
+ break;
}
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
break;
+
case WM_NOTIFY:
- {
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code) {
+ case PSN_APPLY:
{
- case PSN_APPLY:
- {
- db_set_dw(NULL, pluginName, "maxQuestCount", gbMaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE));
- db_set_b(NULL, pluginName, "infTalkProtection", gbInfTalkProtection = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
- db_set_b(NULL, pluginName, "addPermanent", gbAddPermanent = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
- db_set_b(NULL, pluginName, "handleAuthReq", gbHandleAuthReq = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
- db_set_b(NULL, pluginName, "HideContacts", gbHideContacts = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HIDECONTACTS));
- db_set_b(NULL, pluginName, "IgnoreContacts", gbIgnoreContacts = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_IGNORESPAMMERS));
- db_set_b(NULL, pluginName, "LogSpamToFile", gbLogToFile = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_LOGSPAMTOFILE));
- }
- return TRUE;
+ db_set_dw(NULL, pluginName, "maxQuestCount", gbMaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE));
+ db_set_b(NULL, pluginName, "infTalkProtection", gbInfTalkProtection = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
+ db_set_b(NULL, pluginName, "addPermanent", gbAddPermanent = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
+ db_set_b(NULL, pluginName, "handleAuthReq", gbHandleAuthReq = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
+ db_set_b(NULL, pluginName, "HideContacts", gbHideContacts = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HIDECONTACTS));
+ db_set_b(NULL, pluginName, "IgnoreContacts", gbIgnoreContacts = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_IGNORESPAMMERS));
+ db_set_b(NULL, pluginName, "LogSpamToFile", gbLogToFile = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_LOGSPAMTOFILE));
}
+ return TRUE;
}
- break;
+ break;
}
return FALSE;
}
INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
-
- switch(msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwnd);
- SetDlgItemText(hwnd, ID_QUESTION, gbQuestion.c_str());
- SetDlgItemText(hwnd, ID_ANSWER, gbAnswer.c_str());
- SetDlgItemText(hwnd, ID_CONGRATULATION, gbCongratulation.c_str());
- SetDlgItemText(hwnd, ID_AUTHREPL, gbAuthRepl.c_str());
- EnableWindow(GetDlgItem(hwnd, ID_ANSWER), !gbMathExpression);
- variables_skin_helpbutton(hwnd, IDC_VARS);
- gbVarsServiceExist?EnableWindow(GetDlgItem(hwnd, IDC_VARS),1):EnableWindow(GetDlgItem(hwnd, IDC_VARS),0);
- }
+ TranslateDialogDefault(hwnd);
+ SetDlgItemText(hwnd, ID_QUESTION, gbQuestion.c_str());
+ SetDlgItemText(hwnd, ID_ANSWER, gbAnswer.c_str());
+ SetDlgItemText(hwnd, ID_CONGRATULATION, gbCongratulation.c_str());
+ SetDlgItemText(hwnd, ID_AUTHREPL, gbAuthRepl.c_str());
+ EnableWindow(GetDlgItem(hwnd, ID_ANSWER), !gbMathExpression);
+ variables_skin_helpbutton(hwnd, IDC_VARS);
+ gbVarsServiceExist ? EnableWindow(GetDlgItem(hwnd, IDC_VARS), 1) : EnableWindow(GetDlgItem(hwnd, IDC_VARS), 0);
return TRUE;
+
case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case ID_QUESTION:
- case ID_ANSWER:
- case ID_AUTHREPL:
- case ID_CONGRATULATION:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
- }
- case ID_RESTOREDEFAULTS:
- SetDlgItemText(hwnd, ID_QUESTION, defQuestion);
- SetDlgItemText(hwnd, ID_ANSWER, _T("nospam"));
- SetDlgItemText(hwnd, ID_AUTHREPL, TranslateT("StopSpam: send a message and reply to an anti-spam bot question."));
- SetDlgItemText(hwnd, ID_CONGRATULATION, TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message."));
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- return TRUE;
- case IDC_VARS:
- variables_showhelp(hwnd, msg, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
- return TRUE;
- }
+ switch (LOWORD(wParam)) {
+ case ID_QUESTION:
+ case ID_ANSWER:
+ case ID_AUTHREPL:
+ case ID_CONGRATULATION:
+ if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
+ return FALSE;
+ break;
+
+ case ID_RESTOREDEFAULTS:
+ SetDlgItemText(hwnd, ID_QUESTION, defQuestion);
+ SetDlgItemText(hwnd, ID_ANSWER, _T("nospam"));
+ SetDlgItemText(hwnd, ID_AUTHREPL, TranslateT("StopSpam: send a message and reply to an anti-spam bot question."));
+ SetDlgItemText(hwnd, ID_CONGRATULATION, TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message."));
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ return TRUE;
+
+ case IDC_VARS:
+ variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, NULL, NULL);
+ return TRUE;
}
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
+
case WM_NOTIFY:
- {
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
- {
- case PSN_APPLY:
- {
- db_set_ws(NULL, pluginName, "question", GetDlgItemString(hwnd, ID_QUESTION).c_str());
- gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion);
- db_set_ws(NULL, pluginName, "answer", GetDlgItemString(hwnd, ID_ANSWER).c_str());
- gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam"));
- db_set_ws(NULL, pluginName, "authrepl", GetDlgItemString(hwnd, ID_AUTHREPL).c_str());
- gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", TranslateT("StopSpam: send a message and reply to an anti-spam bot question."));
- db_set_ws(NULL, pluginName, "congratulation", GetDlgItemString(hwnd, ID_CONGRATULATION).c_str());
- gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message."));
- }
- return TRUE;
- }
+ NMHDR *nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code) {
+ case PSN_APPLY:
+ db_set_ws(NULL, pluginName, "question", GetDlgItemString(hwnd, ID_QUESTION).c_str());
+ gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion);
+ db_set_ws(NULL, pluginName, "answer", GetDlgItemString(hwnd, ID_ANSWER).c_str());
+ gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam"));
+ db_set_ws(NULL, pluginName, "authrepl", GetDlgItemString(hwnd, ID_AUTHREPL).c_str());
+ gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", TranslateT("StopSpam: send a message and reply to an anti-spam bot question."));
+ db_set_ws(NULL, pluginName, "congratulation", GetDlgItemString(hwnd, ID_CONGRATULATION).c_str());
+ gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message."));
+ return TRUE;
}
break;
}
@@ -145,97 +127,90 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
- int n;
+ int nAccs;
PROTOACCOUNT **pppd;
- Proto_EnumAccounts(&n, &pppd);
- for (int i = 0; i < n; ++i)
+ Proto_EnumAccounts(&nAccs, &pppd);
+ for (int i = 0; i < nAccs; ++i)
SendDlgItemMessageA(hwnd, (ProtoInList(pppd[i]->szModuleName) ? ID_USEDPROTO : ID_ALLPROTO), LB_ADDSTRING, 0, (LPARAM)pppd[i]->szModuleName);
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
+ WPARAM n;
case ID_ADD:
- {
- WPARAM n = (WPARAM)SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETCURSEL, 0, 0);
- if(LB_ERR != n) {
- size_t len = SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETTEXTLEN, n, 0);
- if(LB_ERR != len) {
- TCHAR * buf = new TCHAR[len + 1];
- SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETTEXT, n, (LPARAM)buf);
- SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_ADDSTRING, 0, (LPARAM)buf);
- delete []buf;
- SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_DELETESTRING, n, 0);
- }
+ n = (WPARAM)SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETCURSEL, 0, 0);
+ if (LB_ERR != n) {
+ size_t len = SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETTEXTLEN, n, 0);
+ if (LB_ERR != len) {
+ TCHAR * buf = new TCHAR[len + 1];
+ SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETTEXT, n, (LPARAM)buf);
+ SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_ADDSTRING, 0, (LPARAM)buf);
+ delete[]buf;
+ SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_DELETESTRING, n, 0);
}
}
break;
+
case ID_REMOVE:
- {
- WPARAM n = (WPARAM)SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCURSEL, 0, 0);
- if(LB_ERR != n) {
- size_t len = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETTEXTLEN, n, 0);
- if(LB_ERR != len) {
- TCHAR * buf = new TCHAR[len + 1];
- SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETTEXT, n, (LPARAM)buf);
- SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_ADDSTRING, 0, (LPARAM)buf);
- delete []buf;
- SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_DELETESTRING, n, 0);
- }
+ n = (WPARAM)SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCURSEL, 0, 0);
+ if (LB_ERR != n) {
+ size_t len = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETTEXTLEN, n, 0);
+ if (LB_ERR != len) {
+ TCHAR * buf = new TCHAR[len + 1];
+ SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETTEXT, n, (LPARAM)buf);
+ SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_ADDSTRING, 0, (LPARAM)buf);
+ delete[]buf;
+ SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_DELETESTRING, n, 0);
}
}
break;
+
case ID_ADDALL:
- for(;;)
- {
+ for (;;) {
LRESULT count = SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETCOUNT, 0, 0);
- if(!count || LB_ERR == count)
+ if (!count || LB_ERR == count)
break;
SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_SETCURSEL, 0, 0);
SendMessage(hwnd, WM_COMMAND, ID_ADD, 0);
}
break;
+
case ID_REMOVEALL:
- for(;;)
- {
+ for (;;) {
LRESULT count = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCOUNT, 0, 0);
- if(!count || LB_ERR == count)
+ if (!count || LB_ERR == count)
break;
SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_SETCURSEL, 0, 0);
SendMessage(hwnd, WM_COMMAND, ID_REMOVE, 0);
}
break;
+
default:
return FALSE;
}
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
return TRUE;
+
case WM_NOTIFY:
- {
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
- {
- case PSN_APPLY:
- {
- LRESULT count = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCOUNT, 0, 0);
- std::ostringstream out;
- for(int i = 0; i < count; ++i) {
- size_t len = SendDlgItemMessageA(hwnd, ID_USEDPROTO, LB_GETTEXTLEN, i, 0);
- if(LB_ERR != len) {
- char * buf = new char[len + 1];
- SendDlgItemMessageA(hwnd, ID_USEDPROTO, LB_GETTEXT, i, (LPARAM)buf);
- out << buf << "\r\n";
- delete []buf;
- }
- }
- db_set_s(NULL, pluginName, "protoList", out.str().c_str());
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code) {
+ case PSN_APPLY:
+ LRESULT count = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCOUNT, 0, 0);
+ std::ostringstream out;
+ for (int i = 0; i < count; ++i) {
+ size_t len = SendDlgItemMessageA(hwnd, ID_USEDPROTO, LB_GETTEXTLEN, i, 0);
+ if (LB_ERR != len) {
+ char * buf = new char[len + 1];
+ SendDlgItemMessageA(hwnd, ID_USEDPROTO, LB_GETTEXT, i, (LPARAM)buf);
+ out << buf << "\r\n";
+ delete[]buf;
}
- return TRUE;
}
+ db_set_s(NULL, pluginName, "protoList", out.str().c_str());
+ return TRUE;
}
break;
}
@@ -244,12 +219,12 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
CheckDlgButton(hwnd, IDC_INVIS_DISABLE, gbInvisDisable ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_CASE_INSENSITIVE, gbCaseInsensitive ? BST_CHECKED : BST_UNCHECKED);
- gbDosServiceExist?EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),1):EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),0);
+ gbDosServiceExist ? EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION), 1) : EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION), 0);
CheckDlgButton(hwnd, ID_DOS_INTEGRATION, gbDosServiceIntegration ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(hwnd, ID_SPECIALGROUPNAME, gbSpammersGroup.c_str());
CheckDlgButton(hwnd, ID_SPECIALGROUP, gbSpecialGroup ? BST_CHECKED : BST_UNCHECKED);
@@ -273,13 +248,13 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
MessageBox(hwnd, TranslateT("If math expression is turned on, you can use following expression in message text:\nXX+XX-X/X*X\neach X will be replaced by one random number and answer will be expression result.\nMessage must contain only one expression without spaces."), TranslateT("Info"), MB_OK);
break;
- case IDC_INVIS_DISABLE:
- case IDC_CASE_INSENSITIVE:
+ case IDC_INVIS_DISABLE:
+ case IDC_CASE_INSENSITIVE:
case ID_DOS_INTEGRATION:
- case ID_SPECIALGROUPNAME:
- case ID_SPECIALGROUP:
- case ID_EXCLUDE:
- case ID_REMOVE_TMP:
+ case ID_SPECIALGROUPNAME:
+ case ID_SPECIALGROUP:
+ case ID_EXCLUDE:
+ case ID_REMOVE_TMP:
case ID_REMOVE_TMP_ALL:
case ID_IGNOREURL:
case IDC_AUTOAUTH:
@@ -299,52 +274,50 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
case PSN_APPLY:
db_set_b(NULL, pluginName, "CaseInsensitive", gbCaseInsensitive = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_CASE_INSENSITIVE));
db_set_b(NULL, pluginName, "DisableInInvis", gbInvisDisable = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_INVIS_DISABLE));
- db_set_b(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_DOS_INTEGRATION));
+ db_set_b(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_DOS_INTEGRATION));
{
static tstring NewGroupName, CurrentGroupName;
NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME);
CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0"));
if (mir_wstrcmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) {
bool GroupExist = Clist_GroupExists(NewGroupName.c_str()) != NULL;
- db_set_ws(NULL,pluginName, "SpammersGroup", NewGroupName.c_str());
- gbSpammersGroup = DBGetContactSettingStringPAN(NULL,pluginName,"SpammersGroup", _T("Spammers"));
- if(!GroupExist && gbSpecialGroup)
+ db_set_ws(NULL, pluginName, "SpammersGroup", NewGroupName.c_str());
+ gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("Spammers"));
+ if (!GroupExist && gbSpecialGroup)
CreateCListGroup((TCHAR*)gbSpammersGroup.c_str());
}
}
- db_set_b(NULL, pluginName, "SpecialGroup", gbSpecialGroup = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_SPECIALGROUP));
- db_set_b(NULL, pluginName, "ExcludeContacts", gbExclude = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_EXCLUDE));
- db_set_b(NULL, pluginName, "DelExcluded", gbDelExcluded = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP));
- db_set_b(NULL, pluginName, "DelAllTempory", gbDelAllTempory = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP_ALL));
- db_set_b(NULL, pluginName, "IgnoreURL", gbIgnoreURL = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_IGNOREURL));
-
- db_set_b(NULL, pluginName, "AutoAuth", gbAutoAuth = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_AUTOAUTH));
- db_set_b(NULL, pluginName, "AutoAddToServerList", gbAutoAddToServerList = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_ADDTOSRVLST));
- db_set_b(NULL, pluginName, "AutoReqAuth", gbAutoReqAuth = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_REQAUTH));
- db_set_b(NULL, pluginName, "RegexMatch", gbRegexMatch = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_REGEX));
- db_set_b(NULL, pluginName, "HistoryLog", gbHistoryLog = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_HISTORY_LOG));
- db_set_b(NULL, pluginName, "MathExpression", gbMathExpression = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_MATH_QUESTION));
+ db_set_b(NULL, pluginName, "SpecialGroup", gbSpecialGroup = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_SPECIALGROUP));
+ db_set_b(NULL, pluginName, "ExcludeContacts", gbExclude = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_EXCLUDE));
+ db_set_b(NULL, pluginName, "DelExcluded", gbDelExcluded = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP));
+ db_set_b(NULL, pluginName, "DelAllTempory", gbDelAllTempory = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP_ALL));
+ db_set_b(NULL, pluginName, "IgnoreURL", gbIgnoreURL = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_IGNOREURL));
+ db_set_b(NULL, pluginName, "AutoAuth", gbAutoAuth = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_AUTOAUTH));
+ db_set_b(NULL, pluginName, "AutoAddToServerList", gbAutoAddToServerList = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_ADDTOSRVLST));
+ db_set_b(NULL, pluginName, "AutoReqAuth", gbAutoReqAuth = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_REQAUTH));
+ db_set_b(NULL, pluginName, "RegexMatch", gbRegexMatch = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_REGEX));
+ db_set_b(NULL, pluginName, "HistoryLog", gbHistoryLog = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_HISTORY_LOG));
+ db_set_b(NULL, pluginName, "MathExpression", gbMathExpression = BST_CHECKED == IsDlgButtonChecked(hwnd, IDC_MATH_QUESTION));
{
static tstring NewAGroupName, CurrentAGroupName;
NewAGroupName = GetDlgItemString(hwnd, IDC_AUTOADDGROUP);
CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("0"));
if (mir_wstrcmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) {
bool GroupExist = Clist_GroupExists(NewAGroupName.c_str()) != NULL;
- db_set_ws(NULL,pluginName, "AutoAuthGroup", NewAGroupName.c_str());
- gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL,pluginName,"AutoAuthGroup", _T("Not Spammers"));
- if(!GroupExist && gbAutoAddToServerList)
+ db_set_ws(NULL, pluginName, "AutoAuthGroup", NewAGroupName.c_str());
+ gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("Not Spammers"));
+ if (!GroupExist && gbAutoAddToServerList)
CreateCListGroup((TCHAR*)gbAutoAuthGroup.c_str());
}
}
return TRUE;
}
- break;
+ break;
}
return FALSE;
}
-
HINSTANCE hInst;
MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l)
{
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index bbbc910ed0..2cad3a82a6 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -15,17 +15,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
#include "stdafx.h"
tstring DBGetContactSettingStringPAN(MCONTACT hContact, char const * szModule, char const * szSetting, tstring errorValue)
{
DBVARIANT dbv;
//if(db_get(hContact, szModule, szSetting, &dbv))
- if(db_get_ts(hContact, szModule, szSetting, &dbv))
+ if (db_get_ts(hContact, szModule, szSetting, &dbv))
return errorValue;
-// if(DBVT_TCHAR == dbv.type )
- errorValue = dbv.ptszVal;
+ // if(DBVT_TCHAR == dbv.type )
+ errorValue = dbv.ptszVal;
db_free(&dbv);
return errorValue;
}
@@ -34,10 +33,10 @@ std::string DBGetContactSettingStringPAN_A(MCONTACT hContact, char const * szMod
{
DBVARIANT dbv;
//if(db_get(hContact, szModule, szSetting, &dbv))
- if(db_get_s(hContact, szModule, szSetting, &dbv))
+ if (db_get_s(hContact, szModule, szSetting, &dbv))
return errorValue;
-// if(DBVT_ASCIIZ == dbv.type )
- errorValue = dbv.pszVal;
+ // if(DBVT_ASCIIZ == dbv.type )
+ errorValue = dbv.pszVal;
db_free(&dbv);
return errorValue;
}
@@ -50,7 +49,7 @@ tstring &GetDlgItemString(HWND hwnd, int id)
GetWindowText(h, buf, len + 1);
static tstring s;
s = buf;
- delete []buf;
+ delete[]buf;
return s;
}
@@ -78,26 +77,27 @@ int CreateCListGroup(TCHAR* szGroupName)
void DeleteCListGroupsByName(TCHAR* szGroupName)
{
BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
- if(ConfirmDelete)
+ if (ConfirmDelete)
db_set_b(NULL, "CList", "ConfirmDelete", 0);
TCHAR *szGroup;
- for (int i=1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++)
- if( !mir_wstrcmp(szGroupName, szGroup))
+ for (int i = 1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++)
+ if (!mir_wstrcmp(szGroupName, szGroup))
CallService(MS_CLIST_GROUPDELETE, i, 0);
- if(ConfirmDelete)
+ if (ConfirmDelete)
db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete);
}
-int RemoveTmp(WPARAM,LPARAM)
+int RemoveTmp(WPARAM, LPARAM)
{
void CleanThread();
CleanThread();
return 0;
}
-tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact){
+tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact)
+{
if (gbVarsServiceExist) {
FORMATINFO fi;
TCHAR *tszParsed;
@@ -142,27 +142,25 @@ const int Stricmp(const TCHAR *str, const TCHAR *substr)
TCHAR* ReqGetText(DBEVENTINFO* dbei)
{
- if ( !dbei->pBlob )
+ if (!dbei->pBlob)
return 0;
- char * ptr=(char *)&dbei->pBlob[sizeof(DWORD)*2];
- int len=dbei->cbBlob-sizeof(DWORD)*2;
- int i=0;
+ char * ptr = (char *)&dbei->pBlob[sizeof(DWORD) * 2];
+ int len = dbei->cbBlob - sizeof(DWORD) * 2;
+ int i = 0;
- while(len && (i<4))
- {
- if(!ptr[0]) i++;
+ while (len && (i < 4)) {
+ if (!ptr[0]) i++;
ptr++;
len--;
};
- if(len)
- {
- char * tstr=(char *)mir_alloc(len+1);
+ if (len) {
+ char * tstr = (char *)mir_alloc(len + 1);
memcpy(tstr, ptr, len);
- tstr[len]=0;
+ tstr[len] = 0;
WCHAR* msg = NULL;
- msg=(dbei->flags&DBEF_UTF)?mir_utf8decodeW(tstr):mir_a2u(tstr);
+ msg = (dbei->flags&DBEF_UTF) ? mir_utf8decodeW(tstr) : mir_a2u(tstr);
mir_free(tstr);
return (TCHAR *)msg;
};
@@ -171,8 +169,8 @@ TCHAR* ReqGetText(DBEVENTINFO* dbei)
BOOL IsUrlContains(TCHAR * Str)
{
- const int CountUrl=11;
- const TCHAR URL[CountUrl][5]=
+ const int CountUrl = 11;
+ const TCHAR URL[CountUrl][5] =
{
L"http",
L"www",
@@ -187,12 +185,11 @@ BOOL IsUrlContains(TCHAR * Str)
L".tv"
};
- if(Str && mir_tstrlen(Str)>0) {
+ if (Str && mir_tstrlen(Str) > 0) {
TCHAR *StrLower = NEWTSTR_MALLOC(Str);
CharLowerBuff(StrLower, (int)mir_tstrlen(StrLower));
- for (int i=0; i<CountUrl; i++)
- if(_tcsstr (StrLower, URL[i]))
- {
+ for (int i = 0; i < CountUrl; i++)
+ if (_tcsstr(StrLower, URL[i])) {
mir_free(StrLower);
return 1;
}
@@ -204,8 +201,8 @@ BOOL IsUrlContains(TCHAR * Str)
tstring GetContactUid(MCONTACT hContact, tstring Protocol)
{
tstring Uid;
- TCHAR dUid[32]={0};
- char aUid[32]={0};
+ TCHAR dUid[32] = { 0 };
+ char aUid[32] = { 0 };
char *szProto = mir_utf8encodeW(Protocol.c_str());
CONTACTINFO ci;
memset(&ci, 0, sizeof(ci));
@@ -215,19 +212,19 @@ tstring GetContactUid(MCONTACT hContact, tstring Protocol)
ci.cbSize = sizeof(ci);
ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) {
switch (ci.type) {
- case CNFT_ASCIIZ:
- Uid=ci.pszVal;
- mir_free((void *)ci.pszVal);
+ case CNFT_ASCIIZ:
+ Uid = ci.pszVal;
+ mir_free((void *)ci.pszVal);
break;
- case CNFT_DWORD:
- _itoa_s(ci.dVal,aUid,32,10);
- OemToChar(aUid, dUid);
- Uid=dUid;
+ case CNFT_DWORD:
+ _itoa_s(ci.dVal, aUid, 32, 10);
+ OemToChar(aUid, dUid);
+ Uid = dUid;
break;
- default:
- Uid=_T("");
+ default:
+ Uid = _T("");
break;
};
}
@@ -240,42 +237,40 @@ void LogSpamToFile(MCONTACT hContact, tstring message)
if (!gbLogToFile) return;
tstring LogStrW, LogTime, LogProtocol, LogContactId, LogContactName;
- tstring filename;
std::fstream file;
TCHAR pszName[MAX_PATH];
if (hStopSpamLogDirH)
FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, _T(""));
else
- mir_tstrncpy(pszName, VARST( _T("%miranda_logpath%")), _countof(pszName));
+ mir_tstrncpy(pszName, VARST(_T("%miranda_logpath%")), _countof(pszName));
- filename = pszName;
- filename = filename + _T("\\stopspam_mod.log");
-
- file.open(filename.c_str(),std::ios::out |std::ios::app);
+ tstring filename = pszName;
+ filename += _T("\\stopspam_mod.log");
+ file.open(filename.c_str(), std::ios::out | std::ios::app);
// Time Log line
time_t time_now;
- tm *TimeNow;
time(&time_now);
- TimeNow = localtime(&time_now);
- LogTime=_wasctime( TimeNow );
+
+ struct tm *TimeNow = localtime(&time_now);
+ LogTime = _wasctime(TimeNow);
// Time Log line
// Name, UID and Protocol Log line
- LogProtocol=DBGetContactSettingStringPAN(hContact,"Protocol","p",_T(""));
- LogContactName=(TCHAR*)pcli->pfnGetContactDisplayName(hContact, 0);
- LogContactId=(LogProtocol==_T(""))?_T(""):GetContactUid(hContact,LogProtocol);
+ LogProtocol = DBGetContactSettingStringPAN(hContact, "Protocol", "p", _T(""));
+ LogContactName = (TCHAR*)pcli->pfnGetContactDisplayName(hContact, 0);
+ LogContactId = (LogProtocol == _T("")) ? _T("") : GetContactUid(hContact, LogProtocol);
// Name, UID and Protocol Log line
- LogStrW=_T("[")+LogTime.substr(0,LogTime.length()-1)+_T("] ")+
- LogContactId+_T(" - ")+
- LogContactName+_T(" (")+
- LogProtocol+_T("): ")+
- message+_T("\n");
+ LogStrW = _T("[") + LogTime.substr(0, LogTime.length() - 1) + _T("] ") +
+ LogContactId + _T(" - ") +
+ LogContactName + _T(" (") +
+ LogProtocol + _T("): ") +
+ message + _T("\n");
- char * buf=mir_u2a(LogStrW.c_str());
- file.write(buf,LogStrW.length());
+ char *buf = mir_u2a(LogStrW.c_str());
+ file.write(buf, LogStrW.length());
mir_free(buf);
file.close();
@@ -285,24 +280,22 @@ boost::mutex clean_mutex;
void CleanProtocolTmpThread(std::string proto)
{
- while(true)
- {
+ while (true) {
UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0);
- if(status > ID_STATUS_OFFLINE)
+ if (status > ID_STATUS_OFFLINE)
break;
boost::this_thread::sleep(boost::posix_time::seconds(2));
}
std::list<MCONTACT> contacts;
- for(MCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str()))
- if(db_get_b(hContact, "CList", "NotOnList", 0)|| (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T(""))))
+ for (MCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str()))
+ if (db_get_b(hContact, "CList", "NotOnList", 0) || (_T("Not In List") == DBGetContactSettingStringPAN(hContact, "CList", "Group", _T(""))))
contacts.push_back(hContact);
boost::this_thread::sleep(boost::posix_time::seconds(5));
clean_mutex.lock();
std::list<MCONTACT>::iterator end = contacts.end();
- for(std::list<MCONTACT>::iterator i = contacts.begin(); i != end; ++i)
- {
+ for (std::list<MCONTACT>::iterator i = contacts.begin(); i != end; ++i) {
LogSpamToFile(*i, _T("Deleted"));
HistoryLogFunc(*i, "Deleted");
CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0);
@@ -312,24 +305,22 @@ void CleanProtocolTmpThread(std::string proto)
void CleanProtocolExclThread(std::string proto)
{
- while(true)
- {
+ while (true) {
UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0);
- if(status > ID_STATUS_OFFLINE)
+ if (status > ID_STATUS_OFFLINE)
break;
boost::this_thread::sleep(boost::posix_time::seconds(2));
}
std::list<MCONTACT> contacts;
- for(MCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str()))
- if(db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, pluginName, "Excluded", 0))
+ for (MCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str()))
+ if (db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, pluginName, "Excluded", 0))
contacts.push_back(hContact);
boost::this_thread::sleep(boost::posix_time::seconds(5));
clean_mutex.lock();
std::list<MCONTACT>::iterator end = contacts.end();
- for(std::list<MCONTACT>::iterator i = contacts.begin(); i != end; ++i)
- {
+ for (std::list<MCONTACT>::iterator i = contacts.begin(); i != end; ++i) {
LogSpamToFile(*i, _T("Deleted"));
HistoryLogFunc(*i, "Deleted");
CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0);
@@ -343,17 +334,15 @@ void CleanThread()
int count = 0;
PROTOACCOUNT **accounts;
Proto_EnumAccounts(&count, &accounts);
- for(int i = 0; i < count; i++)
- {
- if(!strstr(accounts[i]->szModuleName, "MetaContacts") && !strstr(accounts[i]->szModuleName, "Weather")) //not real protocols
+ for (int i = 0; i < count; i++)
+ if (!strstr(accounts[i]->szModuleName, "MetaContacts") && !strstr(accounts[i]->szModuleName, "Weather")) //not real protocols
protocols.push_back(accounts[i]->szModuleName);
- }
+
std::list<std::string>::iterator end = protocols.end();
- for(std::list<std::string>::iterator i = protocols.begin(); i != end; ++i)
- {
- if(gbDelAllTempory)
+ for (std::list<std::string>::iterator i = protocols.begin(); i != end; ++i) {
+ if (gbDelAllTempory)
new boost::thread(boost::bind(&CleanProtocolTmpThread, *i));
- if(gbDelExcluded)
+ if (gbDelExcluded)
new boost::thread(boost::bind(&CleanProtocolExclThread, *i));
}
}
@@ -365,23 +354,22 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags)
Event.eventType = event_type;
Event.flags = flags | DBEF_UTF;
Event.timestamp = (DWORD)time(NULL);
- Event.cbBlob = (DWORD)mir_strlen(data)+1;
+ Event.cbBlob = (DWORD)mir_strlen(data) + 1;
Event.pBlob = (PBYTE)_strdup(data);
db_event_add(hContact, &Event);
}
void HistoryLogFunc(MCONTACT hContact, std::string message)
{
- if(gbHistoryLog)
- {
- if(hContact == INVALID_CONTACT_ID)
+ if (gbHistoryLog) {
+ if (hContact == INVALID_CONTACT_ID)
return;
std::string msg = message;
msg.append("\n");
msg.append("Protocol: ").append(GetContactProto(hContact)).append(" Contact: ");
msg.append(toUTF8((TCHAR*)pcli->pfnGetContactDisplayName(hContact, 0))).append(" ID: ");
- msg.append(toUTF8(GetContactUid(hContact,toUTF16(GetContactProto(hContact)))));
+ msg.append(toUTF8(GetContactUid(hContact, toUTF16(GetContactProto(hContact)))));
HistoryLog(NULL, (char*)msg.c_str(), EVENTTYPE_MESSAGE, DBEF_READ);
}
}
@@ -389,11 +377,10 @@ void HistoryLogFunc(MCONTACT hContact, std::string message)
std::string toUTF8(std::wstring str)
{
std::string ustr;
- try{
- utf8::utf16to8(str.begin(), str.end(), back_inserter(ustr));
+ try {
+ utf8::utf16to8(str.begin(), str.end(), back_inserter(ustr));
}
- catch(const std::exception&)
- {
+ catch (const std::exception&) {
//TODO: handle utf8cpp exceptions
}
return ustr;
@@ -408,12 +395,11 @@ std::wstring toUTF16(std::string str) //convert as much as possible
{
std::wstring ustr;
std::string tmpstr;
- try{
- utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr));
- utf8::utf8to16(tmpstr.begin(), tmpstr.end(), back_inserter(ustr));
+ try {
+ utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr));
+ utf8::utf8to16(tmpstr.begin(), tmpstr.end(), back_inserter(ustr));
}
- catch(const std::exception &)
- {
+ catch (const std::exception &) {
//TODO: handle utf8cpp exceptions
}
return ustr;
@@ -424,8 +410,8 @@ std::string get_random_num(int length)
std::string chars("123456789");
std::string data;
boost::random_device rng;
- boost::variate_generator<boost::random_device&, boost::uniform_int<>> gen(rng, boost::uniform_int<>(0, (int)chars.length()-1));
- for(int i = 0; i < length; ++i)
+ boost::variate_generator<boost::random_device&, boost::uniform_int<>> gen(rng, boost::uniform_int<>(0, (int)chars.length() - 1));
+ for (int i = 0; i < length; ++i)
data += chars[gen()];
return data;
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index ef5282868a..f5dba28146 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -517,7 +517,7 @@ HWND hToolBarTree = NULL;
INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- HTREEITEM hti;
+ HTREEITEM hItem;
switch (uMsg) {
case WM_INITDIALOG:
@@ -624,9 +624,9 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
break;
case IDC_SEPARATOR:
- hti = TreeView_GetSelection(hToolBarTree);
- if (!hti)
- hti = TVI_FIRST;
+ hItem = TreeView_GetSelection(hToolBarTree);
+ if (!hItem)
+ hItem = TVI_FIRST;
CustomButtonData *cbd = new CustomButtonData();
cbd->m_bSeparator = cbd->m_bHidden = cbd->m_bIMButton = cbd->m_bLSided = true;
@@ -638,15 +638,15 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
TVINSERTSTRUCT tvis;
tvis.hParent = NULL;
- tvis.hInsertAfter = hti;
+ tvis.hInsertAfter = hItem;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.item.pszText = TranslateT("<Separator>");
tvis.item.iImage = tvis.item.iSelectedImage = -1;
tvis.item.lParam = (LPARAM)cbd;
- hti = TreeView_InsertItem(hToolBarTree, &tvis);
+ hItem = TreeView_InsertItem(hToolBarTree, &tvis);
- TreeView_SetCheckState(hToolBarTree, hti, (cbd->m_bIMButton || cbd->m_bChatButton));
+ TreeView_SetCheckState(hToolBarTree, hItem, (cbd->m_bIMButton || cbd->m_bChatButton));
}
break;
@@ -660,11 +660,11 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
return 1;
case PSN_APPLY:
- hti = TreeView_GetSelection(hToolBarTree);
- if (hti) {
+ hItem = TreeView_GetSelection(hToolBarTree);
+ if (hItem) {
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = hti;
+ tvi.hItem = hItem;
TreeView_GetItem(hToolBarTree, &tvi);
if (tvi.lParam) {
@@ -704,12 +704,12 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
break;
case TVN_SELCHANGING:
- hti = TreeView_GetSelection(hToolBarTree);
- if (hti != NULL) {
+ hItem = TreeView_GetSelection(hToolBarTree);
+ if (hItem != NULL) {
TCHAR strbuf[128];
TVITEM tvi;
- tvi.hItem = hti;
+ tvi.hItem = hItem;
tvi.pszText = strbuf;
tvi.cchTextMax = _countof(strbuf);
tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
@@ -732,15 +732,15 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
break;
case TVN_SELCHANGED:
- hti = TreeView_GetSelection(hToolBarTree);
- if (hti != NULL) {
+ hItem = TreeView_GetSelection(hToolBarTree);
+ if (hItem != NULL) {
TCHAR strbuf[128];
TVITEM tvi;
tvi.pszText = strbuf;
tvi.cchTextMax = _countof(strbuf);
tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = hti;
+ tvi.hItem = hItem;
TreeView_GetItem(hToolBarTree, &tvi);
if (!TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !mir_tstrcmp(tvi.pszText, MIDDLE_SEPARATOR)) {
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp
index 3aeafcb697..05095a2fea 100644
--- a/plugins/TipperYM/src/mir_smileys.cpp
+++ b/plugins/TipperYM/src/mir_smileys.cpp
@@ -133,13 +133,13 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SMILEYPARSEINFO info, UINT uTe
info->row_height[row_count] = max(info->row_height[row_count], text_height);
if (piece->type == TEXT_PIECE_TYPE_TEXT) {
- RECT text_rc = { 0, 0, 2048, 2048 };
+ RECT rc = { 0, 0, 2048, 2048 };
- DrawText(hdcMem, szText + piece->start_pos, piece->len, &text_rc, DT_CALCRECT | uTextFormat);
- pos_x += (text_rc.right - text_rc.left);
+ DrawText(hdcMem, szText + piece->start_pos, piece->len, &rc, DT_CALCRECT | uTextFormat);
+ pos_x += (rc.right - rc.left);
if (pos_x > max_width) {
- text_size.cx = max(text_size.cx, pos_x - (text_rc.right - text_rc.left));
- pos_x = text_rc.right - text_rc.left;
+ text_size.cx = max(text_size.cx, pos_x - (rc.right - rc.left));
+ pos_x = rc.right - rc.left;
info->row_height[++row_count] = text_height;
}
@@ -148,7 +148,6 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SMILEYPARSEINFO info, UINT uTe
pos_x = 0;
info->row_height[++row_count] = 0;
}
-
}
else {
double factor;
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp
index 650e2d03d4..f6368d6e58 100644
--- a/plugins/TopToolBar/src/toolbar.cpp
+++ b/plugins/TopToolBar/src/toolbar.cpp
@@ -546,13 +546,13 @@ int OnPluginLoad(WPARAM, LPARAM lParam)
int OnPluginUnload(WPARAM, LPARAM lParam)
{
- int hLangpack = GetPluginLangByInstance((HINSTANCE)lParam);
- if (hLangpack) {
+ int lang = GetPluginLangByInstance((HINSTANCE)lParam);
+ if (lang) {
bool bNeedUpdate = false;
mir_cslock lck(csButtonsHook);
for (int i = Buttons.getCount() - 1; i >= 0; i--)
- if (Buttons[i]->hLangpack == hLangpack) {
+ if (Buttons[i]->hLangpack == lang) {
TTBRemoveButton(Buttons[i]->id, 0);
bNeedUpdate = true;
}
diff --git a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp
index 8f38ee8ce7..3f4bc639e9 100644
--- a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp
+++ b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp
@@ -86,7 +86,7 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char* output, int* lengt
const unsigned long BYTE_MARK = 0x80;
const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
- if (input < 0x80)
+ if (input < 0x80)
*length = 1;
else if (input < 0x800)
*length = 2;
@@ -94,29 +94,29 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char* output, int* lengt
*length = 3;
else if (input < 0x200000)
*length = 4;
- else
- { *length = 0; return; } // This code won't covert this correctly anyway.
+ else {
+ *length = 0; return;
+ } // This code won't covert this correctly anyway.
output += *length;
// Scary scary fall throughs.
- switch (*length)
- {
- case 4:
- --output;
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
- input >>= 6;
- case 3:
- --output;
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
- input >>= 6;
- case 2:
- --output;
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
- input >>= 6;
- case 1:
- --output;
- *output = (char)(input | FIRST_BYTE_MARK[*length]);
+ switch (*length) {
+ case 4:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 3:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 2:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 1:
+ --output;
+ *output = (char)(input | FIRST_BYTE_MARK[*length]);
}
}
@@ -130,10 +130,10 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char* output, int* lengt
// if (encoding == TIXML_ENCODING_UTF8)
// {
- if (anyByte < 127)
- return isalpha(anyByte);
- else
- return 1; // What else to do? The unicode set is huge...get the english ones right.
+ if (anyByte < 127)
+ return isalpha(anyByte);
+ else
+ return 1; // What else to do? The unicode set is huge...get the english ones right.
// }
// else
// {
@@ -151,10 +151,10 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char* output, int* lengt
// if (encoding == TIXML_ENCODING_UTF8)
// {
- if (anyByte < 127)
- return isalnum(anyByte);
- else
- return 1; // What else to do? The unicode set is huge...get the english ones right.
+ if (anyByte < 127)
+ return isalnum(anyByte);
+ else
+ return 1; // What else to do? The unicode set is huge...get the english ones right.
// }
// else
// {
@@ -166,12 +166,12 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char* output, int* lengt
class TiXmlParsingData
{
friend class TiXmlDocument;
- public:
+public:
void Stamp(const char* now, TiXmlEncoding encoding);
- const TiXmlCursor& Cursor() { return cursor; }
+ const TiXmlCursor& Cursor() { return cursor; }
- private:
+private:
// Only used by the document!
TiXmlParsingData(const char* start, int _tabsize, int row, int col)
{
@@ -193,8 +193,7 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding)
assert(now);
// Do nothing if the tabsize is 0.
- if (tabsize < 1)
- {
+ if (tabsize < 1) {
return;
}
@@ -204,97 +203,92 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding)
const char* p = stamp;
assert(p);
- while (p < now)
- {
+ while (p < now) {
// Treat p as unsigned, so we have a happy compiler.
const unsigned char* pU = (const unsigned char*)p;
// Code contributed by Fletcher Dunn: (modified by lee)
switch (*pU) {
- case 0:
- // We *should* never get here, but in case we do, don't
- // advance past the terminating null character, ever
- return;
+ case 0:
+ // We *should* never get here, but in case we do, don't
+ // advance past the terminating null character, ever
+ return;
+
+ case '\r':
+ // bump down to the next line
+ ++row;
+ col = 0;
+ // Eat the character
+ ++p;
- case '\r':
- // bump down to the next line
- ++row;
- col = 0;
- // Eat the character
+ // Check for \r\n sequence, and treat this as a single character
+ if (*p == '\n') {
++p;
+ }
+ break;
- // Check for \r\n sequence, and treat this as a single character
- if (*p == '\n') {
- ++p;
- }
- break;
+ case '\n':
+ // bump down to the next line
+ ++row;
+ col = 0;
- case '\n':
- // bump down to the next line
- ++row;
- col = 0;
+ // Eat the character
+ ++p;
- // Eat the character
+ // Check for \n\r sequence, and treat this as a single
+ // character. (Yes, this bizarre thing does occur still
+ // on some arcane platforms...)
+ if (*p == '\r') {
++p;
+ }
+ break;
- // Check for \n\r sequence, and treat this as a single
- // character. (Yes, this bizarre thing does occur still
- // on some arcane platforms...)
- if (*p == '\r') {
- ++p;
- }
- break;
-
- case '\t':
- // Eat the character
- ++p;
+ case '\t':
+ // Eat the character
+ ++p;
- // Skip to next tab stop
- col = (col / tabsize + 1) * tabsize;
- break;
+ // Skip to next tab stop
+ col = (col / tabsize + 1) * tabsize;
+ break;
- case TIXML_UTF_LEAD_0:
- if (encoding == TIXML_ENCODING_UTF8)
- {
- if (*(p+1) && *(p+2))
- {
- // In these cases, don't advance the column. These are
- // 0-width spaces.
- if (*(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2)
- p += 3;
- else if (*(pU+1)==0xbfU && *(pU+2)==0xbeU)
- p += 3;
- else if (*(pU+1)==0xbfU && *(pU+2)==0xbfU)
- p += 3;
- else
- { p +=3; ++col; } // A normal character.
- }
+ case TIXML_UTF_LEAD_0:
+ if (encoding == TIXML_ENCODING_UTF8) {
+ if (*(p + 1) && *(p + 2)) {
+ // In these cases, don't advance the column. These are
+ // 0-width spaces.
+ if (*(pU + 1) == TIXML_UTF_LEAD_1 && *(pU + 2) == TIXML_UTF_LEAD_2)
+ p += 3;
+ else if (*(pU + 1) == 0xbfU && *(pU + 2) == 0xbeU)
+ p += 3;
+ else if (*(pU + 1) == 0xbfU && *(pU + 2) == 0xbfU)
+ p += 3;
+ else {
+ p += 3; ++col;
+ } // A normal character.
}
- else
- {
- ++p;
- ++col;
- }
- break;
+ }
+ else {
+ ++p;
+ ++col;
+ }
+ break;
- default:
- if (encoding == TIXML_ENCODING_UTF8)
- {
- // Eat the 1 to 4 byte utf8 character.
- int step = TiXmlBase::utf8ByteTable[*((unsigned char*)p)];
- if (step == 0)
- step = 1; // Error case from bad encoding, but handle gracefully.
- p += step;
-
- // Just advance one column, of course.
- ++col;
- }
- else
- {
- ++p;
- ++col;
- }
- break;
+ default:
+ if (encoding == TIXML_ENCODING_UTF8) {
+ // Eat the 1 to 4 byte utf8 character.
+ int step = TiXmlBase::utf8ByteTable[*((unsigned char*)p)];
+ if (step == 0)
+ step = 1; // Error case from bad encoding, but handle gracefully.
+ p += step;
+
+ // Just advance one column, of course.
+ ++col;
+ }
+ else {
+ ++p;
+ ++col;
+ }
+ break;
}
}
cursor.row = row;
@@ -308,48 +302,41 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding)
const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding)
{
- if (!p || !*p)
- {
+ if (!p || !*p) {
return 0;
}
- if (encoding == TIXML_ENCODING_UTF8)
- {
- while (*p)
- {
+ if (encoding == TIXML_ENCODING_UTF8) {
+ while (*p) {
const unsigned char* pU = (const unsigned char*)p;
-
+
// Skip the stupid Microsoft UTF-8 Byte order marks
- if ( *(pU+0)==TIXML_UTF_LEAD_0
- && *(pU+1)==TIXML_UTF_LEAD_1
- && *(pU+2)==TIXML_UTF_LEAD_2)
- {
+ if (*(pU + 0) == TIXML_UTF_LEAD_0
+ && *(pU + 1) == TIXML_UTF_LEAD_1
+ && *(pU + 2) == TIXML_UTF_LEAD_2) {
p += 3;
continue;
}
- else if (*(pU+0)==TIXML_UTF_LEAD_0
- && *(pU+1)==0xbfU
- && *(pU+2)==0xbeU)
- {
+ else if (*(pU + 0) == TIXML_UTF_LEAD_0
+ && *(pU + 1) == 0xbfU
+ && *(pU + 2) == 0xbeU) {
p += 3;
continue;
}
- else if (*(pU+0)==TIXML_UTF_LEAD_0
- && *(pU+1)==0xbfU
- && *(pU+2)==0xbfU)
- {
+ else if (*(pU + 0) == TIXML_UTF_LEAD_0
+ && *(pU + 1) == 0xbfU
+ && *(pU + 2) == 0xbfU) {
p += 3;
continue;
}
- if (IsWhiteSpace(*p) || *p == '\n' || *p =='\r') // Still using old rules for white space.
+ if (IsWhiteSpace(*p) || *p == '\n' || *p == '\r') // Still using old rules for white space.
++p;
else
break;
}
}
- else
- {
- while (*p && IsWhiteSpace(*p) || *p == '\n' || *p =='\r')
+ else {
+ while (*p && IsWhiteSpace(*p) || *p == '\n' || *p == '\r')
++p;
}
@@ -359,8 +346,7 @@ const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding)
#ifdef TIXML_USE_STL
/*static*/ bool TiXmlBase::StreamWhiteSpace(TIXML_ISTREAM * in, TIXML_STRING * tag)
{
- for (;;)
- {
+ for (;;) {
if (!in->good()) return false;
int c = in->peek();
@@ -368,15 +354,14 @@ const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding)
if (!IsWhiteSpace(c) || c <= 0)
return true;
- *tag += (char) in->get();
+ *tag += (char)in->get();
}
}
/*static*/ bool TiXmlBase::StreamTo(TIXML_ISTREAM * in, int character, TIXML_STRING * tag)
{
//assert(character > 0 && character < 128); // else it won't work in utf-8
- while (in->good())
- {
+ while (in->good()) {
int c = in->peek();
if (c == character)
return true;
@@ -384,7 +369,7 @@ const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding)
return false;
in->get();
- *tag += (char) c;
+ *tag += (char)c;
}
return false;
}
@@ -402,16 +387,14 @@ const char* TiXmlBase::ReadName(const char* p, TIXML_STRING * name, TiXmlEncodin
// After that, they can be letters, underscores, numbers,
// hyphens, or colons. (Colons are valid ony for namespaces,
// but tinyxml can't tell namespaces from names.)
- if ( p && *p
- && (IsAlpha((unsigned char) *p, encoding) || *p == '_'))
- {
- while ( p && *p
- && ( IsAlphaNum((unsigned char) *p, encoding)
- || *p == '_'
- || *p == '-'
- || *p == '.'
- || *p == ':'))
- {
+ if (p && *p
+ && (IsAlpha((unsigned char)*p, encoding) || *p == '_')) {
+ while (p && *p
+ && (IsAlphaNum((unsigned char)*p, encoding)
+ || *p == '_'
+ || *p == '-'
+ || *p == '.'
+ || *p == ':')) {
(*name) += *p;
++p;
}
@@ -423,73 +406,66 @@ const char* TiXmlBase::ReadName(const char* p, TIXML_STRING * name, TiXmlEncodin
const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlEncoding encoding)
{
// Presume an entity, and pull it out.
- TIXML_STRING ent;
+ TIXML_STRING ent;
int i;
*length = 0;
- if (*(p+1) && *(p+1) == '#' && *(p+2))
- {
+ if (*(p + 1) && *(p + 1) == '#' && *(p + 2)) {
unsigned long ucs = 0;
ptrdiff_t delta = 0;
unsigned mult = 1;
- if (*(p+2) == 'x')
- {
+ if (*(p + 2) == 'x') {
// Hexadecimal.
- if (!*(p+3)) return 0;
+ if (!*(p + 3)) return 0;
- const char* q = p+3;
+ const char* q = p + 3;
q = strchr(q, ';');
if (!q || !*q) return 0;
- delta = q-p;
+ delta = q - p;
--q;
- while (*q != 'x')
- {
+ while (*q != 'x') {
if (*q >= '0' && *q <= '9')
ucs += mult * (*q - '0');
else if (*q >= 'a' && *q <= 'f')
ucs += mult * (*q - 'a' + 10);
else if (*q >= 'A' && *q <= 'F')
ucs += mult * (*q - 'A' + 10);
- else
+ else
return 0;
mult *= 16;
--q;
}
}
- else
- {
+ else {
// Decimal.
- if (!*(p+2)) return 0;
+ if (!*(p + 2)) return 0;
- const char* q = p+2;
+ const char* q = p + 2;
q = strchr(q, ';');
if (!q || !*q) return 0;
- delta = q-p;
+ delta = q - p;
--q;
- while (*q != '#')
- {
+ while (*q != '#') {
if (*q >= '0' && *q <= '9')
ucs += mult * (*q - '0');
- else
+ else
return 0;
mult *= 10;
--q;
}
}
- if (encoding == TIXML_ENCODING_UTF8)
- {
+ if (encoding == TIXML_ENCODING_UTF8) {
// convert the UCS to UTF-8
ConvertUTF32ToUTF8(ucs, value, length);
}
- else
- {
+ else {
*value = (char)ucs;
*length = 1;
}
@@ -497,10 +473,8 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE
}
// Now try to match it.
- for (i=0; i<NUM_ENTITY; ++i)
- {
- if (strncmp(entity[i].str, p, entity[i].strLength) == 0)
- {
+ for (i = 0; i < NUM_ENTITY; ++i) {
+ if (strncmp(entity[i].str, p, entity[i].strLength) == 0) {
assert(mir_strlen(entity[i].str) == entity[i].strLength);
*value = entity[i].chr;
*length = 1;
@@ -512,29 +486,26 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE
*value = *p; // Don't put back the last one, since we return it!
//*length = 1; // Leave unrecognized entities - this doesn't really work.
// Just writes strange XML.
- return p+1;
+ return p + 1;
}
bool TiXmlBase::StringEqual(const char* p,
- const char* tag,
- bool ignoreCase,
- TiXmlEncoding encoding)
+ const char* tag,
+ bool ignoreCase,
+ TiXmlEncoding encoding)
{
assert(p);
assert(tag);
- if (!p || !*p)
- {
+ if (!p || !*p) {
assert(0);
return false;
}
const char* q = p;
- if (ignoreCase)
- {
- while (*q && *tag && ToLower(*q, encoding) == ToLower(*tag, encoding))
- {
+ if (ignoreCase) {
+ while (*q && *tag && ToLower(*q, encoding) == ToLower(*tag, encoding)) {
++q;
++tag;
}
@@ -542,10 +513,8 @@ bool TiXmlBase::StringEqual(const char* p,
if (*tag == 0)
return true;
}
- else
- {
- while (*q && *tag && *q == *tag)
- {
+ else {
+ while (*q && *tag && *q == *tag) {
++q;
++tag;
}
@@ -556,53 +525,46 @@ bool TiXmlBase::StringEqual(const char* p,
return false;
}
-const char* TiXmlBase::ReadText( const char* p,
- TIXML_STRING * text,
- bool trimWhiteSpace,
- const char* endTag,
- bool caseInsensitive,
- TiXmlEncoding encoding)
+const char* TiXmlBase::ReadText(const char* p,
+ TIXML_STRING * text,
+ bool trimWhiteSpace,
+ const char* endTag,
+ bool caseInsensitive,
+ TiXmlEncoding encoding)
{
- *text = "";
- if ( !trimWhiteSpace // certain tags always keep whitespace
- || !condenseWhiteSpace) // if true, whitespace is always kept
+ *text = "";
+ if (!trimWhiteSpace // certain tags always keep whitespace
+ || !condenseWhiteSpace) // if true, whitespace is always kept
{
// Keep all the white space.
- while ( p && *p
- && !StringEqual(p, endTag, caseInsensitive, encoding)
- )
- {
+ while (p && *p
+ && !StringEqual(p, endTag, caseInsensitive, encoding)
+ ) {
int len;
char cArr[4] = { 0, 0, 0, 0 };
p = GetChar(p, cArr, &len, encoding);
text->append(cArr, len);
}
}
- else
- {
+ else {
bool whitespace = false;
// Remove leading white space:
p = SkipWhiteSpace(p, encoding);
- while ( p && *p
- && !StringEqual(p, endTag, caseInsensitive, encoding))
- {
- if (*p == '\r' || *p == '\n')
- {
+ while (p && *p
+ && !StringEqual(p, endTag, caseInsensitive, encoding)) {
+ if (*p == '\r' || *p == '\n') {
whitespace = true;
++p;
}
- else if (IsWhiteSpace(*p))
- {
+ else if (IsWhiteSpace(*p)) {
whitespace = true;
++p;
}
- else
- {
+ else {
// If we've found whitespace, add it before the
// new character. Any whitespace just becomes a space.
- if (whitespace)
- {
+ if (whitespace) {
(*text) += ' ';
whitespace = false;
}
@@ -630,35 +592,29 @@ void TiXmlDocument::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
// This "pre-streaming" will never read the closing ">" so the
// sub-tag can orient itself.
- if (!StreamTo(in, '<', tag))
- {
+ if (!StreamTo(in, '<', tag)) {
SetError(TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- while (in->good())
- {
- int tagIndex = (int) tag->length();
- while (in->good() && in->peek() != '>')
- {
+ while (in->good()) {
+ int tagIndex = (int)tag->length();
+ while (in->good() && in->peek() != '>') {
int c = in->get();
- if (c <= 0)
- {
+ if (c <= 0) {
SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
break;
}
- (*tag) += (char) c;
+ (*tag) += (char)c;
}
- if (in->good())
- {
+ if (in->good()) {
// We now have something we presume to be a node of
// some sort. Identify it, and call the node to
// continue streaming.
TiXmlNode* node = Identify(tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING);
- if (node)
- {
+ if (node) {
node->StreamIn(in, tag);
bool isElement = node->ToElement() != 0;
delete node;
@@ -666,13 +622,11 @@ void TiXmlDocument::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
// If this is the root element, we're done. Parsing will be
// done by the >> operator.
- if (isElement)
- {
+ if (isElement) {
return;
}
}
- else
- {
+ else {
SetError(TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
@@ -691,8 +645,7 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm
// Parse away, at the document level. Since a document
// contains nothing but other tags, most of what happens
// here is skipping white space.
- if (!p || !*p)
- {
+ if (!p || !*p) {
SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
return 0;
}
@@ -701,56 +654,47 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm
// before the while space skip, so that parsing
// starts from the pointer we are given.
location.Clear();
- if (prevData)
- {
+ if (prevData) {
location.row = prevData->cursor.row;
location.col = prevData->cursor.col;
}
- else
- {
+ else {
location.row = 0;
location.col = 0;
}
TiXmlParsingData data(p, TabSize(), location.row, location.col);
location = data.Cursor();
- if (encoding == TIXML_ENCODING_UNKNOWN)
- {
+ if (encoding == TIXML_ENCODING_UNKNOWN) {
// Check for the Microsoft UTF-8 lead bytes.
const unsigned char* pU = (const unsigned char*)p;
- if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
- && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
- && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2)
- {
+ if (*(pU + 0) && *(pU + 0) == TIXML_UTF_LEAD_0
+ && *(pU + 1) && *(pU + 1) == TIXML_UTF_LEAD_1
+ && *(pU + 2) && *(pU + 2) == TIXML_UTF_LEAD_2) {
encoding = TIXML_ENCODING_UTF8;
useMicrosoftBOM = true;
}
}
- p = SkipWhiteSpace(p, encoding);
- if (!p)
- {
+ p = SkipWhiteSpace(p, encoding);
+ if (!p) {
SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
return 0;
}
- while (p && *p)
- {
+ while (p && *p) {
TiXmlNode* node = Identify(p, encoding);
- if (node)
- {
+ if (node) {
p = node->Parse(p, &data, encoding);
LinkEndChild(node);
}
- else
- {
+ else {
break;
}
// Did we get encoding info?
- if ( encoding == TIXML_ENCODING_UNKNOWN
- && node->ToDeclaration())
- {
+ if (encoding == TIXML_ENCODING_UNKNOWN
+ && node->ToDeclaration()) {
TiXmlDeclaration* dec = node->ToDeclaration();
const char* enc = dec->Encoding();
assert(enc);
@@ -761,7 +705,7 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm
encoding = TIXML_ENCODING_UTF8;
else if (StringEqual(enc, "UTF8", true, TIXML_ENCODING_UNKNOWN))
encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice
- else
+ else
encoding = TIXML_ENCODING_LEGACY;
}
@@ -779,19 +723,18 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm
}
void TiXmlDocument::SetError(int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding)
-{
+{
// The first error in a chain is more accurate - don't set again!
if (error)
return;
assert(err > 0 && err < TIXML_ERROR_STRING_COUNT);
- error = true;
+ error = true;
errorId = err;
- errorDesc = errorString[ errorId ];
+ errorDesc = errorString[errorId];
errorLocation.Clear();
- if (pError && data)
- {
+ if (pError && data) {
data->Stamp(pError, encoding);
errorLocation = data->Cursor();
}
@@ -803,16 +746,14 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding)
TiXmlNode* returnNode = 0;
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p || *p != '<')
- {
+ if (!p || !*p || *p != '<') {
return 0;
}
TiXmlDocument* doc = GetDocument();
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p)
- {
+ if (!p || !*p) {
return 0;
}
@@ -828,59 +769,51 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding)
const char* dtdHeader = { "<!" };
const char* cdataHeader = { "<![CDATA[" };
- if (StringEqual(p, xmlHeader, true, encoding))
- {
+ if (StringEqual(p, xmlHeader, true, encoding)) {
#ifdef DEBUG_PARSER
- TIXML_LOG("XML parsing Declaration\n");
+ TIXML_LOG("XML parsing Declaration\n");
#endif
returnNode = new TiXmlDeclaration();
}
- else if (StringEqual(p, commentHeader, false, encoding))
- {
+ else if (StringEqual(p, commentHeader, false, encoding)) {
#ifdef DEBUG_PARSER
- TIXML_LOG("XML parsing Comment\n");
+ TIXML_LOG("XML parsing Comment\n");
#endif
returnNode = new TiXmlComment();
}
- else if (StringEqual(p, cdataHeader, false, encoding))
- {
+ else if (StringEqual(p, cdataHeader, false, encoding)) {
#ifdef DEBUG_PARSER
- TIXML_LOG("XML parsing CDATA\n");
+ TIXML_LOG("XML parsing CDATA\n");
#endif
TiXmlText* text = new TiXmlText("");
text->SetCDATA(true);
returnNode = text;
}
- else if (StringEqual(p, dtdHeader, false, encoding))
- {
+ else if (StringEqual(p, dtdHeader, false, encoding)) {
#ifdef DEBUG_PARSER
- TIXML_LOG("XML parsing Unknown(1)\n");
+ TIXML_LOG("XML parsing Unknown(1)\n");
#endif
returnNode = new TiXmlUnknown();
}
- else if ( IsAlpha(*(p+1), encoding)
- || *(p+1) == '_')
- {
+ else if (IsAlpha(*(p + 1), encoding)
+ || *(p + 1) == '_') {
#ifdef DEBUG_PARSER
- TIXML_LOG("XML parsing Element\n");
+ TIXML_LOG("XML parsing Element\n");
#endif
returnNode = new TiXmlElement("");
}
- else
- {
+ else {
#ifdef DEBUG_PARSER
- TIXML_LOG("XML parsing Unknown(2)\n");
+ TIXML_LOG("XML parsing Unknown(2)\n");
#endif
returnNode = new TiXmlUnknown();
}
- if (returnNode)
- {
+ if (returnNode) {
// Set the parent, so it can report errors
returnNode->parent = this;
}
- else
- {
+ else {
if (doc)
doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN);
}
@@ -889,22 +822,20 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding)
#ifdef TIXML_USE_STL
-void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
+void TiXmlElement::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
{
// We're called with some amount of pre-parsing. That is, some of "this"
// element is in "tag". Go ahead and stream to the closing ">"
- while (in->good())
- {
+ while (in->good()) {
int c = in->get();
- if (c <= 0)
- {
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- (*tag) += (char) c ;
-
+ (*tag) += (char)c;
+
if (c == '>')
break;
}
@@ -914,25 +845,21 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
// If not, identify and stream.
- if ( tag->at(tag->length() - 1) == '>'
- && tag->at(tag->length() - 2) == '/')
- {
+ if (tag->at(tag->length() - 1) == '>'
+ && tag->at(tag->length() - 2) == '/') {
// All good!
return;
}
- else if (tag->at(tag->length() - 1) == '>')
- {
+ else if (tag->at(tag->length() - 1) == '>') {
// There is more. Could be:
// text
// closing tag
// another node.
- for (;;)
- {
+ for (;;) {
StreamWhiteSpace(in, tag);
// Do we have text?
- if (in->good() && in->peek() != '<')
- {
+ if (in->good() && in->peek() != '<') {
// Yep, text.
TiXmlText text("");
text.StreamIn(in, tag);
@@ -946,33 +873,30 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
// We should be at a "<", regardless.
if (!in->good()) return;
assert(in->peek() == '<');
- int tagIndex = (int) tag->length();
+ int tagIndex = (int)tag->length();
bool closingTag = false;
bool firstCharFound = false;
- for (;;)
- {
+ for (;;) {
if (!in->good())
return;
int c = in->peek();
- if (c <= 0)
- {
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
-
+
if (c == '>')
break;
- *tag += (char) c;
+ *tag += (char)c;
in->get();
- if (!firstCharFound && c != '<' && !IsWhiteSpace(c))
- {
+ if (!firstCharFound && c != '<' && !IsWhiteSpace(c)) {
firstCharFound = true;
if (c == '/')
closingTag = true;
@@ -980,27 +904,24 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
}
// If it was a closing tag, then read in the closing '>' to clean up the input stream.
// If it was not, the streaming will be done by the tag.
- if (closingTag)
- {
+ if (closingTag) {
if (!in->good())
return;
int c = in->get();
- if (c <= 0)
- {
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
assert(c == '>');
- *tag += (char) c;
+ *tag += (char)c;
// We are done, once we've found our closing tag.
return;
}
- else
- {
+ else {
// If not a closing tag, id it, and stream.
const char* tagloc = tag->c_str() + tagIndex;
TiXmlNode* node = Identify(tagloc, TIXML_DEFAULT_ENCODING);
@@ -1022,64 +943,55 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco
p = SkipWhiteSpace(p, encoding);
TiXmlDocument* document = GetDocument();
- if (!p || !*p)
- {
+ if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding);
return 0;
}
- if (data)
- {
+ if (data) {
data->Stamp(p, encoding);
location = data->Cursor();
}
- if (*p != '<')
- {
+ if (*p != '<') {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, p, data, encoding);
return 0;
}
- p = SkipWhiteSpace(p+1, encoding);
+ p = SkipWhiteSpace(p + 1, encoding);
// Read the name.
const char* pErr = p;
- p = ReadName(p, &value, encoding);
- if (!p || !*p)
- {
+ p = ReadName(p, &value, encoding);
+ if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding);
return 0;
}
- TIXML_STRING endTag ("</");
+ TIXML_STRING endTag("</");
endTag += value;
endTag += ">";
// Check for and read attributes. Also look for an empty
// tag or an end tag.
- while (p && *p)
- {
+ while (p && *p) {
pErr = p;
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p)
- {
+ if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
return 0;
}
- if (*p == '/')
- {
+ if (*p == '/') {
++p;
// Empty tag.
- if (*p != '>')
- {
- if (document) document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding);
+ if (*p != '>') {
+ if (document) document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding);
return 0;
}
- return (p+1);
+ return (p + 1);
}
- else if (*p == '>')
- {
+ else if (*p == '>') {
// Done with attributes (if there were any.)
// Read the value -- which can include other
// elements -- read the end tag, and return.
@@ -1089,33 +1001,28 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco
return 0;
// We should find the end tag now
- if (StringEqual(p, endTag.c_str(), false, encoding))
- {
+ if (StringEqual(p, endTag.c_str(), false, encoding)) {
p += endTag.length();
return p;
}
- else
- {
+ else {
if (document) document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding);
return 0;
}
}
- else
- {
+ else {
// Try to read an attribute:
TiXmlAttribute* attrib = new TiXmlAttribute();
- if (!attrib)
- {
+ if (!attrib) {
if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding);
return 0;
}
attrib->SetDocument(document);
- const char* pErr = p;
+ pErr = p;
p = attrib->Parse(p, data, encoding);
- if (!p || !*p)
- {
+ if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding);
delete attrib;
return 0;
@@ -1123,8 +1030,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco
// Handle the strange case of double attributes:
TiXmlAttribute* node = attributeSet.Find(attrib->NameTStr());
- if (node)
- {
+ if (node) {
node->SetValue(attrib->Value());
delete attrib;
return 0;
@@ -1145,25 +1051,20 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml
const char* pWithWhiteSpace = p;
p = SkipWhiteSpace(p, encoding);
- while (p && *p)
- {
- if (*p != '<')
- {
+ while (p && *p) {
+ if (*p != '<') {
// Take what we have, make a text element.
TiXmlText* textNode = new TiXmlText("");
- if (!textNode)
- {
+ if (!textNode) {
if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding);
- return 0;
+ return 0;
}
- if (TiXmlBase::IsWhiteSpaceCondensed())
- {
+ if (TiXmlBase::IsWhiteSpaceCondensed()) {
p = textNode->Parse(p, data, encoding);
}
- else
- {
+ else {
// Special case: we want to keep the white space
// so that leading spaces aren't removed.
p = textNode->Parse(pWithWhiteSpace, data, encoding);
@@ -1173,26 +1074,21 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml
LinkEndChild(textNode);
else
delete textNode;
- }
- else
- {
+ }
+ else {
// We hit a '<'
// Have we hit a new element or an end tag? This could also be
// a TiXmlText in the "CDATA" style.
- if (StringEqual(p, "</", false, encoding))
- {
+ if (StringEqual(p, "</", false, encoding)) {
return p;
}
- else
- {
+ else {
TiXmlNode* node = Identify(p, encoding);
- if (node)
- {
+ if (node) {
p = node->Parse(p, data, encoding);
LinkEndChild(node);
- }
- else
- {
+ }
+ else {
return 0;
}
}
@@ -1201,10 +1097,9 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml
p = SkipWhiteSpace(p, encoding);
}
- if (!p)
- {
+ if (!p) {
if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding);
- }
+ }
return p;
}
@@ -1212,22 +1107,19 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml
#ifdef TIXML_USE_STL
void TiXmlUnknown::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
{
- while (in->good())
- {
- int c = in->get();
- if (c <= 0)
- {
+ while (in->good()) {
+ int c = in->get();
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- (*tag) += (char) c;
+ (*tag) += (char)c;
- if (c == '>')
- {
+ if (c == '>') {
// All is well.
- return;
+ return;
}
}
}
@@ -1239,56 +1131,49 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco
TiXmlDocument* document = GetDocument();
p = SkipWhiteSpace(p, encoding);
- if (data)
- {
+ if (data) {
data->Stamp(p, encoding);
location = data->Cursor();
}
- if (!p || !*p || *p != '<')
- {
+ if (!p || !*p || *p != '<') {
if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding);
return 0;
}
++p;
- value = "";
+ value = "";
- while (p && *p && *p != '>')
- {
+ while (p && *p && *p != '>') {
value += *p;
++p;
}
- if (!p)
- {
+ if (!p) {
if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding);
}
if (*p == '>')
- return p+1;
+ return p + 1;
return p;
}
#ifdef TIXML_USE_STL
void TiXmlComment::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
{
- while (in->good())
- {
- int c = in->get();
- if (c <= 0)
- {
+ while (in->good()) {
+ int c = in->get();
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- (*tag) += (char) c;
+ (*tag) += (char)c;
- if (c == '>'
- && tag->at(tag->length() - 2) == '-'
- && tag->at(tag->length() - 3) == '-')
- {
+ if (c == '>'
+ && tag->at(tag->length() - 2) == '-'
+ && tag->at(tag->length() - 3) == '-') {
// All is well.
- return;
+ return;
}
}
}
@@ -1302,16 +1187,14 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco
p = SkipWhiteSpace(p, encoding);
- if (data)
- {
+ if (data) {
data->Stamp(p, encoding);
location = data->Cursor();
}
const char* startTag = "<!--";
- const char* endTag = "-->";
+ const char* endTag = "-->";
- if (!StringEqual(p, startTag, false, encoding))
- {
+ if (!StringEqual(p, startTag, false, encoding)) {
document->SetError(TIXML_ERROR_PARSING_COMMENT, p, data, encoding);
return 0;
}
@@ -1326,63 +1209,56 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn
p = SkipWhiteSpace(p, encoding);
if (!p || !*p) return 0;
-// int tabsize = 4;
-// if (document)
-// tabsize = document->TabSize();
+ // int tabsize = 4;
+ // if (document)
+ // tabsize = document->TabSize();
- if (data)
- {
+ if (data) {
data->Stamp(p, encoding);
location = data->Cursor();
}
// Read the name, the '=' and the value.
const char* pErr = p;
p = ReadName(p, &name, encoding);
- if (!p || !*p)
- {
+ if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
return 0;
}
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p || *p != '=')
- {
+ if (!p || !*p || *p != '=') {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
return 0;
}
++p; // skip '='
p = SkipWhiteSpace(p, encoding);
- if (!p || !*p)
- {
+ if (!p || !*p) {
if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding);
return 0;
}
-
+
const char* end;
const char SINGLE_QUOTE = '\'';
const char DOUBLE_QUOTE = '\"';
- if (*p == SINGLE_QUOTE)
- {
+ if (*p == SINGLE_QUOTE) {
++p;
end = "\'"; // single quote in string
p = ReadText(p, &value, false, end, false, encoding);
}
- else if (*p == DOUBLE_QUOTE)
- {
+ else if (*p == DOUBLE_QUOTE) {
++p;
end = "\""; // double quote in string
p = ReadText(p, &value, false, end, false, encoding);
}
- else
- {
+ else {
// All attribute values should be in single or double quotes.
// But this is such a common error that the parser will try
// its best, even without them.
value = "";
- while ( p && *p // existence
- && !IsWhiteSpace(*p) && *p != '\n' && *p != '\r' // whitespace
- && *p != '/' && *p != '>') // tag end
+ while (p && *p // existence
+ && !IsWhiteSpace(*p) && *p != '\n' && *p != '\r' // whitespace
+ && *p != '/' && *p != '>') // tag end
{
if (*p == SINGLE_QUOTE || *p == DOUBLE_QUOTE) {
// [ 1451649 ] Attribute values with trailing quotes not handled correctly
@@ -1401,43 +1277,37 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn
#ifdef TIXML_USE_STL
void TiXmlText::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
{
- if (cdata)
- {
- int c = in->get();
- if (c <= 0)
- {
+ if (cdata) {
+ int c = in->get();
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- (*tag) += (char) c;
+ (*tag) += (char)c;
- if (c == '>'
- && tag->at(tag->length() - 2) == ']'
- && tag->at(tag->length() - 3) == ']')
- {
+ if (c == '>'
+ && tag->at(tag->length() - 2) == ']'
+ && tag->at(tag->length() - 3) == ']') {
// All is well.
- return;
+ return;
}
}
- else
- {
- while (in->good())
- {
- int c = in->peek();
+ else {
+ while (in->good()) {
+ int c = in->peek();
if (c == '<')
return;
- if (c <= 0)
- {
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- (*tag) += (char) c;
+ (*tag) += (char)c;
in->get();
}
}
@@ -1449,47 +1319,42 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin
value = "";
TiXmlDocument* document = GetDocument();
- if (data)
- {
+ if (data) {
data->Stamp(p, encoding);
location = data->Cursor();
}
const char* const startTag = "<![CDATA[";
- const char* const endTag = "]]>";
+ const char* const endTag = "]]>";
- if (cdata || StringEqual(p, startTag, false, encoding))
- {
+ if (cdata || StringEqual(p, startTag, false, encoding)) {
cdata = true;
- if (!StringEqual(p, startTag, false, encoding))
- {
+ if (!StringEqual(p, startTag, false, encoding)) {
document->SetError(TIXML_ERROR_PARSING_CDATA, p, data, encoding);
return 0;
}
p += mir_strlen(startTag);
// Keep all the white space, ignore the encoding, etc.
- while ( p && *p
- && !StringEqual(p, endTag, false, encoding)
- )
- {
+ while (p && *p
+ && !StringEqual(p, endTag, false, encoding)
+ ) {
value += *p;
++p;
}
- TIXML_STRING dummy;
+ TIXML_STRING dummy;
p = ReadText(p, &dummy, false, endTag, false, encoding);
return p;
}
- else
- {
+ else {
bool ignoreWhite = true;
const char* end = "<";
p = ReadText(p, &value, ignoreWhite, end, false, encoding);
if (p)
- return p-1; // don't truncate the '<'
+ return p - 1; // don't truncate the '<'
return 0;
}
}
@@ -1497,20 +1362,17 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin
#ifdef TIXML_USE_STL
void TiXmlDeclaration::StreamIn(TIXML_ISTREAM * in, TIXML_STRING * tag)
{
- while (in->good())
- {
+ while (in->good()) {
int c = in->get();
- if (c <= 0)
- {
+ if (c <= 0) {
TiXmlDocument* document = GetDocument();
if (document)
document->SetError(TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN);
return;
}
- (*tag) += (char) c;
+ (*tag) += (char)c;
- if (c == '>')
- {
+ if (c == '>') {
// All is well.
return;
}
@@ -1524,13 +1386,11 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml
// Find the beginning, find the end, and look for
// the stuff in-between.
TiXmlDocument* document = GetDocument();
- if (!p || !*p || !StringEqual(p, "<?xml", true, _encoding))
- {
+ if (!p || !*p || !StringEqual(p, "<?xml", true, _encoding)) {
if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding);
return 0;
}
- if (data)
- {
+ if (data) {
data->Stamp(p, _encoding);
location = data->Cursor();
}
@@ -1540,35 +1400,29 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml
encoding = "";
standalone = "";
- while (p && *p)
- {
- if (*p == '>')
- {
+ while (p && *p) {
+ if (*p == '>') {
++p;
return p;
}
p = SkipWhiteSpace(p, _encoding);
- if (StringEqual(p, "version", true, _encoding))
- {
+ if (StringEqual(p, "version", true, _encoding)) {
TiXmlAttribute attrib;
- p = attrib.Parse(p, data, _encoding);
+ p = attrib.Parse(p, data, _encoding);
version = attrib.Value();
}
- else if (StringEqual(p, "encoding", true, _encoding))
- {
+ else if (StringEqual(p, "encoding", true, _encoding)) {
TiXmlAttribute attrib;
- p = attrib.Parse(p, data, _encoding);
+ p = attrib.Parse(p, data, _encoding);
encoding = attrib.Value();
}
- else if (StringEqual(p, "standalone", true, _encoding))
- {
+ else if (StringEqual(p, "standalone", true, _encoding)) {
TiXmlAttribute attrib;
- p = attrib.Parse(p, data, _encoding);
+ p = attrib.Parse(p, data, _encoding);
standalone = attrib.Value();
}
- else
- {
+ else {
// Read over whatever it is.
while (p && *p && *p != '>' && !IsWhiteSpace(*p))
++p;
@@ -1579,9 +1433,8 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml
bool TiXmlText::Blank() const
{
- for (unsigned i=0; i<value.length(); i++)
+ for (unsigned i = 0; i < value.length(); i++)
if (!IsWhiteSpace(value[i]))
return false;
return true;
}
-
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index 2898d3980a..7b5ed883ec 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -386,23 +386,26 @@ BYTE ConvertString(DBVARIANT* dbv, const BYTE destType)
if (dbv == NULL)
return 1;
- LPSTR tmpBuf;
switch (dbv->type) {
// source value is of type "ascii"
case DBVT_ASCIIZ:
switch (destType) {
// destination type is "utf8"
case DBVT_UTF8:
- tmpBuf = mir_utf8encode(dbv->pszVal);
- mir_free(dbv->pszVal);
- dbv->pszVal = tmpBuf;
+ {
+ LPSTR tmpBuf = mir_utf8encode(dbv->pszVal);
+ mir_free(dbv->pszVal);
+ dbv->pszVal = tmpBuf;
+ }
dbv->type = (dbv->pszVal) ? destType : DBVT_DELETED;
break;
// destination type is "wchar"
case DBVT_WCHAR:
- LPWSTR tmpBuf = mir_a2u(dbv->pszVal);
- mir_free(dbv->pszVal);
- dbv->pwszVal = tmpBuf;
+ {
+ LPWSTR tmpBuf = mir_a2u(dbv->pszVal);
+ mir_free(dbv->pszVal);
+ dbv->pwszVal = tmpBuf;
+ }
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
}
break;
@@ -425,19 +428,23 @@ BYTE ConvertString(DBVARIANT* dbv, const BYTE destType)
break;
// source value is of type "wchar"
case DBVT_WCHAR:
- switch (destType) {
- // destination type is "ascii"
+ switch (destType) {
+ // destination type is "ascii"
case DBVT_ASCIIZ:
- tmpBuf = mir_u2a(dbv->pwszVal);
- mir_free(dbv->pwszVal);
- dbv->pszVal = tmpBuf;
+ {
+ LPSTR tmpBuf = mir_u2a(dbv->pwszVal);
+ mir_free(dbv->pwszVal);
+ dbv->pszVal = tmpBuf;
+ }
dbv->type = (dbv->pszVal) ? destType : DBVT_DELETED;
break;
- // destination type is "utf8"
+ // destination type is "utf8"
case DBVT_UTF8:
- tmpBuf = mir_utf8encodeW(dbv->pwszVal);
- mir_free(dbv->pwszVal);
- dbv->pszVal = tmpBuf;
+ {
+ LPSTR tmpBuf = mir_utf8encodeW(dbv->pwszVal);
+ mir_free(dbv->pwszVal);
+ dbv->pszVal = tmpBuf;
+ }
dbv->type = (dbv->pszVal) ? destType : DBVT_DELETED;
}
}
@@ -459,8 +466,9 @@ BYTE dbv2String(DBVARIANT* dbv, const BYTE destType)
if (dbv == NULL)
return 1;
- switch (destType) {
+ WCHAR wbuf[32];
CHAR buf[32];
+ switch (destType) {
// destination type is "utf8" or "ascii"
case DBVT_ASCIIZ:
case DBVT_UTF8:
@@ -494,23 +502,22 @@ BYTE dbv2String(DBVARIANT* dbv, const BYTE destType)
// destination type is "wchar"
case DBVT_WCHAR:
switch (dbv->type) {
- WCHAR buf[32];
// source value is of type "byte"
case DBVT_BYTE:
- _ultow(dbv->bVal, buf, 10);
- dbv->pwszVal = mir_wstrdup(buf);
+ _ultow(dbv->bVal, wbuf, 10);
+ dbv->pwszVal = mir_wstrdup(wbuf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of type "word"
case DBVT_WORD:
- _ultow(dbv->wVal, buf, 10);
- dbv->pwszVal = mir_wstrdup(buf);
+ _ultow(dbv->wVal, wbuf, 10);
+ dbv->pwszVal = mir_wstrdup(wbuf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of type "dword"
case DBVT_DWORD:
- _ultow(dbv->dVal, buf, 10);
- dbv->pwszVal = mir_wstrdup(buf);
+ _ultow(dbv->dVal, wbuf, 10);
+ dbv->pwszVal = mir_wstrdup(wbuf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of any string type
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp
index e634756e2f..8683a347c7 100644
--- a/plugins/UserInfoEx/src/psp_anniversary.cpp
+++ b/plugins/UserInfoEx/src/psp_anniversary.cpp
@@ -248,7 +248,6 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
case RADIO_REMIND1:
case RADIO_REMIND2:
case RADIO_REMIND3:
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
if (PtrIsValid(pDateCtrl) && HIWORD(wParam) == BN_CLICKED)
pDateCtrl->OnReminderChecked();
return FALSE;
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp
index 2182d60ce1..eb4e36d3b2 100644
--- a/plugins/Utils/mir_options.cpp
+++ b/plugins/Utils/mir_options.cpp
@@ -71,7 +71,7 @@ static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)
if (dbPath[0] == _T('\0')) {
char tmp[1024];
CallService(MS_DB_GETPROFILEPATH, _countof(tmp), (LPARAM)tmp);
- mir_sntprintf(dbPath, _countof(dbPath), _T("%S\\"), tmp);
+ mir_sntprintf(dbPath, _T("%S\\"), tmp);
}
size_t len = mir_tstrlen(dbPath);
@@ -89,7 +89,7 @@ static void PathToAbsolute(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)
if (dbPath[0] == _T('\0')) {
char tmp[1024];
CallService(MS_DB_GETPROFILEPATH, _countof(tmp), (LPARAM)tmp);
- mir_sntprintf(dbPath, _countof(dbPath), _T("%S\\"), tmp);
+ mir_sntprintf(dbPath, _T("%S\\"), tmp);
}
mir_sntprintf(pOut, outSize, _T("%s%s"), dbPath, pSrc);
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index f110ab27d9..3ab77baea8 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -73,7 +73,8 @@ static builtinCnfs[] =
{ CCNF_PROTOID, STR_PROTOID }
};
-typedef struct {
+typedef struct
+{
TCHAR* tszContact;
MCONTACT hContact;
DWORD flags;
@@ -91,11 +92,11 @@ static HANDLE hContactSettingChangedHook;
*/
BYTE getContactInfoType(TCHAR* type)
{
- if (type == NULL || mir_tstrlen(type) == 0 )
+ if (type == NULL || mir_tstrlen(type) == 0)
return 0;
- for (int i=0; i < _countof(builtinCnfs); i++ )
- if (!mir_tstrcmp( builtinCnfs[i].str, type ))
+ for (int i = 0; i < _countof(builtinCnfs); i++)
+ if (!mir_tstrcmp(builtinCnfs[i].str, type))
return builtinCnfs[i].cnfCode;
return 0;
@@ -119,17 +120,19 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
case CCNF_PROTOID:
return mir_a2t(szProto);
- case CCNF_ACCOUNT: {
- PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- return pa ? mir_tstrdup(pa->tszAccountName) : NULL;
- }
+ case CCNF_ACCOUNT:
+ {
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
+ return pa ? mir_tstrdup(pa->tszAccountName) : NULL;
+ }
- case CCNF_PROTOCOL: {
- char protoname[128];
- if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
- return NULL;
- return mir_a2t(protoname);
- }
+ case CCNF_PROTOCOL:
+ {
+ char protoname[128];
+ if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
+ return NULL;
+ return mir_a2t(protoname);
+ }
case CCNF_STATUS:
return mir_tstrdup(pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0));
@@ -143,7 +146,7 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
struct in_addr in;
in.s_addr = htonl(ip);
- return mir_a2t( inet_ntoa(in));
+ return mir_a2t(inet_ntoa(in));
}
case CCNF_GROUP:
@@ -165,10 +168,10 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
ci.hContact = hContact;
ci.dwFlag = type | CNF_UNICODE;
CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
-
+
char szVal[16];
memset(szVal, '\0', sizeof(szVal));
- switch(ci.type) {
+ switch (ci.type) {
case CNFT_BYTE:
if (type == CNF_GENDER) {
szVal[0] = (char)ci.bVal; szVal[1] = 0;
@@ -214,7 +217,7 @@ int getContactFromString(CONTACTSINFO *ci)
/* search the cache */
{
mir_cslock lck(csContactCache);
- for (int i=0; i < cacheSize; i++) {
+ for (int i = 0; i < cacheSize; i++) {
if ((!mir_tstrcmp(cce[i].tszContact, tszContact)) && (ci->flags == cce[i].flags)) {
/* found in cache */
ci->hContacts = (MCONTACT*)mir_alloc(sizeof(MCONTACT));
@@ -228,21 +231,20 @@ int getContactFromString(CONTACTSINFO *ci)
}
/* contact was not in cache, do a search */
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- {
- TCHAR *szFind = NULL;
- BOOL bMatch = FALSE;
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ bool bMatch = false;
// <_HANDLE_:hContact>
- size_t size = mir_tstrlen(_T(PROTOID_HANDLE)) + 36;
- szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
- if (szFind != NULL)
{
- mir_sntprintf(szFind, size, _T("<%s:%p>"), _T(PROTOID_HANDLE), hContact);
- if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact)))
- bMatch = TRUE;
+ size_t size = mir_tstrlen(_T(PROTOID_HANDLE)) + 36;
+ TCHAR *szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
+ if (szFind != NULL) {
+ mir_sntprintf(szFind, size, _T("<%s:%p>"), _T(PROTOID_HANDLE), hContact);
+ if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact)))
+ bMatch = true;
- mir_free(szFind);
+ mir_free(szFind);
+ }
}
char *szProto = GetContactProto(hContact);
@@ -250,82 +252,80 @@ int getContactFromString(CONTACTSINFO *ci)
continue;
// <proto:id> (exact)
- if ((ci->flags & CI_PROTOID) && !bMatch)
- {
+ if ((ci->flags & CI_PROTOID) && !bMatch) {
TCHAR *cInfo = getContactInfoT(CNF_UNIQUEID, hContact);
- if (cInfo)
- {
+ if (cInfo) {
size_t size = mir_tstrlen(cInfo) + mir_strlen(szProto) + 4;
- szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
+ TCHAR *szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
if (szFind != NULL) {
mir_sntprintf(szFind, size, _T("<%S:%s>"), szProto, cInfo);
mir_free(cInfo);
if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact)))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
}
// id (exact)
if ((ci->flags & CI_UNIQUEID) && (!bMatch)) {
- szFind = getContactInfoT(CNF_UNIQUEID, hContact);
+ TCHAR *szFind = getContactInfoT(CNF_UNIQUEID, hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
// nick (not exact)
if ((ci->flags & CI_NICK) && (!bMatch)) {
- szFind = getContactInfoT(CNF_NICK, hContact);
+ TCHAR *szFind = getContactInfoT(CNF_NICK, hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
// list name (not exact)
if ((ci->flags & CI_LISTNAME) && (!bMatch)) {
- szFind = getContactInfoT(CNF_DISPLAY, hContact);
+ TCHAR *szFind = getContactInfoT(CNF_DISPLAY, hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
// firstname (exact)
if ((ci->flags & CI_FIRSTNAME) && (!bMatch)) {
- szFind = getContactInfoT(CNF_FIRSTNAME, hContact);
+ TCHAR *szFind = getContactInfoT(CNF_FIRSTNAME, hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
// lastname (exact)
if ((ci->flags & CI_LASTNAME) && (!bMatch)) {
- szFind = getContactInfoT(CNF_LASTNAME, hContact);
+ TCHAR *szFind = getContactInfoT(CNF_LASTNAME, hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
// email (exact)
if ((ci->flags & CI_EMAIL) && (!bMatch)) {
- szFind = getContactInfoT(CNF_EMAIL, hContact);
+ TCHAR *szFind = getContactInfoT(CNF_EMAIL, hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
// CNF_ (exact)
if ((ci->flags & CI_CNFINFO) && (!bMatch)) {
- szFind = getContactInfoT((BYTE)(ci->flags&~(CI_CNFINFO|CI_TCHAR)), hContact);
+ TCHAR *szFind = getContactInfoT((BYTE)(ci->flags&~(CI_CNFINFO | CI_TCHAR)), hContact);
if (szFind != NULL) {
if (!mir_tstrcmp(tszContact, szFind))
- bMatch = TRUE;
+ bMatch = true;
mir_free(szFind);
}
}
@@ -341,7 +341,7 @@ int getContactFromString(CONTACTSINFO *ci)
if (count == 1) { /* cache the found result */
mir_cslock lck(csContactCache);
- cce = (CONTACTCE*)mir_realloc(cce, (cacheSize+1)*sizeof(CONTACTCE));
+ cce = (CONTACTCE*)mir_realloc(cce, (cacheSize + 1)*sizeof(CONTACTCE));
if (cce != NULL) {
cce[cacheSize].hContact = ci->hContacts[0];
cce[cacheSize].flags = ci->flags;
@@ -360,28 +360,27 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam)
DBCONTACTWRITESETTING *dbw = (DBCONTACTWRITESETTING*)lParam;
mir_cslock lck(csContactCache);
- for (int i=0; i < cacheSize; i++) {
- if (hContact != cce[i].hContact && (cce[i].flags & CI_CNFINFO) == 0 )
+ for (int i = 0; i < cacheSize; i++) {
+ if (hContact != cce[i].hContact && (cce[i].flags & CI_CNFINFO) == 0)
continue;
char *szProto = GetContactProto(hContact);
if (szProto == NULL)
continue;
- char *uid = (char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
+ char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if (((!mir_strcmp(dbw->szSetting, "Nick")) && (cce[i].flags & CI_NICK)) ||
- ((!mir_strcmp(dbw->szSetting, "FirstName")) && (cce[i].flags & CI_FIRSTNAME)) ||
- ((!mir_strcmp(dbw->szSetting, "LastName")) && (cce[i].flags & CI_LASTNAME)) ||
- ((!mir_strcmp(dbw->szSetting, "e-mail")) && (cce[i].flags & CI_EMAIL)) ||
- ((!mir_strcmp(dbw->szSetting, "MyHandle")) && (cce[i].flags & CI_LISTNAME)) ||
- (cce[i].flags & CI_CNFINFO) != 0 || // lazy; always invalidate CNF info cache entries
- (( ((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!mir_strcmp(dbw->szSetting, uid)) && (cce[i].flags & CI_UNIQUEID)))
- {
+ ((!mir_strcmp(dbw->szSetting, "FirstName")) && (cce[i].flags & CI_FIRSTNAME)) ||
+ ((!mir_strcmp(dbw->szSetting, "LastName")) && (cce[i].flags & CI_LASTNAME)) ||
+ ((!mir_strcmp(dbw->szSetting, "e-mail")) && (cce[i].flags & CI_EMAIL)) ||
+ ((!mir_strcmp(dbw->szSetting, "MyHandle")) && (cce[i].flags & CI_LISTNAME)) ||
+ (cce[i].flags & CI_CNFINFO) != 0 || // lazy; always invalidate CNF info cache entries
+ ((((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!mir_strcmp(dbw->szSetting, uid)) && (cce[i].flags & CI_UNIQUEID))) {
/* remove from cache */
mir_free(cce[i].tszContact);
if (cacheSize > 1) {
- memmove(&cce[i], &cce[cacheSize-1], sizeof(CONTACTCE));
- cce = ( CONTACTCE* )mir_realloc(cce, (cacheSize-1)*sizeof(CONTACTCE));
+ memmove(&cce[i], &cce[cacheSize - 1], sizeof(CONTACTCE));
+ cce = (CONTACTCE*)mir_realloc(cce, (cacheSize - 1)*sizeof(CONTACTCE));
cacheSize -= 1;
}
else {
@@ -430,8 +429,8 @@ MCONTACT decodeContactFromString(TCHAR *tszContact)
MCONTACT hContact = INVALID_CONTACT_ID;
CONTACTSINFO ci = { sizeof(ci) };
ci.tszContact = tszContact;
- ci.flags = CI_PROTOID|CI_TCHAR;
- int count = getContactFromString( &ci );
+ ci.flags = CI_PROTOID | CI_TCHAR;
+ int count = getContactFromString(&ci);
if (count != 1) {
mir_free(ci.hContacts);
return hContact;
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp
index 9fc1ca9c50..7fac682f62 100755
--- a/plugins/Watrack_MPD/src/main.cpp
+++ b/plugins/Watrack_MPD/src/main.cpp
@@ -50,7 +50,6 @@ int Parser()
{
static NETLIBPACKETRECVER nlpr = {0};
char *ptr;
- char tmp[256];
int i;
char *buf;
static char ver[16];
@@ -115,6 +114,7 @@ int Parser()
}
nlpr.bytesUsed = nlpr.bytesAvailable;
}
+ char tmp[256];
buf = (char*)nlpr.buffer;
if(ptr = strstr(buf, "MPD"))
{
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index f8d54ad42e..e8e8dc25c3 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -25,7 +25,7 @@ to the contact list. Contain code for both name and ID search.
#include "stdafx.h"
// variables used for weather_addstn.c
-static int searchId = -1;
+static int sttSearchId = -1;
static TCHAR name1[256];
// ============ ADDING NEW STATION ============
@@ -133,7 +133,7 @@ BOOL CheckSearch() {
// ============ BASIC ID SEARCH ============
-static TCHAR sID[32];
+static TCHAR sttSID[32];
// A timer process for the ID search (threaded)
static void __cdecl BasicSearchTimerProc(LPVOID)
@@ -141,26 +141,26 @@ static void __cdecl BasicSearchTimerProc(LPVOID)
int result;
// search only when it's not current updating weather.
if (CheckSearch())
- result = IDSearch(sID, searchId);
+ result = IDSearch(sttSID, sttSearchId);
// broadcast the search result
- ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)searchId, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId, 0);
// exit the search
- searchId = -1;
+ sttSearchId = -1;
}
// the service function for ID search
// lParam = ID search string
INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
{
- if (searchId != -1) return 0; //only one search at a time
- _tcsncpy(sID, ( TCHAR* )lParam, _countof(sID));
- sID[_countof(sID)-1] = 0;
- searchId = 1;
+ if (sttSearchId != -1) return 0; //only one search at a time
+ _tcsncpy(sttSID, ( TCHAR* )lParam, _countof(sttSID));
+ sttSID[_countof(sttSID)-1] = 0;
+ sttSearchId = 1;
// create a thread for the ID search
mir_forkthread(BasicSearchTimerProc, NULL);
- return searchId;
+ return sttSearchId;
}
// ============ NAME SEARCH ============
@@ -171,13 +171,13 @@ static void __cdecl NameSearchTimerProc(LPVOID)
// search only when it's not current updating weather.
if (CheckSearch())
if (name1[0] != 0)
- NameSearch(name1, searchId); // search nickname field
+ NameSearch(name1, sttSearchId); // search nickname field
// broadcast the result
- ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)searchId, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId, 0);
// exit the search
- searchId = -1;
+ sttSearchId = -1;
}
static INT_PTR CALLBACK WeatherSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
@@ -207,14 +207,14 @@ INT_PTR WeatherCreateAdvancedSearchUI(WPARAM, LPARAM lParam)
// service function for name search
INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
{
- if (searchId != -1) return 0; //only one search at a time
+ if (sttSearchId != -1) return 0; //only one search at a time
- searchId = 1;
+ sttSearchId = 1;
GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
// search for the weather station using a thread
mir_forkthread(NameSearchTimerProc, NULL);
- return searchId;
+ return sttSearchId;
}
// ============ SEARCH FOR A WEATHER STATION USING ID ============
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 4390e86058..b92291fa17 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -41,13 +41,12 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
{
MWinDataType *data = (MWinDataType*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch(msg)
- {
+ switch (msg) {
case WM_CREATE:
data = (MWinDataType*)mir_calloc(sizeof(MWinDataType));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
- data->hContact = (MCONTACT)((LPCREATESTRUCT)lParam)->lpCreateParams;
+ data->hContact = (DWORD_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD,
0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, NULL, hInst, 0);
if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
@@ -69,14 +68,13 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_MOUSEMOVE:
{
- TRACKMOUSEEVENT tme = {0};
+ TRACKMOUSEEVENT tme = { 0 };
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.hwndTrack = hwnd;
tme.dwFlags = TME_QUERY;
TrackMouseEvent(&tme);
- if (tme.dwFlags == 0)
- {
+ if (tme.dwFlags == 0) {
tme.dwFlags = TME_HOVER | TME_LEAVE;
tme.hwndTrack = hwnd;
tme.dwHoverTime = CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
@@ -88,7 +86,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_MOUSEHOVER:
{
POINT pt;
- CLCINFOTIP ti = {0};
+ CLCINFOTIP ti = { 0 };
GetCursorPos(&pt);
GetWindowRect(hwnd, &ti.rcItem);
@@ -106,7 +104,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
break;
case WM_COMMAND: //Needed by the contact's context menu
- if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU), (LPARAM)data->hContact))
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)data->hContact))
break;
return FALSE;
@@ -117,11 +115,9 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam);
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED)
- {
+ if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED) {
BOOL newava = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0) != 0;
- if (newava != data->haveAvatar)
- {
+ if (newava != data->haveAvatar) {
LONG_PTR style = GetWindowLongPtr(data->hAvt, GWL_STYLE);
data->haveAvatar = newava;
SetWindowLongPtr(data->hAvt, GWL_STYLE, newava ? (style | WS_VISIBLE) : (style & ~WS_VISIBLE));
@@ -139,9 +135,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
{
RECT r, rc;
- if (GetUpdateRect(hwnd, &r, FALSE))
- {
- DBVARIANT dbv = {0};
+ if (GetUpdateRect(hwnd, &r, FALSE)) {
+ DBVARIANT dbv = { 0 };
PAINTSTRUCT ps;
LOGFONT lfnt, lfnt1;
COLORREF fntc, fntc1;
@@ -149,14 +144,12 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
int picSize = opt.AvatarSize;
HICON hIcon = NULL;
- if ( !data->haveAvatar)
- {
+ if (!data->haveAvatar) {
int statusIcon = db_get_w(data->hContact, WEATHERPROTONAME, "Status", 0);
picSize = GetSystemMetrics(SM_CXICON);
hIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon, true);
- if ((INT_PTR)hIcon == CALLSERVICE_NOTFOUND)
- {
+ if ((INT_PTR)hIcon == CALLSERVICE_NOTFOUND) {
picSize = GetSystemMetrics(SM_CXSMICON);
hIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon);
}
@@ -165,7 +158,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
clr = db_get_dw(NULL, WEATHERPROTONAME, "ColorMwinFrame", GetSysColor(COLOR_3DFACE));
{
- FontIDT fntid = {0};
+ FontIDT fntid = { 0 };
mir_tstrcpy(fntid.group, _T(WEATHERPROTONAME));
mir_tstrcpy(fntid.name, LPGENT("Frame Font"));
fntc = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt);
@@ -180,7 +173,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
HDC hdc = BeginPaint(hwnd, &ps);
- if ( ServiceExists(MS_SKIN_DRAWGLYPH)) {
+ if (ServiceExists(MS_SKIN_DRAWGLYPH)) {
SKINDRAWREQUEST rq;
memset(&rq, 0, sizeof(rq));
rq.hDC = hdc;
@@ -197,16 +190,16 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
DeleteObject(hBkgBrush);
}
- if ( !data->haveAvatar)
+ if (!data->haveAvatar)
DrawIconEx(hdc, 1, 1, hIcon, 0, 0, 0, NULL, DI_NORMAL);
SetBkMode(hdc, TRANSPARENT);
HFONT hfnt = CreateFontIndirect(&lfnt1);
- HFONT hfntold = ( HFONT )SelectObject(hdc, hfnt);
+ HFONT hfntold = (HFONT)SelectObject(hdc, hfnt);
SIZE fontSize;
- TCHAR *nick = ( TCHAR* )pcli->pfnGetContactDisplayName(data->hContact, 0);
+ TCHAR *nick = (TCHAR*)pcli->pfnGetContactDisplayName(data->hContact, 0);
GetTextExtentPoint32(hdc, _T("|"), 1, &fontSize);
@@ -221,16 +214,15 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
SelectObject(hdc, hfntold);
DeleteObject(hfnt);
- if (dbv.pszVal)
- {
- HFONT hfnt = CreateFontIndirect(&lfnt);
- HFONT hfntold = ( HFONT )SelectObject(hdc, hfnt);
+ if (dbv.pszVal) {
+ HFONT hFont = CreateFontIndirect(&lfnt);
+ HFONT hFontOld = (HFONT)SelectObject(hdc, hFont);
SetTextColor(hdc, fntc);
DrawText(hdc, dbv.ptszVal, -1, &rc, DT_LEFT | DT_EXPANDTABS);
- SelectObject(hdc, hfntold);
- DeleteObject(hfnt);
+ SelectObject(hdc, hFontOld);
+ DeleteObject(hFont);
}
EndPaint(hwnd, &ps);
IcoLib_ReleaseIcon(hIcon);
@@ -254,13 +246,13 @@ static void addWindow(MCONTACT hContact)
mir_sntprintf(winname, _countof(winname), _T("Weather: %s"), dbv.ptszVal);
db_free(&dbv);
- HWND hWnd = CreateWindow( _T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE,
+ HWND hWnd = CreateWindow(_T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE,
0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, (void*)hContact);
WindowList_Add(hMwinWindowList, hWnd, hContact);
- CLISTFrame Frame = {0};
+ CLISTFrame Frame = { 0 };
Frame.tname = winname;
- Frame.hIcon = LoadIconEx("main",FALSE);
+ Frame.hIcon = LoadIconEx("main", FALSE);
Frame.cbSize = sizeof(Frame);
Frame.hWnd = hWnd;
Frame.align = alBottom;
@@ -302,7 +294,7 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM)
}
-int BuildContactMenu(WPARAM wparam,LPARAM)
+int BuildContactMenu(WPARAM wparam, LPARAM)
{
int flags = db_get_dw((MCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0;
Menu_ModifyItem(hMwinMenu, NULL, INVALID_HANDLE_VALUE, flags);
@@ -319,25 +311,25 @@ int RedrawFrame(WPARAM, LPARAM)
void InitMwin(void)
{
- if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
return;
hMwinWindowList = WindowList_Create();
WNDCLASS wndclass;
- wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = wndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+ wndclass.lpfnWndProc = wndProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInst;
+ wndclass.hIcon = NULL;
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = _T("WeatherFrame");
RegisterClass(&wndclass);
- ColourIDT colourid = {0};
+ ColourIDT colourid = { 0 };
colourid.cbSize = sizeof(ColourIDT);
mir_strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME);
mir_strcpy(colourid.setting, "ColorMwinFrame");
@@ -346,7 +338,7 @@ void InitMwin(void)
colourid.defcolour = GetSysColor(COLOR_3DFACE);
ColourRegisterT(&colourid);
- FontIDT fontid = {0};
+ FontIDT fontid = { 0 };
fontid.cbSize = sizeof(FontIDT);
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
mir_strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME);
@@ -383,7 +375,7 @@ void DestroyMwin(void)
if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
}
- UnregisterClass( _T("WeatherFrame"), hInst);
+ UnregisterClass(_T("WeatherFrame"), hInst);
WindowList_Destroy(hMwinWindowList);
UnhookEvent(hFontHook);
}
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index 09af852326..f1a027ae19 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -55,7 +55,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
{
INT_PTR ret = 0;
- switch(wParam) {
+ switch (wParam) {
case PFLAGNUM_1:
// support search and visible list
ret = PF1_BASICSEARCH | PF1_ADDSEARCHRES | PF1_EXTSEARCH | PF1_VISLIST | PF1_MODEMSGRECV;
@@ -63,17 +63,17 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
case PFLAGNUM_2:
ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND |
- PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
break;
case PFLAGNUM_4:
ret = PF4_AVATARS | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_FORCEADDED |
- PF4_FORCEAUTH;
+ PF4_FORCEAUTH;
break;
case PFLAGNUM_5: /* this is PFLAGNUM_5 change when alpha SDK is released */
ret = PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND |
- PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+ PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
break;
case PFLAG_UNIQUEIDTEXT:
@@ -88,10 +88,10 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
}
// protocol service function to get weather protocol name
-INT_PTR WeatherGetName(WPARAM wParam,LPARAM lParam)
+INT_PTR WeatherGetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam,WEATHERPROTOTEXT,wParam-1);
- *((char*)lParam + wParam-1) = 0;
+ strncpy((char*)lParam, WEATHERPROTOTEXT, wParam - 1);
+ *((char*)lParam + wParam - 1) = 0;
return 0;
}
@@ -102,7 +102,7 @@ INT_PTR WeatherGetStatus(WPARAM, LPARAM)
}
// protocol service function to get the icon of the protocol
-INT_PTR WeatherLoadIcon(WPARAM wParam,LPARAM)
+INT_PTR WeatherLoadIcon(WPARAM wParam, LPARAM)
{
return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx("main", FALSE)) : 0;
}
@@ -110,14 +110,14 @@ INT_PTR WeatherLoadIcon(WPARAM wParam,LPARAM)
static void __cdecl AckThreadProc(HANDLE param)
{
Sleep(100);
- ProtoBroadcastAck(WEATHERPROTONAME, (MCONTACT)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, (DWORD_PTR)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
// nothing to do here because weather proto do not need to retrieve contact info form network
// so just return a 0
-INT_PTR WeatherGetInfo(WPARAM,LPARAM lParam)
+INT_PTR WeatherGetInfo(WPARAM, LPARAM lParam)
{
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *)lParam;
mir_forkthread(AckThreadProc, (void*)ccs->hContact);
return 0;
}
@@ -129,7 +129,6 @@ static const WORD statusValue[] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN, PC
INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
{
TCHAR szSearchPath[MAX_PATH], *chop;
- WORD status;
unsigned i;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
@@ -139,9 +138,9 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
if (chop) *chop = '\0';
else szSearchPath[0] = 0;
- status = (WORD)db_get_w(pai->hContact, WEATHERPROTONAME, "StatusIcon",0);
- for (i=0; i<10; i++)
- if (statusValue[i] == status)
+ int iStatus = db_get_w(pai->hContact, WEATHERPROTONAME, "StatusIcon", 0);
+ for (i = 0; i < 10; i++)
+ if (statusValue[i] == iStatus)
break;
if (i >= 10)
@@ -149,12 +148,12 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
pai->format = PA_FORMAT_PNG;
mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]);
- if ( _taccess(pai->filename, 4) == 0)
+ if (_taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_GIF;
mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]);
- if ( _taccess(pai->filename, 4) == 0)
+ if (_taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_UNKNOWN;
@@ -162,7 +161,6 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
return GAIR_NOAVATAR;
}
-
void AvatarDownloaded(MCONTACT hContact)
{
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -174,17 +172,17 @@ void AvatarDownloaded(MCONTACT hContact)
ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
-
-static void __cdecl WeatherGetAwayMsgThread(void *hContact)
+static void __cdecl WeatherGetAwayMsgThread(void *arg)
{
Sleep(100);
+ MCONTACT hContact = (DWORD_PTR)arg;
DBVARIANT dbv;
- if (!db_get_ts((MCONTACT)hContact, "CList", "StatusMsg", &dbv)) {
- ProtoBroadcastAck(WEATHERPROTONAME, (MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
- db_free( &dbv );
+ if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
}
- else ProtoBroadcastAck(WEATHERPROTONAME, (MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ else ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
static INT_PTR WeatherGetAwayMsg(WPARAM, LPARAM lParam)
@@ -251,7 +249,7 @@ void UpdatePopupMenu(BOOL State)
}
// update the weather auto-update menu item when click on it
-INT_PTR EnableDisableCmd(WPARAM wParam,LPARAM lParam)
+INT_PTR EnableDisableCmd(WPARAM wParam, LPARAM lParam)
{
UpdateMenu(wParam == TRUE ? (BOOL)lParam : !opt.CAutoUpdate);
return 0;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index 6eba2c8d56..dc2adfdbf9 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -35,7 +35,7 @@ COLORREF BackgoundClr, TextClr;
UINT_PTR timerId;
UINT_PTR Countdown;
-LOGFONT lf;
+LOGFONT g_lf;
HFONT h_font;
HWND ContactHwnd;
HINSTANCE hInst;
@@ -63,8 +63,8 @@ void ChangeMenuItemCountdown()
// countdown
HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
- TCHAR countername[100];
- mir_sntprintf(countername,_countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ TCHAR countername[100];
+ mir_sntprintf(countername, _countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
Menu_ModifyItem(hMenuItemCountdown, countername, hIcon, CMIF_KEEPUNTRANSLATED);
}
@@ -72,10 +72,10 @@ void ChangeMenuItemCountdown()
/*****************************************************************************/
static int CALLBACK EnumFontsProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX*, int, LPARAM lParam)
{
- if (!IsWindow((HWND) lParam))
+ if (!IsWindow((HWND)lParam))
return FALSE;
- if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, -1, (LPARAM) lpelfe->elfLogFont.lfFaceName) == CB_ERR)
- SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfLogFont.lfFaceName);
+ if (SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)lpelfe->elfLogFont.lfFaceName) == CB_ERR)
+ SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfLogFont.lfFaceName);
return TRUE;
}
@@ -83,11 +83,11 @@ void FillFontListThread(void *param)
{
HDC hdc = GetDC((HWND)param);
- LOGFONT lf = {0};
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfFaceName[0] = 0;
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontsProc, (LPARAM) GetDlgItem((HWND)param, IDC_TYPEFACE), 0);
+ LOGFONT lf = { 0 };
+ g_lf.lfCharSet = DEFAULT_CHARSET;
+ g_lf.lfFaceName[0] = 0;
+ g_lf.lfPitchAndFamily = 0;
+ EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontsProc, (LPARAM)GetDlgItem((HWND)param, IDC_TYPEFACE), 0);
ReleaseDC((HWND)param, hdc);
}
@@ -168,7 +168,7 @@ int Doubleclick(WPARAM wParam, LPARAM)
{
MCONTACT hContact = wParam;
char *szProto = GetContactProto(hContact);
- if ( mir_strcmp(MODULENAME, szProto))
+ if (mir_strcmp(MODULENAME, szProto))
return 0;
int action = db_get_b(hContact, MODULENAME, DBLE_WIN_KEY, 1);
@@ -176,7 +176,7 @@ int Doubleclick(WPARAM wParam, LPARAM)
ptrT url(db_get_tsa(hContact, MODULENAME, "URL"));
Utils_OpenUrlT(url);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
else if (action == 1) {
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
@@ -185,11 +185,11 @@ int Doubleclick(WPARAM wParam, LPARAM)
SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM) hContact);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
- if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
@@ -207,7 +207,7 @@ int Doubleclick(WPARAM wParam, LPARAM)
mir_forkthread(ReadFromFile, (void*)hContact);
else
mir_forkthread(GetData, (void*)hContact);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
}
@@ -229,13 +229,13 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb
cfFM.cbSize = sizeof(CHARFORMAT2);
cfFM.dwMask = CFM_COLOR | CFM_CHARSET | CFM_FACE | ENM_LINK | ENM_MOUSEEVENTS | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_SIZE;
- if ( db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0))
bold = CFE_BOLD;
- if ( db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0))
italic = CFE_ITALIC;
- if ( db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0))
underline = CFE_UNDERLINE;
cfFM.dwEffects = bold | italic | underline;
@@ -247,14 +247,14 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb
else mir_tstrcpy(cfFM.szFaceName, Def_font_face);
HDC hDC = GetDC(hWindow);
- cfFM.yHeight = (BYTE)MulDiv(abs(lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
+ cfFM.yHeight = (BYTE)MulDiv(abs(g_lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
ReleaseDC(hWindow, hDC);
cfFM.bCharSet = db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0);
cfFM.bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
cfFM.crTextColor = rgbText;
cfFM.crBackColor = rgbBack;
- SendDlgItemMessage(hWindow, IDC_DATA, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) & cfFM);
+ SendDlgItemMessage(hWindow, IDC_DATA, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)& cfFM);
SendDlgItemMessage(hWindow, IDC_DATA, EM_SETSEL, 0, -1);
SendDlgItemMessageA(hWindow, IDC_DATA, EM_REPLACESEL, FALSE, (LPARAM)truncated);
@@ -278,12 +278,12 @@ void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD)
void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD)
{
DWORD timetemp = db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 100);
- if(timetemp <= 0) {
+ if (timetemp <= 0) {
timetemp = db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp);
}
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp-1);
+ db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp - 1);
ChangeMenuItemCountdown();
}
@@ -298,7 +298,7 @@ static int OptInitialise(WPARAM wParam, LPARAM)
odp.ptszGroup = LPGENT("Network");
odp.ptszTitle = _T(MODULENAME);
odp.pfnDlgProc = DlgProcOpt;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
Options_AddPage(wParam, &odp);
// if popup service exists
@@ -314,20 +314,20 @@ static int OptInitialise(WPARAM wParam, LPARAM)
/*****************************************************************************/
void FontSettings(void)
{
- lf.lfHeight = 16;
- lf.lfWidth = 0;
- lf.lfEscapement = 0;
- lf.lfOrientation = 0;
- lf.lfWeight = FW_NORMAL;
- lf.lfItalic = FALSE;
- lf.lfUnderline = FALSE;
- lf.lfStrikeOut = 0;
- lf.lfCharSet = ANSI_CHARSET;
- lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf.lfQuality = DEFAULT_QUALITY;
- lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
- mir_tstrcpy(lf.lfFaceName, Def_font_face);
+ g_lf.lfHeight = 16;
+ g_lf.lfWidth = 0;
+ g_lf.lfEscapement = 0;
+ g_lf.lfOrientation = 0;
+ g_lf.lfWeight = FW_NORMAL;
+ g_lf.lfItalic = FALSE;
+ g_lf.lfUnderline = FALSE;
+ g_lf.lfStrikeOut = 0;
+ g_lf.lfCharSet = ANSI_CHARSET;
+ g_lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
+ g_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ g_lf.lfQuality = DEFAULT_QUALITY;
+ g_lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
+ mir_tstrcpy(g_lf.lfFaceName, Def_font_face);
}
/*****************************************************************************/
@@ -348,10 +348,10 @@ int ModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_OSD_ALERT, OSDAlert);
FontSettings();
- h_font = CreateFontIndirect(&lf);
+ h_font = CreateFontIndirect(&g_lf);
// get data on startup
- if ( db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
mir_forkthread(StartUpdate, NULL);
return 0;
@@ -368,9 +368,9 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
}
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM) hContact);
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
- if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
@@ -382,12 +382,12 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
- if ( db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0)) {
- if ( db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0)) {
+ if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0))
mir_forkthread(ReadFromFile, (void*)hContact);
else
mir_forkthread(GetData, (void*)hContact);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
return 0;
@@ -426,14 +426,12 @@ int OnTopMenuCommand(WPARAM, LPARAM, MCONTACT singlecontact)
int ontop = 0;
int done = 0;
- if (((db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0)
- {
+ if (((db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0) {
db_set_b(singlecontact, MODULENAME, ON_TOP_KEY, 0);
ontop = 0;
done = 1;
}
- if ((!(db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0)
- {
+ if ((!(db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0) {
db_set_b(singlecontact, MODULENAME, ON_TOP_KEY, 1);
ontop = 1;
done = 1;
@@ -449,7 +447,7 @@ INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM)
if (url)
Utils_OpenUrlT(url);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
return 0;
}
@@ -476,7 +474,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), NULL, DlgProcContactOpt, (LPARAM) wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), NULL, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -485,13 +483,13 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM)
/*****************************************************************************/
INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM)
{
- HWND hwndDlg = WindowList_Find(hWindowList, (MCONTACT) wParam);
+ HWND hwndDlg = WindowList_Find(hWindowList, (MCONTACT)wParam);
if (hwndDlg) {
DestroyWindow(hwndDlg);
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), NULL, DlgProcAlertOpt, (LPARAM) wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), NULL, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h
index 1767911e88..c09e9f88b8 100644
--- a/plugins/WebView/src/webview.h
+++ b/plugins/WebView/src/webview.h
@@ -138,7 +138,7 @@ void ReadFromFile(void *hContact);
extern int Xposition, Yposition, WindowHeight, WindowWidth;
extern COLORREF BackgoundClr, TextClr;
extern UINT_PTR timerId, Countdown;
-extern LOGFONT lf;
+extern LOGFONT g_lf;
extern HFONT h_font;
extern HWND ContactHwnd;
extern HINSTANCE hInst;
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index 9e38568dfa..ab59060515 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -29,7 +29,7 @@ int AlreadyDownloading = 0;
/*******************/
void GetData(void *param)
{
- MCONTACT hContact = (MCONTACT)param;
+ MCONTACT hContact = (DWORD_PTR)param;
int statpos = 0, dispos = 0, statposend = 0;
char*pos;
DBVARIANT dbv;
@@ -140,7 +140,6 @@ void GetData(void *param)
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY);
TCHAR *statusText = TranslateT("The server replied with a failure code");
- HWND hwndDlg = WindowList_Find(hWindowList, hContact);
SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText);
WErrorPopup(hContact, statusText);
db_set_ts(hContact, "CList", "StatusMsg", statusText);
@@ -155,7 +154,6 @@ void GetData(void *param)
if (!nlhrReply) {
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_NA);
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
TCHAR *statusText = TranslateT("The server is down or lagging.");
SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText);
@@ -173,11 +171,8 @@ void GetData(void *param)
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM) nlhrReply);
- if (DownloadSuccess) {
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
+ if (DownloadSuccess)
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Download successful; about to process data..."));
- }
- ///get data in desired range
// download successful
if (DownloadSuccess) {
@@ -239,7 +234,6 @@ void GetData(void *param)
else if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0) {
TCHAR *szStatusText = TranslateT("Invalid search parameters.");
WErrorPopup(hContact, szStatusText);
- HWND hwndDlg = WindowList_Find(hWindowList, hContact);
DownloadSuccess = 0;
SetDlgItemText(hwndDlg, IDC_STATUSBAR, szStatusText);
@@ -256,7 +250,6 @@ void GetData(void *param)
WErrorPopup(hContact, statusText);
db_set_ts(hContact, "CList", "StatusMsg", statusText);
- HWND hwndDlg = WindowList_Find(hWindowList, hContact);
DownloadSuccess = 0;
SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText);
TherewasAlert = ProcessAlerts(hContact, _T2A(statusText), contactname, contactname, 1);
@@ -358,8 +351,6 @@ void GetData(void *param)
RemoveTabs(truncated);
if ( db_get_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 0)) {
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
-
SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr);
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 1)"));
@@ -478,7 +469,6 @@ LBL_Stop: TCHAR *statusText = TranslateT("Processing data stopped by user.");
if (DownloadSuccess) { // download success
char BytesString[128];
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
// update window if the update only on alert option isn't ticked or
// there was an alert or the update button was clicked
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index bc5bab421e..b4b45bd99e 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -31,19 +31,19 @@ const TCHAR *szTrackerBarDescr[] = {
LPGENT("Remove all whitespace")
};
-static char *fontSizes[] = {"8", "10", "14", "16", "18", "20", "24", "28"};
+static char *fontSizes[] = { "8", "10", "14", "16", "18", "20", "24", "28" };
static TCHAR *AlertTypes[] = { LPGENT("Popup plugin"), LPGENT("Log to file"), LPGENT("Open data display window"), LPGENT("Use OSD plugin") };
static TCHAR *EventTypes[] = { LPGENT("A string is present"), LPGENT("The web page changes"), LPGENT("A specific part of web page changes") };
#define M_FILLSCRIPTCOMBO (WM_USER+16)
-void strdel(TCHAR *parBuffer, int len )
+void strdel(TCHAR *parBuffer, int len)
{
TCHAR* p;
- for (p = parBuffer+len; *p != 0; p++)
- p[ -len ] = *p;
+ for (p = parBuffer + len; *p != 0; p++)
+ p[-len] = *p;
- p[ -len ] = '\0';
+ p[-len] = '\0';
}
TCHAR* FixButtonText(TCHAR *url, size_t len)
@@ -52,9 +52,9 @@ TCHAR* FixButtonText(TCHAR *url, size_t len)
_tcsncpy_s(buttontext, url, _TRUNCATE);
_tcsncpy_s(newbuttontext, url, _TRUNCATE);
- if ( _tcschr(newbuttontext, '&') != 0) {
+ if (_tcschr(newbuttontext, '&') != 0) {
while (true) {
- if ( _tcschr(newbuttontext, '&') == 0)
+ if (_tcschr(newbuttontext, '&') == 0)
break;
_tcsncpy_s(buttontext, newbuttontext, _TRUNCATE);
@@ -71,12 +71,12 @@ TCHAR* FixButtonText(TCHAR *url, size_t len)
}
while (true) {
- if ( _tcschr(newbuttontext, '!') != 0) {
+ if (_tcschr(newbuttontext, '!') != 0) {
TCHAR *stringafter = _tcschr(newbuttontext, '!');
int pos = (stringafter - newbuttontext);
newbuttontext[pos] = '&';
}
- if ( _tcschr(newbuttontext, '!') == 0)
+ if (_tcschr(newbuttontext, '!') == 0)
break;
}
}
@@ -88,11 +88,10 @@ TCHAR* FixButtonText(TCHAR *url, size_t len)
/*****************************************************************************/
static int CALLBACK EnumFontScriptsProc(ENUMLOGFONTEX * lpelfe, NEWTEXTMETRICEX*, int, LPARAM lParam)
{
- if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, -1, (LPARAM) lpelfe->elfScript) == CB_ERR)
- {
- int i = SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfScript);
+ if (SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)lpelfe->elfScript) == CB_ERR) {
+ int i = SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfScript);
- SendMessage((HWND) lParam, CB_SETITEMDATA, i, lpelfe->elfLogFont.lfCharSet);
+ SendMessage((HWND)lParam, CB_SETITEMDATA, i, lpelfe->elfLogFont.lfCharSet);
}
return TRUE;
}
@@ -147,7 +146,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
// enable the "apply" button
- if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND) lParam)
+ if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND)lParam)
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
// These are simple clicks: we don't save, but we tell the Options Page
// to enable the "Apply" button.
@@ -190,8 +189,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_DELAY:
if (HIWORD(wParam) == EN_CHANGE)
test++;
- if (test > 1)
- {
+ if (test > 1) {
//CheckRadioButton(hdlg, IDC_PD1, IDC_PD3, IDC_PD3);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
@@ -231,7 +229,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_NOTIFY: // Here we have pressed either the OK or the APPLY button.
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
int popupdelayval = 0;
@@ -286,12 +284,11 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
test = 0;
TranslateDialogDefault(hwndDlg);
hContact = lParam;
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) hContact);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SetWindowText(hwndDlg, TranslateT("Alert options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT)));
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0);
@@ -437,7 +434,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
else
CheckRadioButton(hwndDlg, IDC_PREFIX, IDC_SUFFIX, IDC_SUFFIX);
- if ( db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0)) {
+ if (db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0)) {
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_APPEND), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
@@ -512,7 +509,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_DATE_NAME), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
- if ( IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_PREFIX), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_SUFFIX), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_24_HOUR), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
@@ -631,8 +628,8 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_ALERT_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) {
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int alertIndex = SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_GETCURSEL, 0, 0);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ alertIndex = SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_GETCURSEL, 0, 0);
if (HIWORD(wParam) == CBN_SELCHANGE) {
db_set_b(hContact, MODULENAME, ALRT_INDEX_KEY, alertIndex);
@@ -678,8 +675,8 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_EVENT_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) {
- MCONTACT hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int eventIndex = SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_GETCURSEL, 0, 0);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ eventIndex = SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_GETCURSEL, 0, 0);
if (HIWORD(wParam) == CBN_SELCHANGE) {
db_set_b(hContact, MODULENAME, EVNT_INDEX_KEY, eventIndex);
@@ -709,7 +706,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_ALERT_APPLY:
case IDC_OK2:
{
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
TCHAR buf[MAX_PATH];
eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0);
@@ -821,17 +818,17 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- hContact = (MCONTACT) lParam;
+ hContact = (MCONTACT)lParam;
test = 0;
test2 = 0;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) hContact);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
WindowList_Add(hWindowList, hwndDlg, hContact);
SetWindowText(hwndDlg, TranslateT("Contact options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
@@ -927,7 +924,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_CPY_STRINGS:
{
TCHAR string[128];
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_START, string, _countof(string));
db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, string);
@@ -1022,7 +1019,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
}
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_URL, url, _countof(url));
db_set_ts(hContact, MODULENAME, URL_KEY, url);
@@ -1139,7 +1136,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
*/
oldcolor = BackgoundClr;
- if ( db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) {
+ if (db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) {
CheckDlgButton(hwndDlg, IDC_SUPPRESS, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0);
}
@@ -1152,7 +1149,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
if (ServiceExists(MS_POPUP_ADDPOPUPT) == 0)
EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0);
- if ( db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0)) {
+ if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_START_DELAY), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_SPIN2), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_STARTDELAYTXT), 1);
@@ -1171,7 +1168,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// selection to the value for fontid wParam
{
- LOGFONT lf = {0};
+ LOGFONT lf = { 0 };
int i;
HDC hdc = GetDC(hwndDlg);
@@ -1179,12 +1176,10 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, _countof(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_RESETCONTENT, 0, 0);
- EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontScriptsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
+ EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontScriptsProc, (LPARAM)GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
ReleaseDC(hwndDlg, hdc);
- for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--)
- {
- if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == (BYTE)((db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0))))
- {
+ for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
+ if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == (BYTE)((db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0)))) {
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, i, 0);
break;
}
@@ -1195,7 +1190,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
break;
case WM_COMMAND:
- if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND) lParam)
+ if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND)lParam)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
switch (LOWORD(wParam)) {
@@ -1266,7 +1261,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
db_set_b(NULL, MODULENAME, MENU_OFF, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENU));
db_set_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SUPPRESS));
@@ -1301,15 +1296,13 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
BackgoundClr = (SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0));
TextClr = (SendDlgItemMessage(hwndDlg, IDC_TXTCOLOR, CPM_GETCOLOUR, 0, 0));
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0))
- {
+ if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0)) {
KillTimer(NULL, timerId);
KillTimer(NULL, Countdown);
timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc);
}
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0))
- {
+ if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0)) {
KillTimer(NULL, timerId);
KillTimer(NULL, Countdown);
}
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 1083287cc2..932ba2a47f 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -398,18 +398,16 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);
- {
- MCONTACT hContact = lParam;
- WindowList_Add(hAddBirthdayWndsList, hWnd, hContact);
- Utils_RestoreWindowPositionNoSize(hWnd, hContact, ModuleName, "BirthdayWnd");
- }
+
+ hContact = lParam;
+ WindowList_Add(hAddBirthdayWndsList, hWnd, hContact);
+ Utils_RestoreWindowPositionNoSize(hWnd, hContact, ModuleName, "BirthdayWnd");
+
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hAddBirthdayContact, 1));
- {
- for (int i = 0; i < cSaveModule; i++)
- SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSaveModule[i]));
- SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_SETCURSEL, commonData.cDefaultModule, 0);
- }
+ for (int i = 0; i < cSaveModule; i++)
+ SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSaveModule[i]));
+ SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_SETCURSEL, commonData.cDefaultModule, 0);
break;
case WM_SHOWWINDOW:
@@ -487,9 +485,9 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- SYSTEMTIME st;
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA);
HWND hDate = GetDlgItem(hWnd, IDC_DATE);
+ SYSTEMTIME st;
if (DateTime_GetSystemtime(hDate, &st) == GDT_VALID) {
int mode = SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_GETCURSEL, 0, 0); //SAVE modes in date_utils.h are synced
SaveBirthday(hContact, st.wYear, st.wMonth, st.wDay, mode);
@@ -580,6 +578,7 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll,
currentDay = today->tm_mday + 1;
currentMonth = today->tm_mon + 1;
}
+ else currentMonth = currentDay = 0;
int year, month, day;
int module = GetContactDOB(hContact, year, month, day);
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
index d5f2df0051..f2fb9c2ad7 100644
--- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp
+++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
@@ -250,14 +250,14 @@ void DisableDelayOptions(HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg, IDC_TX_DELAY_SEC), FALSE);
}
-void ChooseFile(HWND hDlg)
+void ChooseFile(HWND hwndDlg)
{
TCHAR szFile[MAX_PATH]; szFile[0]=0;
// Initialize OPENFILENAME
OPENFILENAME ofn = {0}; // common dialog box structure
ofn.lStructSize = sizeof(OPENFILENAME);
- ofn.hwndOwner = hDlg;
+ ofn.hwndOwner = hwndDlg;
ofn.lpstrFile = szFile;
ofn.nMaxFile = _countof(szFile);
ofn.lpstrFilter = _T("All files (*.*)\0*.*\0Text files (*.txt)\0*.txt\0Log files (*.log)\0*.log\0\0");
@@ -267,7 +267,7 @@ void ChooseFile(HWND hDlg)
if (GetSaveFileName(&ofn)) {
HANDLE hf = CreateFile(szFile,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);
if (hf != INVALID_HANDLE_VALUE) {
- SetDlgItemText(hDlg,IDC_FILE,szFile);
+ SetDlgItemText(hwndDlg,IDC_FILE,szFile);
mir_tstrncpy(WumfOptions.LogFile, szFile, MAX_PATH);
CloseHandle(hf);
}
@@ -275,7 +275,7 @@ void ChooseFile(HWND hDlg)
else if (CommDlgExtendedError() != 0) {
TCHAR str[256];
mir_sntprintf(str, _countof(str), TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError());
- MessageBox(hDlg, str, TranslateT("Error"), MB_OK | MB_ICONSTOP);
+ MessageBox(hwndDlg, str, TranslateT("Error"), MB_OK | MB_ICONSTOP);
}
}
diff --git a/plugins/WinterSpeak/src/DialogConfigActive.cpp b/plugins/WinterSpeak/src/DialogConfigActive.cpp
index 894865c17a..f6061d0258 100644
--- a/plugins/WinterSpeak/src/DialogConfigActive.cpp
+++ b/plugins/WinterSpeak/src/DialogConfigActive.cpp
@@ -21,59 +21,57 @@ DialogConfigActive::~DialogConfigActive()
//------------------------------------------------------------------------------
INT_PTR CALLBACK DialogConfigActive::process(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
{
- if (!m_instance)
- {
+ if (!m_instance) {
return 1;
}
- switch (message)
- {
- case WM_INITDIALOG:
- m_instance->load(window);
+ switch (message) {
+ case WM_INITDIALOG:
+ m_instance->load(window);
break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lparam)->idFrom) {
- case IDC_ACTIVE_USERS: {
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lparam)->idFrom) {
+ case IDC_ACTIVE_USERS:
+ {
m_instance->notify(window, lparam);
-
+
} break;
- case 0: {
- switch (reinterpret_cast<LPNMHDR>(lparam)->code)
- {
- case PSN_APPLY:
+ case 0:
+ {
+ switch (reinterpret_cast<LPNMHDR>(lparam)->code) {
+ case PSN_APPLY:
m_instance->save(window);
break;
- case LVN_ITEMCHANGED:
+ case LVN_ITEMCHANGED:
m_instance->changed(window);
break;
} break;
} break;
} break;
- case WM_COMMAND:
- switch (LOWORD(wparam))
- {
- case IDC_ACTIVE_OFFLINE:
- case IDC_ACTIVE_ONLINE:
- case IDC_ACTIVE_AWAY:
- case IDC_ACTIVE_DND:
- case IDC_ACTIVE_NA:
- case IDC_ACTIVE_OCCUPIED:
- case IDC_ACTIVE_FREEFORCHAT:
- case IDC_ACTIVE_INVISIBLE:
+ case WM_COMMAND:
+ switch (LOWORD(wparam)) {
+ case IDC_ACTIVE_OFFLINE:
+ case IDC_ACTIVE_ONLINE:
+ case IDC_ACTIVE_AWAY:
+ case IDC_ACTIVE_DND:
+ case IDC_ACTIVE_NA:
+ case IDC_ACTIVE_OCCUPIED:
+ case IDC_ACTIVE_FREEFORCHAT:
+ case IDC_ACTIVE_INVISIBLE:
m_instance->changed(window);
break;
- /*case IDC_ACTIVE_ALL:
- m_instance->selectAllUsers(window, true);
- break;*/
+ /*case IDC_ACTIVE_ALL:
+ m_instance->selectAllUsers(window, true);
+ break;*/
- /*case IDC_ACTIVE_NONE:
- m_instance->selectAllUsers(window, false);
- break;*/
+ /*case IDC_ACTIVE_NONE:
+ m_instance->selectAllUsers(window, false);
+ break;*/
- case IDC_ACTIVE_USERS:
+ case IDC_ACTIVE_USERS:
m_instance->changed(window);
break;
}
@@ -92,52 +90,53 @@ INT_PTR CALLBACK DialogConfigActive::process(HWND window, UINT message, WPARAM w
//------------------------------------------------------------------------------
// private:
//------------------------------------------------------------------------------
-void DialogConfigActive::notify(HWND hwndDlg, LPARAM lParam) {
+void DialogConfigActive::notify(HWND hwndDlg, LPARAM lParam)
+{
switch (((LPNMHDR)lParam)->code) {
- case CLN_NEWCONTACT:
- case CLN_LISTREBUILT:
- SetAllContactIcons( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS));
- //fall through
- case CLN_CONTACTMOVED:
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
- break;
- case CLN_OPTIONSCHANGED:
- ResetListOptions( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS));
- break;
- case CLN_CHECKCHANGED:
- m_instance->changed(hwndDlg);
- break;
- case NM_CLICK:
- {
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
- if (nm->iColumn == -1)
- break;
-
- DWORD hitFlags;
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
- break;
-
- if (nm->iColumn == 2) { // ignore all
- for (int iImage = 0;iImage<2;iImage++)
- SetIconsForColumn( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, iImage, iImage+3);
- }
- else if (nm->iColumn == 3) { // ignore none
- for (int iImage = 0;iImage<2;iImage++)
- SetIconsForColumn( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, iImage, 0);
- }
- else {
- int iImage = SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
- if (iImage == 0)
- iImage = nm->iColumn+3;
- else if (iImage != EMPTY_EXTRA_ICON)
- iImage = 0;
- SetIconsForColumn( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, nm->iColumn, iImage);
- }
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
- m_instance->changed(hwndDlg);
+ case CLN_NEWCONTACT:
+ case CLN_LISTREBUILT:
+ SetAllContactIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS));
+ //fall through
+ case CLN_CONTACTMOVED:
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ break;
+ case CLN_OPTIONSCHANGED:
+ ResetListOptions(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS));
+ break;
+ case CLN_CHECKCHANGED:
+ m_instance->changed(hwndDlg);
+ break;
+ case NM_CLICK:
+ {
+ NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
+ if (nm->iColumn == -1)
+ break;
+
+ DWORD hitFlags;
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
+ if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ break;
+
+ if (nm->iColumn == 2) { // ignore all
+ for (int iImage = 0; iImage < 2; iImage++)
+ SetIconsForColumn(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, iImage, iImage + 3);
}
- break;
+ else if (nm->iColumn == 3) { // ignore none
+ for (int iImage = 0; iImage < 2; iImage++)
+ SetIconsForColumn(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, iImage, 0);
+ }
+ else {
+ int iImage = SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
+ if (iImage == 0)
+ iImage = nm->iColumn + 3;
+ else if (iImage != EMPTY_EXTRA_ICON)
+ iImage = 0;
+ SetIconsForColumn(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), hItem, hItemAll, nm->iColumn, iImage);
+ }
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_ACTIVE_USERS), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_ACTIVE_USERS, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ m_instance->changed(hwndDlg);
+ }
+ break;
}
}
@@ -164,8 +163,8 @@ void DialogConfigActive::load(HWND window)
ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_USERONLINE);
SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- for (int i=0; i < _countof(hIcons); i++)
- hIcons[i] = ImageList_GetIcon(hIml, 1+i, ILD_NORMAL);
+ for (int i = 0; i < _countof(hIcons); i++)
+ hIcons[i] = ImageList_GetIcon(hIml, 1 + i, ILD_NORMAL);
SendDlgItemMessage(window, IDC_ALLICON, STM_SETICON, (WPARAM)hIcons[0], 0);
SendDlgItemMessage(window, IDC_NONEICON, STM_SETICON, (WPARAM)hIcons[1], 0);
@@ -176,12 +175,12 @@ void DialogConfigActive::load(HWND window)
SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_SETEXTRACOLUMNS, 4, 0);
{
- CLCINFOITEM cii = {0};
+ CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_GROUPFONT;
cii.pszText = TranslateT("** All contacts **");
hItemAll = (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
-
+
cii.pszText = TranslateT("** Unknown contacts **");
hItemUnknown = (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
ConfigDatabase::ActiveUsersMap active_users = m_db.getActiveUsers();
@@ -217,8 +216,9 @@ void DialogConfigActive::SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int
}
}
-void DialogConfigActive::SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int iColumn, int iImage) {
- switch ( SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hItem, 0)) {
+void DialogConfigActive::SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItem2, int iColumn, int iImage)
+{
+ switch (SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hItem, 0)) {
case CLCIT_CONTACT:
{
int oldiImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
@@ -227,7 +227,7 @@ void DialogConfigActive::SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE h
}
break;
case CLCIT_INFO:
- if (hItem == hItemAll)
+ if (hItem == hItem2)
SetAllChildIcons(hwndList, hItem, iColumn, iImage);
else
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage)); //hItemUnknown
@@ -240,24 +240,26 @@ void DialogConfigActive::SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE h
}
}
-void DialogConfigActive::InitialiseItem(HWND hwndList, HANDLE hItem, bool message, bool status) {
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (message)?0:3)); //Message
-
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, (status)?0:4)); //Online
+void DialogConfigActive::InitialiseItem(HWND hwndList, HANDLE hItem, bool message, bool status)
+{
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (message) ? 0 : 3)); //Message
+
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, (status) ? 0 : 4)); //Online
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(2, 1));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(3, 2));
}
-void DialogConfigActive::SetAllContactIcons(HWND hwndList) {
+void DialogConfigActive::SetAllContactIcons(HWND hwndList)
+{
ConfigDatabase::ActiveUsersMap active_users = m_db.getActiveUsers();
ConfigDatabase::ActiveUsersMap::const_iterator iter;
- for (iter = active_users.begin(); iter != active_users.end(); ++iter)
- {
+ for (iter = active_users.begin(); iter != active_users.end(); ++iter) {
MCONTACT hContact = iter->first;
- if(hContact == 0) {
-
- } else {
+ if (hContact == 0) {
+
+ }
+ else {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, 0)) == EMPTY_EXTRA_ICON) {
this->InitialiseItem(hwndList, hItem, iter->second.message, iter->second.status);
@@ -266,14 +268,16 @@ void DialogConfigActive::SetAllContactIcons(HWND hwndList) {
}
}
-void DialogConfigActive::ResetListOptions(HWND listview) {
+void DialogConfigActive::ResetListOptions(HWND listview)
+{
SendMessage(listview, CLM_SETHIDEEMPTYGROUPS, 1, 0);
SetWindowLongPtr(listview, GWL_STYLE, GetWindowLongPtr(listview, GWL_STYLE) | CLS_SHOWHIDDEN);
}
-void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount) {
- int iconOn[2] = {1, 1};
- int childCount[2] = {0, 0}, i;
+void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
+{
+ int iconOn[2] = { 1, 1 };
+ int childCount[2] = { 0, 0 }, i;
int iImage;
HANDLE hItem, hChildItem;
@@ -284,7 +288,7 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
while (hItem) {
hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for (i=0; i < _countof(iconOn); i++)
+ for (i = 0; i < _countof(iconOn); i++)
if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i] = 0;
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
@@ -292,7 +296,7 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (i=0; i < _countof(iconOn); i++) {
+ for (i = 0; i < _countof(iconOn); i++) {
iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if (iconOn[i] && iImage == 0) iconOn[i] = 0;
if (iImage != EMPTY_EXTRA_ICON)
@@ -301,9 +305,9 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for (i=0; i < _countof(iconOn); i++) {
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+3:0) : EMPTY_EXTRA_ICON));
- if (groupChildCount) groupChildCount[i]+=childCount[i];
+ for (i = 0; i < _countof(iconOn); i++) {
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i] ? (iconOn[i] ? i + 3 : 0) : EMPTY_EXTRA_ICON));
+ if (groupChildCount) groupChildCount[i] += childCount[i];
}
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(2, 1));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(3, 2));
@@ -313,36 +317,37 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
void DialogConfigActive::save(HWND window)
{
// store the checkboxes
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Online, (IsDlgButtonChecked(window, IDC_ACTIVE_ONLINE) != 0));
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Away, (IsDlgButtonChecked(window, IDC_ACTIVE_AWAY) != 0));
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Dnd, (IsDlgButtonChecked(window, IDC_ACTIVE_DND) != 0));
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Na, (IsDlgButtonChecked(window, IDC_ACTIVE_NA) != 0));
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Occupied, (IsDlgButtonChecked(window, IDC_ACTIVE_OCCUPIED) != 0));
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat, (IsDlgButtonChecked(window, IDC_ACTIVE_FREEFORCHAT) != 0));
- m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Invisible, (IsDlgButtonChecked(window, IDC_ACTIVE_INVISIBLE) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Online, (IsDlgButtonChecked(window, IDC_ACTIVE_ONLINE) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Away, (IsDlgButtonChecked(window, IDC_ACTIVE_AWAY) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Dnd, (IsDlgButtonChecked(window, IDC_ACTIVE_DND) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Na, (IsDlgButtonChecked(window, IDC_ACTIVE_NA) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Occupied, (IsDlgButtonChecked(window, IDC_ACTIVE_OCCUPIED) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat, (IsDlgButtonChecked(window, IDC_ACTIVE_FREEFORCHAT) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Invisible, (IsDlgButtonChecked(window, IDC_ACTIVE_INVISIBLE) != 0));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_FINDCONTACT, hContact, 0);
- if (hItem)
+ if (hItem)
SaveItemMask(GetDlgItem(window, IDC_ACTIVE_USERS), hContact, hItem);
}
- SaveItemMask( GetDlgItem(window, IDC_ACTIVE_USERS), NULL, hItemUnknown);
+ SaveItemMask(GetDlgItem(window, IDC_ACTIVE_USERS), NULL, hItemUnknown);
m_db.save();
}
-void DialogConfigActive::SaveItemMask(HWND hwndList, MCONTACT hContact, HANDLE hItem) {
+void DialogConfigActive::SaveItemMask(HWND hwndList, MCONTACT hContact, HANDLE hItem)
+{
ConfigDatabase::act mask;
mask.message = true;
mask.status = true;
- for (int i=0; i < 2; i++) {
+ for (int i = 0; i < 2; i++) {
int iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
if (iImage && iImage != EMPTY_EXTRA_ICON) {
- if(i == 1) { //Online
+ if (i == 1) { //Online
mask.status = false;
- }
- if(i == 0) { //message
+ }
+ if (i == 0) { //message
mask.message = false;
}
}
@@ -354,11 +359,8 @@ void DialogConfigActive::SaveItemMask(HWND hwndList, MCONTACT hContact, HANDLE h
void DialogConfigActive::selectAllUsers(HWND window, bool state)
{
HWND listview = GetDlgItem(window, IDC_ACTIVE_USERS);
-
for (int i = 0; i < ListView_GetItemCount(listview); ++i)
- {
ListView_SetCheckState(listview, i, state);
- }
changed(window);
}
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp
index 142e178c95..6de7c5a28e 100644
--- a/plugins/XSoundNotify/src/dialog.cpp
+++ b/plugins/XSoundNotify/src/dialog.cpp
@@ -11,74 +11,73 @@ There is no warranty.
static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ XSN_Data *p;
+
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- MCONTACT hContact = lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- WindowList_Add(hChangeSoundDlgList, hwndDlg, hContact);
- Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg");
- char* szProto = GetContactProto(hContact);
- PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- char* szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != NULL) {
- DBVARIANT dbvuid = { 0 };
- if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
- TCHAR uid[MAX_PATH];
- switch (dbvuid.type) {
- case DBVT_DWORD:
- _itot(dbvuid.dVal, uid, 10);
- break;
-
- case DBVT_ASCIIZ:
- mir_tstrcpy(uid, _A2T(dbvuid.pszVal));
- break;
-
- case DBVT_UTF8:
- mir_tstrcpy(uid, ptrT(mir_utf8decodeT(dbvuid.pszVal)));
- break;
+ {
+ TranslateDialogDefault(hwndDlg);
+ hContact = lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ WindowList_Add(hChangeSoundDlgList, hwndDlg, hContact);
+ Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg");
+ char* szProto = GetContactProto(hContact);
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
+ char* szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != NULL) {
+ DBVARIANT dbvuid = { 0 };
+ if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
+ TCHAR uid[MAX_PATH];
+ switch (dbvuid.type) {
+ case DBVT_DWORD:
+ _itot(dbvuid.dVal, uid, 10);
+ break;
+
+ case DBVT_ASCIIZ:
+ mir_tstrcpy(uid, _A2T(dbvuid.pszVal));
+ break;
+
+ case DBVT_UTF8:
+ mir_tstrcpy(uid, ptrT(mir_utf8decodeT(dbvuid.pszVal)));
+ break;
+ }
+
+ TCHAR *nick = (TCHAR *)pcli->pfnGetContactDisplayName(hContact, 0);
+ TCHAR value[100];
+ mir_sntprintf(value, _countof(value), TranslateT("Custom sound for %s (%s)"), nick, uid);
+ SetWindowText(hwndDlg, value);
+ db_free(&dbvuid);
}
-
- TCHAR *nick = (TCHAR *)pcli->pfnGetContactDisplayName(hContact, 0);
- TCHAR value[100];
- mir_sntprintf(value, _countof(value), TranslateT("Custom sound for %s (%s)"), nick, uid);
- SetWindowText(hwndDlg, value);
- db_free(&dbvuid);
}
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_CHOOSE_SOUND), TRUE);
- DBVARIANT dbv = { 0 };
- if (!db_get_ts(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), TRUE);
- SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(dbv.ptszVal));
- db_free(&dbv);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), FALSE);
- SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, TranslateT("Not set"));
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_IGNORE_SOUND), TRUE);
- CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL) {
- DBVARIANT dbv;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_CHOOSE_SOUND), TRUE);
+ DBVARIANT dbv = { 0 };
if (!db_get_ts(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
- XSN_Users.insert(new XSN_Data(hContact, dbv.ptszVal, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), TRUE);
+ SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(dbv.ptszVal));
db_free(&dbv);
}
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), FALSE);
+ SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, TranslateT("Not set"));
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_IGNORE_SOUND), TRUE);
+ CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ p = XSN_Users.find((XSN_Data *)&hContact);
+ if (p == NULL) {
+ ptrT name(db_get_tsa(hContact, SETTINGSNAME, SETTINGSKEY));
+ if (name != NULL)
+ XSN_Users.insert(new XSN_Data(hContact, name, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ }
}
- }
- return TRUE;
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ p = XSN_Users.find((XSN_Data *)&hContact);
if (p != NULL) {
if (mir_tstrcmpi(p->path, _T(""))) {
TCHAR shortpath[MAX_PATH];
@@ -87,55 +86,51 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
}
db_set_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, p->ignore);
}
- }
case IDCANCEL:
DestroyWindow(hwndDlg);
break;
case IDC_CONT_BUTTON_CHOOSE_SOUND:
- {
- TCHAR FileName[MAX_PATH];
- TCHAR *tszMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
-
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = sizeof(ofn);
- TCHAR tmp[MAX_PATH];
- if (GetModuleHandle(_T("bass_interface.dll")))
- mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c"), TranslateT("Sound files"), 0, 0, 0);
- else
- mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav)%c*.wav%c%c"), TranslateT("WAV files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
- ofn.lpstrFile = FileName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
- ofn.lpstrInitialDir = tszMirDir;
- *FileName = '\0';
- ofn.lpstrDefExt = _T("");
-
- if (GetOpenFileName(&ofn)) {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(FileName));
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL)
- XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
- else {
- _tcsncpy(p->path, FileName, _countof(p->path));
- p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0;
+ {
+ TCHAR FileName[MAX_PATH];
+ TCHAR *tszMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = sizeof(ofn);
+ TCHAR tmp[MAX_PATH];
+ if (GetModuleHandle(_T("bass_interface.dll")))
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c"), TranslateT("Sound files"), 0, 0, 0);
+ else
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav)%c*.wav%c%c"), TranslateT("WAV files"), 0, 0, 0);
+ ofn.lpstrFilter = tmp;
+ ofn.hwndOwner = 0;
+ ofn.lpstrFile = FileName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
+ ofn.lpstrInitialDir = tszMirDir;
+ *FileName = '\0';
+ ofn.lpstrDefExt = _T("");
+
+ if (GetOpenFileName(&ofn)) {
+ SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(FileName));
+ p = XSN_Users.find((XSN_Data *)&hContact);
+ if (p == NULL)
+ XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ else {
+ _tcsncpy(p->path, FileName, _countof(p->path));
+ p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0;
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), TRUE);
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), TRUE);
+ mir_free(tszMirDir);
}
- mir_free(tszMirDir);
- }
- break;
+ break;
case IDC_CONT_BUTTON_TEST_PLAY:
- {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ p = XSN_Users.find((XSN_Data *)&hContact);
isIgnoreSound = 0;
if (p == NULL) {
DBVARIANT dbv;
@@ -151,30 +146,25 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
PathToAbsoluteT(p->path, longpath);
SkinPlaySoundFile(longpath);
}
- }
- break;
+ break;
case IDC_CONT_BUTTON_RESET_SOUND:
- {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), FALSE);
CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, BST_UNCHECKED);
SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, TranslateT("Not set"));
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+
+ p = XSN_Users.find((XSN_Data *)&hContact);
if (p != NULL) {
XSN_Users.remove(p);
delete p;
}
db_unset(hContact, SETTINGSNAME, SETTINGSKEY);
db_unset(hContact, SETTINGSNAME, SETTINGSIGNOREKEY);
- }
- break;
+ break;
case IDC_CONT_IGNORE_SOUND:
- {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ p = XSN_Users.find((XSN_Data *)&hContact);
if (p == NULL) {
DBVARIANT dbv;
if (!db_get_ts(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
@@ -187,7 +177,6 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
}
else p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0;
}
- }
break;
case WM_CLOSE:
@@ -195,7 +184,6 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
break;
case WM_DESTROY:
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
Utils_SaveWindowPosition(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg");
WindowList_Remove(hChangeSoundDlgList, hwndDlg);
}