summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/chat
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-26 20:04:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-26 20:04:19 +0000
commit0ff5363fc3c387364947df74da71790eb0c4c1a3 (patch)
tree73fec09994495436e38126530b2689fadb348d1d /plugins/TabSRMM/src/chat
parent10bf2c45f3592efcfb662c1c9cc7ba163f32a523 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4205 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat')
-rw-r--r--plugins/TabSRMM/src/chat/clist.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/manager.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp12
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp146
6 files changed, 81 insertions, 89 deletions
diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp
index d465202497..fbc3f290dd 100644
--- a/plugins/TabSRMM/src/chat/clist.cpp
+++ b/plugins/TabSRMM/src/chat/clist.cpp
@@ -89,7 +89,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p
if (pszGroup && lstrlen(pszGroup) > 0)
CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)hContact, (LPARAM)g_Settings.hGroup);
else
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
M->WriteTString(hContact, pszModule, "Nick", pszDisplayName);
M->WriteTString(hContact, pszModule, "ChatRoomID", pszRoom);
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp
index 090f4ce119..2649cb2a24 100644
--- a/plugins/TabSRMM/src/chat/manager.cpp
+++ b/plugins/TabSRMM/src/chat/manager.cpp
@@ -125,7 +125,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, bool removeConta
}
DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule , "Topic", "");
DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "StatusBar", "");
- DBDeleteContactSetting(pTemp->hContact, "CList", "StatusMsg");
+ db_unset(pTemp->hContact, "CList", "StatusMsg");
if (removeContact)
CallService(MS_DB_CONTACT_DELETE, (WPARAM)pTemp->hContact, 0);
@@ -608,7 +608,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus)
if (pTemp->hContact) {
if (pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE)
- DBDeleteContactSetting(pTemp->hContact, "CList", "Hidden");
+ db_unset(pTemp->hContact, "CList", "Hidden");
DBWriteContactSettingWord(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus);
}
@@ -703,7 +703,7 @@ BOOL SM_RemoveAll(void)
if (m_WndList->hContact)
CList_SetOffline(m_WndList->hContact, m_WndList->iType == GCW_CHATROOM ? TRUE : FALSE);
DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule , "Topic", "");
- DBDeleteContactSetting(m_WndList->hContact, "CList", "StatusMsg");
+ db_unset(m_WndList->hContact, "CList", "StatusMsg");
DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule, "StatusBar", "");
UM_RemoveAll(&m_WndList->pUsers);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index d74e321c5d..497a5de887 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -1044,7 +1044,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE;
M->WriteByte("Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
} else {
- DBDeleteContactSetting(NULL, "Chat", "LogDirectory");
+ db_unset(NULL, "Chat", "LogDirectory");
M->WriteByte("Chat", "LoggingEnabled", 0);
}
SM_InvalidateLogDirectories();
@@ -1056,35 +1056,35 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
if (iLen > 0)
M->WriteByte("Chat", "NicklistRowDist", (BYTE)iLen);
else
- DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
+ db_unset(NULL, "Chat", "NicklistRowDist");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp");
+ } else db_unset(NULL, "Chat", "LogTimestamp");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderTime");
+ } else db_unset(NULL, "Chat", "HeaderTime");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming");
+ } else db_unset(NULL, "Chat", "HeaderIncoming");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing");
+ } else db_unset(NULL, "Chat", "HeaderOutgoing");
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index ed4907467a..299fcd5b1d 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -246,7 +246,7 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
si->hContact = CList_AddRoom(gcw->pszModule, ptszID, szTemp, si->iType);
DBWriteContactSettingString(si->hContact, si->pszModule , "Topic", "");
- DBDeleteContactSetting(si->hContact, "CList", "StatusMsg");
+ db_unset(si->hContact, "CList", "StatusMsg");
if (si->ptszStatusbarText)
M->WriteTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index 254459ccd7..7f3f8985d4 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -538,7 +538,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh
gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
params->sound = "ChatHighlight";
if (M->GetByte(si->hContact, "CList", "Hidden", 0) != 0)
- DBDeleteContactSetting(si->hContact, "CList", "Hidden");
+ db_unset(si->hContact, "CList", "Hidden");
if (params->bInactive) {
fFlagUnread = true;
DoTrayIcon(si, gce);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 0184c0e36f..863198f1e9 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -746,8 +746,6 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case 0x17:
PostMessage(hwndParent, WM_CLOSE, 0, 1);
return 0;
- default:
- break;
}
}
}
@@ -1197,8 +1195,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (si) {
if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "FilterFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "FilterMask");
+ db_unset(si->hContact, "Chat", "FilterFlags");
+ db_unset(si->hContact, "Chat", "FilterMask");
} else {
M->WriteDword(si->hContact, "Chat", "FilterFlags", iFlags);
M->WriteDword(si->hContact, "Chat", "FilterMask", dwMask);
@@ -1218,8 +1216,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (si) {
if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "PopupFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "PopupMask");
+ db_unset(si->hContact, "Chat", "PopupFlags");
+ db_unset(si->hContact, "Chat", "PopupMask");
} else {
M->WriteDword(si->hContact, "Chat", "PopupFlags", iFlags);
M->WriteDword(si->hContact, "Chat", "PopupMask", dwMask);
@@ -1238,8 +1236,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (si) {
if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "TrayIconFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "TrayIconMask");
+ db_unset(si->hContact, "Chat", "TrayIconFlags");
+ db_unset(si->hContact, "Chat", "TrayIconMask");
} else {
M->WriteDword(si->hContact, "Chat", "TrayIconFlags", iFlags);
M->WriteDword(si->hContact, "Chat", "TrayIconMask", dwMask);
@@ -1734,9 +1732,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
break;
- default: {
+ default:
int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
-
if (iCount != LB_ERR) {
int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
@@ -1758,9 +1755,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
}
}
- //DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
break;
- }
}
DestroyGCMenu(&hMenu, 1);
return TRUE;
@@ -2714,23 +2709,21 @@ LABEL_SHOWWINDOW:
LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
if (mim_hotkey_check)
dat->fkeyProcessed = true;
- switch(mim_hotkey_check) { // nothing (yet) FIXME
- case TABSRMM_HK_CHANNELMGR:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_FILTERTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_LISTTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_MUC_SHOWSERVER:
- if (si->iType != GCW_SERVER)
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
- return(_dlgReturn(hwndDlg, 1));
- default:
- break;
+ switch(mim_hotkey_check) { // nothing (yet) FIXME
+ case TABSRMM_HK_CHANNELMGR:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_FILTERTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_LISTTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_MUC_SHOWSERVER:
+ if (si->iType != GCW_SERVER)
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
+ return(_dlgReturn(hwndDlg, 1));
}
}
@@ -2796,53 +2789,52 @@ LABEL_SHOWWINDOW:
if ((uID > 800 && uID < 1400) || uID == CP_UTF8 || uID == 20866) {
dat->codePage = uID;
M->WriteDword(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
- } else if (uID == 500) {
+ }
+ else if (uID == 500) {
dat->codePage = CP_ACP;
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
- } else {
- switch (uID) {
- case 0:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
- SendMessage(pNmhdr->hwndFrom, WM_COPY, 0, 0);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
+ }
+ else switch (uID) {
+ case 0:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_CLEARLOG:
- ClearLog(dat);
- break;
+ case ID_COPYALL:
+ SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
+ SendMessage(pNmhdr->hwndFrom, WM_COPY, 0, 0);
+ SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel);
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_SEARCH_GOOGLE: {
- TCHAR szURL[4096];
- if (pszWord[0]) {
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- break;
+ case ID_CLEARLOG:
+ ClearLog(dat);
+ break;
- case ID_SEARCH_WIKIPEDIA: {
- TCHAR szURL[4096];
- if (pszWord[0]) {
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- break;
+ case ID_SEARCH_GOOGLE:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
+ }
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- default:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
- break;
+ case ID_SEARCH_WIKIPEDIA:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
}
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ default:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
+ break;
}
+
if (si->iType != GCW_SERVER && !(si->dwFlags & GC_UNICODE)) {
pos = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, pos - 1, MF_BYPOSITION);
@@ -2955,16 +2947,16 @@ LABEL_SHOWWINDOW:
CopyMemory(&uiNew, ui, sizeof(USERINFO));
uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, NULL);
switch (uID) {
- case 0:
- break;
+ case 0:
+ break;
- case ID_MESS:
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
+ case ID_MESS:
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
- default:
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
+ default:
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ break;
}
DestroyGCMenu(&hMenu, 1);
return TRUE;