summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-23 20:43:50 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-23 20:43:50 +0000
commitfd833d6ff60603f6caf772864f39ebf0a64b5b8b (patch)
tree865133996052f321f7b594f6377390d955bdfef2 /plugins/TabSRMM/src
parent90e458dac28dc98d60ab00b35ddcfd09fb46811a (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@5462 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat/clist.cpp47
-rw-r--r--plugins/TabSRMM/src/container.cpp4
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp6
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp2
7 files changed, 30 insertions, 35 deletions
diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp
index b570c360f1..56ae11297d 100644
--- a/plugins/TabSRMM/src/chat/clist.cpp
+++ b/plugins/TabSRMM/src/chat/clist.cpp
@@ -71,8 +71,8 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p
if (lstrlen(dbv.ptszVal) > 0)
lstrcpyn(pszGroup, dbv.ptszVal, 50);
db_free(&dbv);
- } else
- lstrcpyn(pszGroup, _T("Chat rooms"), 50);
+ }
+ else lstrcpyn(pszGroup, _T("Chat rooms"), 50);
if (pszGroup[0])
CList_CreateGroup(pszGroup);
@@ -101,7 +101,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p
BOOL CList_SetOffline(HANDLE hContact, BOOL bHide)
{
if (hContact) {
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto == NULL)
return FALSE;
@@ -131,20 +131,16 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule)
int CList_RoomDoubleclicked(WPARAM wParam, LPARAM lParam)
{
- DBVARIANT dbv;
- char *szProto;
- BOOL bRedrawFlag = FALSE;
- bool fCreate = false;
-
HANDLE hContact = (HANDLE)wParam;
if (!hContact)
return 0;
- szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (MM_FindModule(szProto)) {
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
+ DBVARIANT dbv;
if (!db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) {
SESSION_INFO *si = SM_FindSession(dbv.ptszVal, szProto);
if (si) {
@@ -158,11 +154,9 @@ int CList_RoomDoubleclicked(WPARAM wParam, LPARAM lParam)
db_free(&dbv);
return 1;
}
- else
- fCreate = true;
ShowRoom(si, WINDOW_VISIBLE, TRUE);
- if (lParam && fCreate) {
+ if (lParam) {
SendMessage(si->hWnd, DM_ACTIVATEME, 0, 0);
if (si->dat)
SetForegroundWindow(si->dat->pContainer->hwnd);
@@ -184,10 +178,10 @@ INT_PTR CList_EventDoubleclicked(WPARAM wParam, LPARAM lParam)
INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- if ( hContact ) {
- char* szProto = GetContactProto(hContact);
- if ( szProto ) {
- if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE )
+ if (hContact) {
+ char *szProto = GetContactProto(hContact);
+ if (szProto) {
+ if ( db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE)
CallProtoService( szProto, PS_JOINCHAT, wParam, lParam );
else
CList_RoomDoubleclicked( wParam, 0 );
@@ -199,9 +193,9 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam)
INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- if ( hContact ) {
- char* szProto = GetContactProto(hContact);
- if ( szProto )
+ if (hContact) {
+ char *szProto = GetContactProto(hContact);
+ if (szProto)
CallProtoService( szProto, PS_LEAVECHAT, wParam, lParam );
}
return 0;
@@ -215,7 +209,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
bool bEnabled = false;
char *szProto = GetContactProto(hContact);
- if ( szProto ) {
+ if (szProto) {
// display this menu item only for chats
if ( db_get_b(hContact, szProto, "ChatRoom", 0 )) {
// still hide it for offline protos
@@ -259,17 +253,17 @@ void CList_CreateGroup(TCHAR* group)
BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, const TCHAR* fmt, ...)
{
- CLISTEVENT cle;
- va_list marker;
- TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR));
-
if (!fmt || lstrlen(fmt) < 1 || lstrlen(fmt) > 2000)
return FALSE;
+ TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR));
+
+ va_list marker;
va_start(marker, fmt);
- _vstprintf(szBuf, fmt, marker); //!!!!!!!!
+ mir_vsntprintf(szBuf, 4096, fmt, marker);
va_end(marker);
+ CLISTEVENT cle;
cle.cbSize = sizeof(cle);
cle.hContact = (HANDLE)hContact;
cle.hDbEvent = (HANDLE)event;
@@ -280,7 +274,8 @@ BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, const T
if (type) {
if (!CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0))
CallService(MS_CLIST_ADDEVENT, (WPARAM)hContact, (LPARAM)&cle);
- } else {
+ }
+ else {
if (CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)"chaticon");
CallService(MS_CLIST_ADDEVENT, (WPARAM)hContact, (LPARAM)&cle);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 366f68534f..a5709b5b1c 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1019,8 +1019,8 @@ panel_found:
if (dat && dat->bType == SESSIONTYPE_CHAT) {
SESSION_INFO *si = (SESSION_INFO *)dat->si;
if (si && dat->hContact) {
- char* szProto = GetContactProto(dat->hContact);
- if ( szProto )
+ char *szProto = GetContactProto(dat->hContact);
+ if (szProto)
CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
}
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 456462c8a2..ea6872ee57 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1283,7 +1283,7 @@ void TSAPI DM_NotifyTyping(struct TWindowData *dat, int mode)
DWORD protoStatus;
DWORD protoCaps;
DWORD typeCaps;
- const char* szProto = 0;
+ const char *szProto = 0;
HANDLE hContact = 0;
if (!dat || !dat->hContact)
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 903c6e8107..6d59a61164 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -540,7 +540,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
*/
void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
{
- const char* szProto = m_dat->cache->getActiveProto();
+ const char *szProto = m_dat->cache->getActiveProto();
SIZE sProto = {0}, sStatus = {0}, sTime = {0};
DWORD oldPanelStatusCX = m_dat->panelStatusCX;
RECT rc;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 53d9445103..76163893b6 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -94,7 +94,7 @@ static BOOL IsStringValidLinkA(char* pszText)
BOOL TSAPI IsUtfSendAvailable(HANDLE hContact)
{
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto == NULL)
return FALSE;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 2dac49be97..2385b9fed7 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -382,8 +382,8 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
if (dat && dat->bType == SESSIONTYPE_CHAT) {
SESSION_INFO *si = (SESSION_INFO *)dat->si;
if ( (si != NULL) && (dat->hContact != NULL)) {
- char* szProto = GetContactProto(dat->hContact);
- if ( szProto )
+ char *szProto = GetContactProto(dat->hContact);
+ if (szProto)
CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
}
}
@@ -2399,7 +2399,7 @@ void TSAPI SendHBitmapAsFile(const TWindowData* dat, HBITMAP hbmp)
size_t tempdirlen = GetTempPath(MAX_PATH, filename);
bool fSend = true;
- const char* szProto = dat->cache->getActiveProto();
+ const char *szProto = dat->cache->getActiveProto();
WORD wMyStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
DWORD protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 36c98becab..b2de192a5a 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -397,7 +397,7 @@ int CSendLater::sendIt(CSendLaterJob *job)
time_t now = time(0);
DWORD dwFlags = 0;
DBVARIANT dbv = {0};
- const char* szProto = 0;
+ const char *szProto = 0;
if (job->bCode == CSendLaterJob::JOB_HOLD || job->bCode == CSendLaterJob::JOB_DEFERRED || job->fSuccess || job->fFailed || job->lastSent > now)