summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-21 20:43:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-21 20:43:46 +0000
commit6f2c99a32c9e539fc61edb6b836e8805b013a180 (patch)
treeb0108fbaf865ad5dc7522a55f8ca272bf0df7600
parent365b792d3509d4e94cdc31ee4384bf458f152e59 (diff)
- unused constant MIRANDA_IDLE_INFO_SIZE_1 removed;
- proper tracking of autoaway sound options; - code cleanup for MIRANDA_IDLE_INFO initialization; git-svn-id: http://svn.miranda-ng.org/main/trunk@4156 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_idle.h2
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp14
-rw-r--r--plugins/SmileyAdd/src/smileys.cpp18
-rw-r--r--protocols/AimOscar/src/services.cpp5
-rw-r--r--protocols/JabberG/src/jabber_events.cpp8
-rw-r--r--src/core/stdautoaway/autoaway.cpp13
-rw-r--r--src/core/stdaway/sendmsg.cpp3
-rw-r--r--src/core/stdidle/idle.cpp6
8 files changed, 29 insertions, 40 deletions
diff --git a/include/m_idle.h b/include/m_idle.h
index 5fed10c55a..bdcf0b3c0f 100644
--- a/include/m_idle.h
+++ b/include/m_idle.h
@@ -48,8 +48,6 @@ for short idle.*/
*/
#define ME_IDLE_CHANGED "Miranda/Idle/Changed"
-#define MIRANDA_IDLE_INFO_SIZE_1 20
-
typedef struct {
int cbSize; // sizeof()
int idleTime; // idle in mins, if zero then disabled
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 350f99f536..4a7dd0e047 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -991,13 +991,15 @@ void InitStatusList()
VOID CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
- if (uMsg == WM_TIMER)
- {
- char szProto[256];
- //We've received a timer message: enable the popups for a specified protocol.
+ if (uMsg == WM_TIMER) {
KillTimer(hwnd, idEvent);
- DWORD dwResult = (DWORD)GetAtomNameA((ATOM)idEvent, szProto, sizeof(szProto));
- if (dwResult) db_set_b(0, MODULE, szProto, 1);
+
+ //We've received a timer message: enable the popups for a specified protocol.
+ char szProto[256];
+ if ( GetAtomNameA((ATOM)idEvent, szProto, sizeof(szProto)) > 0) {
+ db_set_b(0, MODULE, szProto, 1);
+ DeleteAtom((ATOM)idEvent);
+ }
}
}
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp
index 706764a81c..75df1bfadd 100644
--- a/plugins/SmileyAdd/src/smileys.cpp
+++ b/plugins/SmileyAdd/src/smileys.cpp
@@ -304,8 +304,7 @@ bool SmileyPackType::LoadSmileyFile(const bkstring& filename, bool onlyInfo, boo
{
Clear();
- if (filename.empty())
- {
+ if (filename.empty()) {
m_Name = _T("Nothing loaded");
return false;
}
@@ -315,10 +314,8 @@ bool SmileyPackType::LoadSmileyFile(const bkstring& filename, bool onlyInfo, boo
// Load xep file
int fh = _topen(modpath.c_str(), _O_BINARY | _O_RDONLY);
- if (fh == -1)
- {
- if (!noerr)
- {
+ if (fh == -1) {
+ if (!noerr) {
static const TCHAR errmsg[] = LPGENT("Smiley Pack %s not found.\nSelect correct Smiley Pack in the Miranda Options | Customize | Smileys.");
TCHAR msgtxt[1024];
mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), modpath.c_str());
@@ -347,17 +344,11 @@ bool SmileyPackType::LoadSmileyFile(const bkstring& filename, bool onlyInfo, boo
bkstring tbuf;
if (len>2 && *(wchar_t*)buf == 0xfeff)
- {
tbuf = W2T_SM((wchar_t*)buf+1);
- }
else if (len>3 && buf[0]=='\xef' && buf[1]=='\xbb' && buf[2]=='\xbf')
- {
tbuf = W2T_SM(A2W_SM(buf+3, CP_UTF8));
- }
else
- {
tbuf = A2T_SM(buf);
- }
delete[] buf;
@@ -367,7 +358,8 @@ bool SmileyPackType::LoadSmileyFile(const bkstring& filename, bool onlyInfo, boo
else
res = LoadSmileyFileXEP(tbuf, onlyInfo, modpath);
- if (errorFound) ReportError(TranslateT("There were problems loading smiley pack (it should be corrected).\nSee Network Log for details."));
+ if (errorFound)
+ ReportError(TranslateT("There were problems loading smiley pack (it should be corrected).\nSee Network Log for details."));
return res;
}
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index caf2209560..3ab5b37754 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -51,9 +51,8 @@ int CAimProto::OnIdleChanged(WPARAM /*wParam*/, LPARAM lParam)
if (bIdle) //don't want to change idle time if we are already idle
{
- MIRANDA_IDLE_INFO mii = {0};
- mii.cbSize = sizeof(mii);
- CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM) & mii);
+ MIRANDA_IDLE_INFO mii = { sizeof(mii) };
+ CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
idle = 1;
aim_set_idle(hServerConn,seqno,mii.idleTime * 60);
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 32e71215ea..4baa572ed0 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -225,11 +225,11 @@ int CJabberProto::OnIdleChanged(WPARAM, LPARAM lParam)
}
if (lParam & IDF_ISIDLE) {
- MIRANDA_IDLE_INFO mii = { 0 };
- mii.cbSize = sizeof(mii);
+ MIRANDA_IDLE_INFO mii = { sizeof(mii) };
CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
m_tmJabberIdleStartTime = time(0) - mii.idleTime * 60;
- } else
- m_tmJabberIdleStartTime = 0;
+ }
+ else m_tmJabberIdleStartTime = 0;
+
return 0;
}
diff --git a/src/core/stdautoaway/autoaway.cpp b/src/core/stdautoaway/autoaway.cpp
index 4e5d9e7fd8..a96c788c48 100644
--- a/src/core/stdautoaway/autoaway.cpp
+++ b/src/core/stdautoaway/autoaway.cpp
@@ -66,9 +66,13 @@ static void Proto_SetStatus(const char* szProto, unsigned status)
static int AutoAwayEvent(WPARAM, LPARAM lParam)
{
- MIRANDA_IDLE_INFO mii;
- mii.cbSize = sizeof(mii);
+ MIRANDA_IDLE_INFO mii = { sizeof(mii) };
CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
+
+ if (mii.idlesoundsoff)
+ iBreakSounds = (lParam & IDF_ISIDLE) != 0;
+
+ // we don't need to switch the status
if (mii.aaStatus == 0)
return 0;
@@ -109,13 +113,10 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam)
}
}
- if (mii.idlesoundsoff)
- iBreakSounds = (lParam & IDF_ISIDLE) != 0;
-
return 0;
}
-int LoadAutoAwayModule(void)
+int LoadAutoAwayModule()
{
HookEvent(ME_SKIN_PLAYINGSOUND, AutoAwaySound);
HookEvent(ME_IDLE_CHANGED, AutoAwayEvent);
diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp
index ac9c01d74d..c0742aeb9a 100644
--- a/src/core/stdaway/sendmsg.cpp
+++ b/src/core/stdaway/sendmsg.cpp
@@ -111,8 +111,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto)
TCHAR substituteStr[128];
if ( !_tcsnicmp(dbv.ptszVal + i, _T("%time%"), 6)) {
- MIRANDA_IDLE_INFO mii = {0};
- mii.cbSize = sizeof(mii);
+ MIRANDA_IDLE_INFO mii = { sizeof(mii) };
CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii);
if (mii.idleType == 1) {
diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp
index fc547c8b92..3f73f6511f 100644
--- a/src/core/stdidle/idle.cpp
+++ b/src/core/stdidle/idle.cpp
@@ -460,7 +460,7 @@ static int IdleOptInit(WPARAM wParam, LPARAM)
static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam)
{
MIRANDA_IDLE_INFO *mii = (MIRANDA_IDLE_INFO*)lParam;
- if ( !mii || (mii->cbSize != sizeof(MIRANDA_IDLE_INFO) && mii->cbSize != MIRANDA_IDLE_INFO_SIZE_1))
+ if ( !mii || mii->cbSize != sizeof(MIRANDA_IDLE_INFO))
return 1;
mii->idleTime = gIdleObject.minutes;
@@ -468,9 +468,7 @@ static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam)
mii->aaStatus = gIdleObject.aastatus;
mii->aaLock = gIdleObject.state&0x20;
mii->idlesoundsoff = gIdleObject.aasoundsoff;
-
- if (mii->cbSize == sizeof(MIRANDA_IDLE_INFO))
- mii->idleType = gIdleObject.idleType;
+ mii->idleType = gIdleObject.idleType;
return 0;
}