summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/chat/chat.h2
-rw-r--r--plugins/TabSRMM/src/chat/manager.cpp40
2 files changed, 14 insertions, 28 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index f64b71728c..38ca3e9bd9 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -154,7 +154,7 @@ struct STATUSINFO
{
TCHAR *pszGroup;
HICON hIcon;
- WORD Status;
+ DWORD Status;
STATUSINFO *next;
};
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp
index fcb5daf808..8171ea2dcc 100644
--- a/plugins/TabSRMM/src/chat/manager.cpp
+++ b/plugins/TabSRMM/src/chat/manager.cpp
@@ -751,7 +751,6 @@ SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem)
}
return NULL;
-
}
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent)
@@ -903,8 +902,7 @@ STATUSINFO * TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int
return NULL;
if (!TM_FindStatus(*ppStatusList, pszStatus)) {
- STATUSINFO *node = (STATUSINFO*) mir_alloc(sizeof(STATUSINFO));
- ZeroMemory(node, sizeof(STATUSINFO));
+ STATUSINFO *node = (STATUSINFO*)mir_calloc(sizeof(STATUSINFO));
replaceStrT(node->pszGroup, pszStatus);
node->hIcon = (HICON)(*iCount);
while ((int)node->hIcon > STATUSICONCOUNT - 1)
@@ -927,60 +925,48 @@ STATUSINFO * TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int
STATUSINFO * TM_FindStatus(STATUSINFO* pStatusList, const TCHAR* pszStatus)
{
- STATUSINFO *pTemp = pStatusList;
-
if (!pStatusList || !pszStatus)
return NULL;
- while (pTemp != NULL) {
- if (lstrcmpi(pTemp->pszGroup, pszStatus) == 0)
- return pTemp;
+ for (STATUSINFO *si = pStatusList; si != NULL; si = si->next)
+ if (lstrcmpi(si->pszGroup, pszStatus) == 0)
+ return si;
- pTemp = pTemp->next;
- }
return 0;
}
WORD TM_StringToWord(STATUSINFO* pStatusList, const TCHAR* pszStatus)
{
- STATUSINFO *pTemp = pStatusList;
-
if (!pStatusList || !pszStatus)
return 0;
- while (pTemp != NULL) {
- if (lstrcmpi(pTemp->pszGroup, pszStatus) == 0)
- return pTemp->Status;
+ for (STATUSINFO *si = pStatusList; si != NULL; si = si->next) {
+ if (lstrcmpi(si->pszGroup, pszStatus) == 0)
+ return si->Status;
- if (pTemp->next == NULL)
+ if (si->next == NULL)
return pStatusList->Status;
-
- pTemp = pTemp->next;
}
return 0;
}
TCHAR* TM_WordToString(STATUSINFO* pStatusList, WORD Status)
{
- STATUSINFO *pTemp = pStatusList;
-
if (!pStatusList)
return NULL;
- while (pTemp != NULL) {
- if (pTemp->Status&Status) {
- Status -= pTemp->Status;
+ for (STATUSINFO *si = pStatusList; si != NULL; si = si->next)
+ if (si->Status&Status) {
+ Status -= si->Status;
if (Status == 0)
- return pTemp->pszGroup;
+ return si->pszGroup;
}
- pTemp = pTemp->next;
- }
+
return 0;
}
BOOL TM_RemoveAll(STATUSINFO** ppStatusList)
{
-
if (!ppStatusList)
return FALSE;