diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-21 11:02:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-21 11:02:56 +0000 |
commit | 951a4bd6c7cab7ecceb5ff693312b2e0fbfe4cd3 (patch) | |
tree | 81efd778566480feede1193305a8d3bdfb832fa4 /src/core/stdchat | |
parent | 0d7e53de732d0f90430639a036cad1c260429312 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@3664 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdchat')
-rw-r--r-- | src/core/stdchat/src/chat.h | 1 | ||||
-rw-r--r-- | src/core/stdchat/src/clist.cpp | 14 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 75 | ||||
-rw-r--r-- | src/core/stdchat/src/manager.cpp | 8 | ||||
-rw-r--r-- | src/core/stdchat/src/options.cpp | 26 | ||||
-rw-r--r-- | src/core/stdchat/src/services.cpp | 181 | ||||
-rw-r--r-- | src/core/stdchat/src/tools.cpp | 4 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 20 |
8 files changed, 139 insertions, 190 deletions
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 85fe43e19e..34562d4d52 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -431,7 +431,6 @@ void LoadLogFonts(void); void HookEvents(void);
void UnhookEvents(void);
void CreateServiceFunctions(void);
-void DestroyServiceFunctions(void);
void CreateHookableEvents(void);
void DestroyHookableEvents(void);
void TabsInit(void);
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index 687ed7f50b..83c2e04196 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -65,7 +65,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p } }
END_GROUPLOOP:
- DBWriteContactSettingWord( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
+ db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
DBWriteContactSettingTString(hContact, pszModule, "Nick", pszDisplayName );
return hContact;
}
@@ -78,11 +78,11 @@ END_GROUPLOOP: if ( pszGroup && lstrlen( pszGroup ) > 0 )
DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup );
else
- DBDeleteContactSetting( hContact, "CList", "Group" );
+ db_unset( hContact, "CList", "Group" );
DBWriteContactSettingTString( hContact, pszModule, "Nick", pszDisplayName );
DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom );
DBWriteContactSettingByte( hContact, pszModule, "ChatRoom", (BYTE)iType );
- DBWriteContactSettingWord( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
+ db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
return hContact;
}
@@ -91,8 +91,8 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) if ( hContact ) {
char* szProto = GetContactProto(hContact);
int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
- DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM) 0);
- DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ db_set_w(hContact, szProto,"ApparentMode",(LPARAM) 0);
+ db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return TRUE;
}
@@ -111,8 +111,8 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) if ( !pszModule || ( pszModule && !strcmp( pszModule, szProto ))) {
int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
if ( i != 0 ) {
- DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0);
- DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ db_set_w(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0);
+ db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
} } }
hContact = db_find_next(hContact);
}
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index d4a728150b..92be0f2cce 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -94,20 +94,19 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
- DBWriteContactSettingWord(NULL, "Chat", "SplitterY", (WORD)g_Settings.iSplitterY);
- DBWriteContactSettingDword(NULL, "Chat", "roomx", g_Settings.iX);
- DBWriteContactSettingDword(NULL, "Chat", "roomy", g_Settings.iY);
- DBWriteContactSettingDword(NULL, "Chat", "roomwidth" , g_Settings.iWidth);
- DBWriteContactSettingDword(NULL, "Chat", "roomheight", g_Settings.iHeight);
+ db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
+ db_set_w(NULL, "Chat", "SplitterY", (WORD)g_Settings.iSplitterY);
+ db_set_dw(NULL, "Chat", "roomx", g_Settings.iX);
+ db_set_dw(NULL, "Chat", "roomy", g_Settings.iY);
+ db_set_dw(NULL, "Chat", "roomwidth" , g_Settings.iWidth);
+ db_set_dw(NULL, "Chat", "roomheight", g_Settings.iHeight);
CList_SetAllOffline(TRUE, NULL);
- mir_free( pszActiveWndID );
- mir_free( pszActiveWndModule );
+ mir_free(pszActiveWndID);
+ mir_free(pszActiveWndModule);
DestroyMenu(g_hMenu);
- DestroyServiceFunctions();
DestroyHookableEvents();
FreeIcons();
OptionsUnInit();
@@ -119,34 +118,31 @@ extern "C" __declspec(dllexport) int Unload(void) void UpgradeCheck(void)
{
DWORD dwVersion = DBGetContactSettingDword(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9));
- if ( pluginInfo.version > dwVersion)
- {
- if (dwVersion < PLUGIN_MAKE_VERSION(0,3,0,0))
- {
- DBDeleteContactSetting(NULL, "ChatFonts", "Font18");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font18Col");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font18Set");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font18Size");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font18Sty");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font19");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font19Col");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font19Set");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font19Size");
- DBDeleteContactSetting(NULL, "ChatFonts", "Font19Sty");
- DBDeleteContactSetting(NULL, "Chat", "ColorNicklistLines");
- DBDeleteContactSetting(NULL, "Chat", "NicklistIndent");
- DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
- DBDeleteContactSetting(NULL, "Chat", "ShowFormatButtons");
- DBDeleteContactSetting(NULL, "Chat", "ShowLines");
- DBDeleteContactSetting(NULL, "Chat", "ShowName");
- DBDeleteContactSetting(NULL, "Chat", "ShowTopButtons");
- DBDeleteContactSetting(NULL, "Chat", "SplitterX");
- DBDeleteContactSetting(NULL, "Chat", "SplitterY");
- DBDeleteContactSetting(NULL, "Chat", "IconFlags");
- DBDeleteContactSetting(NULL, "Chat", "LogIndentEnabled");
- } }
-
- DBWriteContactSettingDword(NULL, "Chat", "OldVersion", pluginInfo.version);
+ if (pluginInfo.version > dwVersion && dwVersion < PLUGIN_MAKE_VERSION(0,3,0,0)) {
+ db_unset(NULL, "ChatFonts", "Font18");
+ db_unset(NULL, "ChatFonts", "Font18Col");
+ db_unset(NULL, "ChatFonts", "Font18Set");
+ db_unset(NULL, "ChatFonts", "Font18Size");
+ db_unset(NULL, "ChatFonts", "Font18Sty");
+ db_unset(NULL, "ChatFonts", "Font19");
+ db_unset(NULL, "ChatFonts", "Font19Col");
+ db_unset(NULL, "ChatFonts", "Font19Set");
+ db_unset(NULL, "ChatFonts", "Font19Size");
+ db_unset(NULL, "ChatFonts", "Font19Sty");
+ db_unset(NULL, "Chat", "ColorNicklistLines");
+ db_unset(NULL, "Chat", "NicklistIndent");
+ db_unset(NULL, "Chat", "NicklistRowDist");
+ db_unset(NULL, "Chat", "ShowFormatButtons");
+ db_unset(NULL, "Chat", "ShowLines");
+ db_unset(NULL, "Chat", "ShowName");
+ db_unset(NULL, "Chat", "ShowTopButtons");
+ db_unset(NULL, "Chat", "SplitterX");
+ db_unset(NULL, "Chat", "SplitterY");
+ db_unset(NULL, "Chat", "IconFlags");
+ db_unset(NULL, "Chat", "LogIndentEnabled");
+ }
+
+ db_set_dw(NULL, "Chat", "OldVersion", pluginInfo.version);
}
void LoadLogIcons(void)
@@ -175,10 +171,7 @@ void LoadLogIcons(void) void LoadIcons(void)
{
- int i;
-
- for(i = 0; i < 20; i++)
- hIcons[i] = NULL;
+ memset(hIcons, 0, sizeof(hIcons));
LoadLogIcons();
LoadMsgLogBitmaps();
diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp index 8e8ae5dfeb..00f6aa4d3b 100644 --- a/src/core/stdchat/src/manager.cpp +++ b/src/core/stdchat/src/manager.cpp @@ -138,7 +138,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta DBWriteContactSettingByte(pTemp->hContact, "CList", "Hidden", 1);*/
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);
@@ -607,9 +607,9 @@ 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);
+ db_set_w(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus);
}
if ( g_Settings.TabsEnable && g_TabSession.hWnd )
@@ -775,7 +775,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/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 8ad41172ce..c729fd5fe8 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -244,7 +244,7 @@ static void SaveBranch(HWND hwndTree, const struct branch_t *branch, HTREEITEM * iState |= branch[i].iMode;
if (iState&GC_EVENT_ADDSTATUS)
iState |= GC_EVENT_REMOVESTATUS;
- DBWriteContactSettingDword(NULL, "Chat", branch[i].szDBName, (DWORD)iState);
+ db_set_dw(NULL, "Chat", branch[i].szDBName, (DWORD)iState);
}
else DBWriteContactSettingByte(NULL, "Chat", branch[i].szDBName, bChecked);
} }
@@ -746,7 +746,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA mir_free(ptszText);
}
}
- else DBDeleteContactSetting(NULL, "Chat", "HighlightWords");
+ else db_unset(NULL, "Chat", "HighlightWords");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
if ( iLen > 0 ) {
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText,iLen + 1);
DBWriteContactSettingTString(NULL, "Chat", "LogDirectory", pszText);
}
- else DBDeleteContactSetting(NULL, "Chat", "LogDirectory");
+ else db_unset(NULL, "Chat", "LogDirectory");
CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)pszText, (LPARAM)g_Settings.pszLogDir);
@@ -764,7 +764,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen+1);
DBWriteContactSettingTString(NULL, "Chat", "LogTimestamp", pszText);
}
- else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp");
+ else db_unset(NULL, "Chat", "LogTimestamp");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
if ( iLen > 0 ) {
@@ -772,7 +772,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen+1);
DBWriteContactSettingTString(NULL, "Chat", "HeaderTime", pszText);
}
- else DBDeleteContactSetting(NULL, "Chat", "HeaderTime");
+ else db_unset(NULL, "Chat", "HeaderTime");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
if ( iLen > 0 ) {
@@ -780,7 +780,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText,iLen+1);
DBWriteContactSettingTString(NULL, "Chat", "HeaderIncoming", pszText);
}
- else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming");
+ else db_unset(NULL, "Chat", "HeaderIncoming");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
if ( iLen > 0 ) {
@@ -788,7 +788,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText,iLen+1);
DBWriteContactSettingTString(NULL, "Chat", "HeaderOutgoing", pszText);
}
- else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing");
+ else db_unset(NULL, "Chat", "HeaderOutgoing");
g_Settings.HighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED?TRUE:FALSE;
DBWriteContactSettingByte(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled);
@@ -799,9 +799,9 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)g_Settings.pszLogDir);
iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_GETPOS,0,0);
- DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
+ db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen);
iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_GETPOS,0,0);
- DBWriteContactSettingWord(NULL, "Chat", "LoggingLimit", (WORD)iLen);
+ db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen);
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
if (iLen > 0) {
@@ -816,7 +816,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if (iLen > 0)
DBWriteContactSettingByte(NULL, "Chat", "NicklistRowDist", (BYTE)iLen);
else
- DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
+ db_unset(NULL, "Chat", "NicklistRowDist");
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
@@ -888,12 +888,12 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN1,UDM_GETPOS,0,0);
g_Settings.iPopupTimeout = iLen;
- DBWriteContactSettingWord(NULL, "Chat", "PopupTimeout", (WORD)iLen);
+ db_set_w(NULL, "Chat", "PopupTimeout", (WORD)iLen);
g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg,IDC_BKG,CPM_GETCOLOUR,0,0);
- DBWriteContactSettingDword(NULL, "Chat", "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg,IDC_BKG,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, "Chat", "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg,IDC_BKG,CPM_GETCOLOUR,0,0));
g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg,IDC_TEXT,CPM_GETCOLOUR,0,0);
- DBWriteContactSettingDword(NULL, "Chat", "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg,IDC_TEXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, "Chat", "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg,IDC_TEXT,CPM_GETCOLOUR,0,0));
return TRUE;
}
break;
diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp index 797b729c5b..0edfd6f0a0 100644 --- a/src/core/stdchat/src/services.cpp +++ b/src/core/stdchat/src/services.cpp @@ -25,23 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_fontservice.h"
extern HICON hIcons[30];
-extern HIMAGELIST hImageList;
-extern HIMAGELIST hIconsList;
-extern BOOL SmileyAddInstalled;
-extern BOOL PopUpInstalled;
-extern BOOL IEviewInstalled;
-
-HANDLE hSendEvent;
-HANDLE hBuildMenuEvent ;
-HANDLE g_hModulesLoaded;
-HANDLE g_hModuleLoad;
-HANDLE g_hModuleUnload;
-HANDLE g_hSystemPreShutdown;
-HANDLE hJoinMenuItem, hLeaveMenuItem;
-HANDLE g_hHookPrebuildMenu;
-HANDLE g_hIconsChanged, g_hFontsChanged;
-HANDLE g_hSmileyOptionsChanged = NULL;
-HANDLE g_hIconsChanged2;
+extern HIMAGELIST hImageList, hIconsList;
+extern BOOL SmileyAddInstalled;
+extern BOOL PopUpInstalled;
+extern BOOL IEviewInstalled;
+
+HANDLE hSendEvent;
+HANDLE hBuildMenuEvent ;
+HANDLE hJoinMenuItem, hLeaveMenuItem;
SESSION_INFO g_TabSession;
CRITICAL_SECTION cs;
@@ -213,48 +204,6 @@ static int SmileyOptionsChanged(WPARAM wParam,LPARAM lParam) return 0;
}
-static int ModulesLoaded(WPARAM wParam,LPARAM lParam)
-{
- char* mods[3] = { "Chat", "ChatFonts" };
- CallService( "DBEditorpp/RegisterModule", (WPARAM)mods, 2 );
-
- RegisterFonts();
- AddIcons();
- LoadIcons();
- {
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = -2000090001;
- mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB;
- mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN );
- mi.pszName = LPGEN("&Join");
- mi.pszService = "GChat/JoinChat";
- hJoinMenuItem = Menu_AddContactMenuItem(&mi);
-
- mi.position = -2000090000;
- mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_LEAVE );
- mi.flags = CMIF_NOTOFFLINE | CMIF_ICONFROMICOLIB;
- mi.pszName = LPGEN("&Leave");
- mi.pszService = "GChat/LeaveChat";
- hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
- }
-
- g_hFontsChanged = HookEvent(ME_FONT_RELOAD, FontsChanged);
- g_hIconsChanged2 = HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
-
- if ( ServiceExists( MS_SMILEYADD_SHOWSELECTION )) {
- SmileyAddInstalled = TRUE;
- g_hSmileyOptionsChanged = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
- }
- if ( ServiceExists(MS_POPUP_ADDPOPUPEX))
- PopUpInstalled = TRUE;
-
- if ( ServiceExists( MS_IEVIEW_WINDOW ))
- IEviewInstalled = TRUE;
-
- CList_SetAllOffline(TRUE, NULL);
- return 0;
-}
-
static INT_PTR Service_GetCount(WPARAM wParam,LPARAM lParam)
{
int i;
@@ -415,7 +364,7 @@ static 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)
DBWriteContactSettingTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
@@ -794,77 +743,85 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) static int ModuleLoad(WPARAM wParam, LPARAM lParam)
{
- PLUGININFOEX* pluginInfo = (PLUGININFOEX*)wParam;
- if (!stricmp(pluginInfo->shortName, "popup plus") || !stricmp(pluginInfo->shortName, "yapp"))
- PopUpInstalled = TRUE;
+ PopUpInstalled = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
return 0;
}
-static int ModuleUnload(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Service creation
+
+static int ModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- PLUGININFOEX* pluginInfo = (PLUGININFOEX*)wParam;
- if (!stricmp(pluginInfo->shortName, "popup plus") || !stricmp(pluginInfo->shortName, "yapp"))
- PopUpInstalled = FALSE;
+ char* mods[3] = { "Chat", "ChatFonts" };
+ CallService( "DBEditorpp/RegisterModule", (WPARAM)mods, 2 );
+
+ RegisterFonts();
+ AddIcons();
+ LoadIcons();
+ {
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = -2000090001;
+ mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB;
+ mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN );
+ mi.pszName = LPGEN("&Join");
+ mi.pszService = "GChat/JoinChat";
+ hJoinMenuItem = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -2000090000;
+ mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_LEAVE );
+ mi.flags = CMIF_NOTOFFLINE | CMIF_ICONFROMICOLIB;
+ mi.pszName = LPGEN("&Leave");
+ mi.pszService = "GChat/LeaveChat";
+ hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
+ }
+
+ HookEvent(ME_FONT_RELOAD, FontsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
+
+ if ( ServiceExists( MS_SMILEYADD_SHOWSELECTION )) {
+ SmileyAddInstalled = TRUE;
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
+ }
+
+ ModuleLoad(0, 0);
+
+ if ( ServiceExists( MS_IEVIEW_WINDOW ))
+ IEviewInstalled = TRUE;
+
+ CList_SetAllOffline(TRUE, NULL);
return 0;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// Service creation
-
void HookEvents(void)
{
InitializeCriticalSection(&cs);
- g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- g_hModuleLoad = HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
- g_hModuleUnload = HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleUnload);
- g_hHookPrebuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu);
- g_hSystemPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- g_hIconsChanged = HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
}
void UnhookEvents(void)
{
- UnhookEvent(g_hModulesLoaded);
- UnhookEvent(g_hModuleLoad);
- UnhookEvent(g_hModuleUnload);
- UnhookEvent(g_hSystemPreShutdown);
- UnhookEvent(g_hHookPrebuildMenu);
- UnhookEvent(g_hIconsChanged);
- UnhookEvent(g_hIconsChanged2);
- UnhookEvent(g_hFontsChanged);
- if (g_hSmileyOptionsChanged)
- UnhookEvent(g_hSmileyOptionsChanged);
DeleteCriticalSection(&cs);
}
void CreateServiceFunctions(void)
{
- hServiceRegister = CreateServiceFunction(MS_GC_REGISTER, Service_Register);
- hServiceNewChat = CreateServiceFunction(MS_GC_NEWSESSION, Service_NewChat);
- hServiceAddEvent = CreateServiceFunction(MS_GC_EVENT, Service_AddEvent);
- hServiceGetAddEventPtr = CreateServiceFunction(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
- hServiceGetInfo = CreateServiceFunction(MS_GC_GETINFO, Service_GetInfo);
- hServiceGetCount = CreateServiceFunction(MS_GC_GETSESSIONCOUNT, Service_GetCount);
-
- hEventDoubleclicked = CreateServiceFunction("GChat/DblClickEvent", CList_EventDoubleclicked);
- hEventPrebuildMenu = CreateServiceFunction("GChat/PrebuildMenuEvent", CList_PrebuildContactMenuSvc);
- hEventJoinChat = CreateServiceFunction("GChat/JoinChat", CList_JoinChat);
- hEventLeaveChat = CreateServiceFunction("GChat/LeaveChat", CList_LeaveChat);
-}
-
-void DestroyServiceFunctions(void)
-{
- DestroyServiceFunction( hServiceRegister );
- DestroyServiceFunction( hServiceNewChat );
- DestroyServiceFunction( hServiceAddEvent );
- DestroyServiceFunction( hServiceGetAddEventPtr );
- DestroyServiceFunction( hServiceGetInfo );
- DestroyServiceFunction( hServiceGetCount );
-
- DestroyServiceFunction( hEventDoubleclicked );
- DestroyServiceFunction( hEventPrebuildMenu );
- DestroyServiceFunction( hEventJoinChat );
- DestroyServiceFunction( hEventLeaveChat );
+ CreateServiceFunction(MS_GC_REGISTER, Service_Register);
+ CreateServiceFunction(MS_GC_NEWSESSION, Service_NewChat);
+ CreateServiceFunction(MS_GC_EVENT, Service_AddEvent);
+ CreateServiceFunction(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
+ CreateServiceFunction(MS_GC_GETINFO, Service_GetInfo);
+ CreateServiceFunction(MS_GC_GETSESSIONCOUNT, Service_GetCount);
+
+ CreateServiceFunction("GChat/DblClickEvent", CList_EventDoubleclicked);
+ CreateServiceFunction("GChat/PrebuildMenuEvent", CList_PrebuildContactMenuSvc);
+ CreateServiceFunction("GChat/JoinChat", CList_JoinChat);
+ CreateServiceFunction("GChat/LeaveChat", CList_LeaveChat);
}
void CreateHookableEvents(void)
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index cc16567268..752e208cef 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -302,7 +302,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh if (!g_Settings.TabsEnable && bInactive && si->hWnd && DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0)
SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL);
if (DBGetContactSettingByte(si->hContact, "CList", "Hidden", 0) != 0)
- DBDeleteContactSetting(si->hContact, "CList", "Hidden");
+ db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
DoTrayIcon(si, gce);
if (bInactive || !g_Settings.PopUpInactiveOnly)
@@ -353,7 +353,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh if (bInactive && !( si->wState & STATE_TALK )) {
si->wState |= STATE_TALK;
- DBWriteContactSettingWord(si->hContact, si->pszModule,"ApparentMode",(LPARAM)(WORD) 40071);
+ db_set_w(si->hContact, si->pszModule,"ApparentMode",(LPARAM)(WORD) 40071);
}
if (g_Settings.TabsEnable && bInactive && g_TabSession.hWnd)
SendMessage(g_TabSession.hWnd, GC_SETTABHIGHLIGHT, 0, (LPARAM) si);
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index c844be5d40..59fc8e830d 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1749,7 +1749,7 @@ END_REMOVETAB: if (s) {
if (s->wState&STATE_TALK) {
s->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(s->hContact, s->pszModule ,"ApparentMode",(LPARAM) 0);
+ db_set_w(s->hContact, s->pszModule ,"ApparentMode",(LPARAM) 0);
}
if (s->wState&GC_EVENT_HIGHLIGHT) {
@@ -1790,7 +1790,7 @@ END_REMOVETAB: TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB),i, &tci);
s = (SESSION_INFO*)tci.lParam;
if (s && s->hContact && DBGetContactSettingWord(s->hContact, s->pszModule, "TabPosition", 0) != 0)
- DBWriteContactSettingWord(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
+ db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
} } }
break;
@@ -1941,15 +1941,15 @@ END_REMOVETAB: case SESSION_TERMINATE:
SendMessage(hwndDlg,GC_SAVEWNDPOS,0,0);
if (DBGetContactSettingByte(NULL, "Chat", "SavePosition", 0)) {
- DBWriteContactSettingDword(si->hContact, "Chat", "roomx", si->iX);
- DBWriteContactSettingDword(si->hContact, "Chat", "roomy", si->iY);
- DBWriteContactSettingDword(si->hContact, "Chat", "roomwidth" , si->iWidth);
- DBWriteContactSettingDword(si->hContact, "Chat", "roomheight", si->iHeight);
+ db_set_dw(si->hContact, "Chat", "roomx", si->iX);
+ db_set_dw(si->hContact, "Chat", "roomy", si->iY);
+ db_set_dw(si->hContact, "Chat", "roomwidth" , si->iWidth);
+ db_set_dw(si->hContact, "Chat", "roomheight", si->iHeight);
}
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ db_set_w(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
return TRUE;
@@ -2134,7 +2134,7 @@ LABEL_SHOWWINDOW: if (KillTimer(hwndDlg, TIMERID_FLASHWND))
FlashWindow(hwndDlg, FALSE);
if (DBGetContactSettingWord(si->hContact, si->pszModule ,"ApparentMode", 0) != 0)
- DBWriteContactSettingWord(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ db_set_w(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
}
@@ -2208,9 +2208,9 @@ LABEL_SHOWWINDOW: TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
if (!(GetMenuState(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND)&MF_CHECKED)) {
if (s->hContact)
- DBWriteContactSettingWord(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
+ db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
}
- else DBDeleteContactSetting(s->hContact, s->pszModule, "TabPosition");
+ else db_unset(s->hContact, s->pszModule, "TabPosition");
break;
} } } }
break;
|