diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-31 20:14:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-31 20:14:20 +0000 |
commit | 80fd782ef78a302f77f5f58e08e32c7a29e2105a (patch) | |
tree | 470718282d0c773f9b9991acab43d3d114a2e4b5 | |
parent | 53cec16b92d36308314adc22dc5fa992fd832571 (diff) |
HistoryEvents & HistoryKeeper support removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4269 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
24 files changed, 791 insertions, 1489 deletions
diff --git a/plugins/ExternalAPI/m_historyevents.h b/plugins/ExternalAPI/m_historyevents.h deleted file mode 100644 index 71cf8fdcf1..0000000000 --- a/plugins/ExternalAPI/m_historyevents.h +++ /dev/null @@ -1,453 +0,0 @@ -/*
-Copyright (C) 2006 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-
-#ifndef __M_HISTORYEVENTS_H__
-# define __M_HISTORYEVENTS_H__
-
-
-#define MIID_HISTORYEVENTS { 0xc8be8543, 0x6618, 0x4030, { 0x85, 0xcf, 0x90, 0x82, 0xc7, 0xde, 0x7f, 0xf7 } }
-
-
-#define HISTORYEVENTS_FORMAT_CHAR 1
-#define HISTORYEVENTS_FORMAT_WCHAR 2
-#define HISTORYEVENTS_FORMAT_RICH_TEXT 4
-#define HISTORYEVENTS_FORMAT_HTML 8
-
-#define HISTORYEVENTS_FLAG_DEFAULT (1 << 0) // Is a miranda core event type
-#define HISTORYEVENTS_FLAG_SHOW_IM_SRMM (1 << 1) // If this event has to be shown in srmm dialog
-#define HISTORYEVENTS_FLAG_USE_SENT_FLAG (1 << 2) // Means that it can be a sent or received and uses DBEF_SENT to mark that
-#define HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE (1 << 3) // Means that who is drawing this should draw the contact name before the text
-#define HISTORYEVENTS_FLAG_ONLY_LOG_IF_SRMM_OPEN (1 << 4) // If this event will be logged only if the message window is open
-#define HISTORYEVENTS_FLAG_FLASH_MSG_WINDOW (1 << 5) // If this event will trigger the openning/flashing of the message window
-#define HISTORYEVENTS_REGISTERED_IN_ICOLIB (9 << 16) // If the icon is a name already registered in icolib
-#define HISTORYEVENTS_FLAG_KEEP_ONE_YEAR (1 << 8) // By default store in db for 1 year
-#define HISTORYEVENTS_FLAG_KEEP_SIX_MONTHS (2 << 8) // By default store in db for 6 months
-#define HISTORYEVENTS_FLAG_KEEP_ONE_MONTH (3 << 8) // By default store in db for 1 month
-#define HISTORYEVENTS_FLAG_KEEP_ONE_WEEK (4 << 8) // By default store in db for 1 week
-#define HISTORYEVENTS_FLAG_KEEP_ONE_DAY (5 << 8) // By default store in db for 1 day
-#define HISTORYEVENTS_FLAG_KEEP_FOR_SRMM (6 << 8) // By default store in db only enought for message log
-#define HISTORYEVENTS_FLAG_KEEP_MAX_TEN (7 << 8) // By default store in db max 10 entries
-#define HISTORYEVENTS_FLAG_KEEP_MAX_HUNDRED (8 << 8) // By default store in db for 100 entries
-#define HISTORYEVENTS_FLAG_KEEP_DONT (9 << 8) // By default don't store in db (aka ignore it)
-
-
-// This function must be implemented by subscribers. It must return a pointer or NULL
-// to say it can't handle the text
-typedef void * (*fGetHistoryEventText)(HANDLE hContact, HANDLE hDbEvent, DBEVENTINFO *dbe, int format);
-
-typedef struct {
- int cbSize;
- char *module;
- char *name; // Internal event name
- char *description; // Will be translated. When retrieving it is already translated
- WORD eventType; // The event type it can handle
- union {
- HICON defaultIcon;
- char * defaultIconName; // if HISTORYEVENTS_REGISTERED_IN_ICOLIB is set. Always use this one when retrieving
- };
- int supports; // What kind of return is supported - or of HISTORYEVENTS_FORMAT_*
- int flags; // or of HISTORYEVENTS_FLAG_*
- fGetHistoryEventText pfGetHistoryEventText; // NULL to use default get text (similar to message, without extra format)
-
- // Aditional data if wants to use add to history services
- char **templates; // Each entry is: "Name\nDefault\n%var%\tDescription\n%var%\tDescription\n%var%\tDescription"
- int numTemplates;
-
-} HISTORY_EVENT_HANDLER;
-
-
-/*
-Get the number of registered events
-
-wParam: ignored
-lParam: ignored
-Return: The number of events registered with the plugin
-*/
-#define MS_HISTORYEVENTS_GET_COUNT "HistoryEvents/GetCount"
-
-
-/*
-Get an event by number or by type.
-To retrieve by number, pass -1 as type. To retrieve by type, pass -1 as number.
-
-wParam: (int) event number
-lParam: (int) event type
-Return: (const HISTORY_EVENT_HANDLER *) if the event exists, NULL otherwise. Don't change the
- returned strunc: it is a pointer to the internall struct.
-*/
-#define MS_HISTORYEVENTS_GET_EVENT "HistoryEvents/GetEvent"
-
-
-/*
-Register a plugin that can handle an event type. This must be called during the call to the
-Load function of the plugin. In ModulesLoaded callback all plugins have to be already registered,
-so srmm and history modules can query then.
-
-wParam: HISTORY_EVENT_HANDLER *
-lParam: ignored
-Return: 0 for success
-*/
-#define MS_HISTORYEVENTS_REGISTER "HistoryEvents/Register"
-
-
-typedef struct {
- int cbSize;
- HANDLE hDbEvent;
- DBEVENTINFO *dbe; // Optional
- int format; // one of HISTORYEVENTS_FORMAT_*
-
-} HISTORY_EVENT_PARAM;
-
-/*
-Check if an event can be handled by any subscribers
-
-wParam: WORD - event type
-lParam: ignored
-Return: BOOL
-*/
-#define MS_HISTORYEVENTS_CAN_HANDLE "HistoryEvents/CanHandle"
-
-/*
-Get the icon for a history event type
-
-wParam: WORD - event type
-lParam: BOOL - TRUE to copy the icon (should be released with DestroyObject),
- FALSE to use icolib one (should be released with MS_HISTORYEVENTS_RELEASE_ICON)
-Return: HICON
-*/
-#define MS_HISTORYEVENTS_GET_ICON "HistoryEvents/GetIcon"
-
-/*
-Get the flags for a history event type
-
-wParam: WORD - event type
-lParam: ignored
-Return: int - or of HISTORYEVENTS_FLAG_* or -1 if error
-*/
-#define MS_HISTORYEVENTS_GET_FLAGS "HistoryEvents/GetFlags"
-
-/*
-Release the icon for a history event type. This is really just a forward to icolib
-
-wParam: HICON
-lParam: ignored
-*/
-#define MS_HISTORYEVENTS_RELEASE_ICON "Skin2/Icons/ReleaseIcon"
-
-/*
-Get the text for a history event type
-
-wParam: HISTORY_EVENT_PARAM *
-lParam: ignored
-Return: char * or wchar * depending on sent flags. Free with mir_free or MS_HISTORYEVENTS_RELEASE_TEXT
-*/
-#define MS_HISTORYEVENTS_GET_TEXT "HistoryEvents/GetText"
-
-/*
-Release the text for a history event type. Internally is just a call to mir_free
-
-wParam: char * or wchar *
-lParam: ignored
-*/
-#define MS_HISTORYEVENTS_RELEASE_TEXT "HistoryEvents/ReleaseText"
-
-
-
-typedef struct {
- int cbSize;
- HANDLE hContact;
- WORD eventType;
- int templateNum;
- TCHAR **variables;
- int numVariables;
- PBYTE additionalData;
- int additionalDataSize;
- int flags; // Flags for the event type
- DWORD timestamp; // 0 for now
- BOOL addToMetaToo;
-} HISTORY_EVENT_ADD;
-
-/*
-Add an registered event to the history. This is a helper service
-
-wParam: HISTORY_EVENT_ADD
-lParam: ignored
-Return: HANDLE to the db event
-*/
-#define MS_HISTORYEVENTS_ADD_TO_HISTORY "HistoryEvents/AddToHistory"
-
-/*
-Check if a template is enabled
-
-wParam: event type
-lParam: template num
-Return: TRUE or FALSE
-*/
-#define MS_HISTORYEVENTS_IS_ENABLED_TEMPLATE "HistoryEvents/IsEnabledTemplate"
-
-
-
-// Helper functions //////////////////////////////////////////////////////////////////////////////
-
-
-
-
-static INT_PTR HistoryEvents_Register(char *module, char *name, char *description, int eventType, HICON defaultIcon,
- int supports, int flags, fGetHistoryEventText pfGetHistoryEventText)
-{
- HISTORY_EVENT_HANDLER heh = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_REGISTER))
- return 1;
-
- heh.cbSize = sizeof(heh);
- heh.module = module;
- heh.name = name;
- heh.description = description;
- heh.eventType = eventType;
- heh.defaultIcon = defaultIcon;
- heh.supports = supports;
- heh.flags = flags;
- heh.pfGetHistoryEventText = pfGetHistoryEventText;
- return CallService(MS_HISTORYEVENTS_REGISTER, (WPARAM) &heh, 0);
-}
-
-static INT_PTR HistoryEvents_RegisterWithTemplates(char *module, char *name, char *description, int eventType, HICON defaultIcon,
- int supports, int flags, fGetHistoryEventText pfGetHistoryEventText,
- char **templates, int numTemplates)
-{
- HISTORY_EVENT_HANDLER heh = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_REGISTER))
- return 1;
-
- heh.cbSize = sizeof(heh);
- heh.module = module;
- heh.name = name;
- heh.description = description;
- heh.eventType = eventType;
- heh.defaultIcon = defaultIcon;
- heh.supports = supports;
- heh.flags = flags;
- heh.pfGetHistoryEventText = pfGetHistoryEventText;
- heh.templates = templates;
- heh.numTemplates = numTemplates;
- return CallService(MS_HISTORYEVENTS_REGISTER, (WPARAM) &heh, 0);
-}
-
-static INT_PTR HistoryEvents_RegisterMessageStyle(char *module, char *name, char *description, int eventType, HICON defaultIcon,
- int flags, char **templates, int numTemplates)
-{
- HISTORY_EVENT_HANDLER heh = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_REGISTER))
- return 1;
-
- heh.cbSize = sizeof(heh);
- heh.module = module;
- heh.name = name;
- heh.description = description;
- heh.eventType = eventType;
- heh.defaultIcon = defaultIcon;
- heh.flags = flags;
- heh.templates = templates;
- heh.numTemplates = numTemplates;
- return CallService(MS_HISTORYEVENTS_REGISTER, (WPARAM) &heh, 0);
-}
-
-static BOOL HistoryEvents_CanHandle(WORD eventType)
-{
- if (!ServiceExists(MS_HISTORYEVENTS_CAN_HANDLE))
- return FALSE;
-
- return (BOOL) CallService(MS_HISTORYEVENTS_CAN_HANDLE, (WPARAM) eventType, 0);
-}
-
-static HICON HistoryEvents_GetIcon(WORD eventType)
-{
- if (!ServiceExists(MS_HISTORYEVENTS_GET_ICON))
- return NULL;
-
- return (HICON) CallService(MS_HISTORYEVENTS_GET_ICON, (WPARAM) eventType, 0);
-}
-
-static int HistoryEvents_GetFlags(WORD eventType)
-{
- if (!ServiceExists(MS_HISTORYEVENTS_GET_FLAGS))
- return -1;
-
- return (int) CallService(MS_HISTORYEVENTS_GET_FLAGS, (WPARAM) eventType, 0);
-}
-
-static void HistoryEvents_ReleaseIcon(HICON icon)
-{
- CallService(MS_HISTORYEVENTS_RELEASE_ICON, (WPARAM) icon, 0);
-}
-
-static char * HistoryEvents_GetTextA(HANDLE hDbEvent, DBEVENTINFO *dbe)
-{
- HISTORY_EVENT_PARAM hep = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_GET_TEXT))
- return NULL;
-
- hep.cbSize = sizeof(hep);
- hep.hDbEvent = hDbEvent;
- hep.dbe = dbe;
- hep.format = HISTORYEVENTS_FORMAT_CHAR;
- return (char *) CallService(MS_HISTORYEVENTS_GET_TEXT, (WPARAM) &hep, 0);
-}
-
-static wchar_t * HistoryEvents_GetTextW(HANDLE hDbEvent, DBEVENTINFO *dbe)
-{
- HISTORY_EVENT_PARAM hep = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_GET_TEXT))
- return NULL;
-
- hep.cbSize = sizeof(hep);
- hep.hDbEvent = hDbEvent;
- hep.dbe = dbe;
- hep.format = HISTORYEVENTS_FORMAT_WCHAR;
- return (wchar_t *) CallService(MS_HISTORYEVENTS_GET_TEXT, (WPARAM) &hep, 0);
-}
-
-static char * HistoryEvents_GetRichText(HANDLE hDbEvent, DBEVENTINFO *dbe)
-{
- HISTORY_EVENT_PARAM hep = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_GET_TEXT))
- return NULL;
-
- hep.cbSize = sizeof(hep);
- hep.hDbEvent = hDbEvent;
- hep.dbe = dbe;
- hep.format = HISTORYEVENTS_FORMAT_RICH_TEXT;
- return (char *) CallService(MS_HISTORYEVENTS_GET_TEXT, (WPARAM) &hep, 0);
-}
-
-#define HistoryEvents_ReleaseText mir_free
-//static void HistoryEvents_ReleaseText(void *str)
-//{
-// if (!ServiceExists(MS_HISTORYEVENTS_RELEASE_TEXT))
-// return;
-//
-// CallService(MS_HISTORYEVENTS_RELEASE_TEXT, (WPARAM) str, 0);
-//}
-
-
-#ifdef __cplusplus
-static HANDLE HistoryEvents_AddToHistoryEx(HANDLE hContact, WORD eventType, int templateNum,
- TCHAR **variables, int numVariables,
- PBYTE additionalData, int additionalDataSize,
- int flags = 0, DWORD timestamp = 0, BOOL addToMetaToo = FALSE)
-#else
-static HANDLE HistoryEvents_AddToHistoryEx(HANDLE hContact, WORD eventType, int templateNum,
- TCHAR **variables, int numVariables,
- PBYTE additionalData, int additionalDataSize,
- int flags, DWORD timestamp, BOOL addToMetaToo)
-#endif
-{
- HISTORY_EVENT_ADD hea = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_ADD_TO_HISTORY))
- return NULL;
-
- hea.cbSize = sizeof(hea);
- hea.hContact = hContact;
- hea.eventType = eventType;
- hea.templateNum = templateNum;
- hea.numVariables = numVariables;
- hea.variables = variables;
- hea.additionalData = additionalData;
- hea.additionalDataSize = additionalDataSize;
- hea.flags = flags;
- hea.timestamp = timestamp;
- hea.addToMetaToo = addToMetaToo;
-
- return (HANDLE) CallService(MS_HISTORYEVENTS_ADD_TO_HISTORY, (WPARAM) &hea, 0);
-}
-
-#ifdef __cplusplus
-static HANDLE HistoryEvents_AddToHistoryVars(HANDLE hContact, WORD eventType, int templateNum,
- TCHAR **variables, int numVariables,
- int flags = 0, DWORD timestamp = 0, BOOL addToMetaToo = FALSE)
-#else
-static HANDLE HistoryEvents_AddToHistoryVars(HANDLE hContact, WORD eventType, int templateNum,
- TCHAR **variables, int numVariables,
- int flags, DWORD timestamp, BOOL addToMetaToo)
-#endif
-{
- HISTORY_EVENT_ADD hea = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_ADD_TO_HISTORY))
- return NULL;
-
- hea.cbSize = sizeof(hea);
- hea.hContact = hContact;
- hea.eventType = eventType;
- hea.templateNum = templateNum;
- hea.numVariables = numVariables;
- hea.variables = variables;
- hea.flags = flags;
- hea.timestamp = timestamp;
- hea.addToMetaToo = addToMetaToo;
-
- return (HANDLE) CallService(MS_HISTORYEVENTS_ADD_TO_HISTORY, (WPARAM) &hea, 0);
-}
-
-#ifdef __cplusplus
-static HANDLE HistoryEvents_AddToHistorySimple(HANDLE hContact, WORD eventType, int templateNum,
- int flags = 0, DWORD timestamp = 0, BOOL addToMetaToo = FALSE)
-#else
-static HANDLE HistoryEvents_AddToHistorySimple(HANDLE hContact, WORD eventType, int templateNum,
- int flags, DWORD timestamp, BOOL addToMetaToo)
-#endif
-{
- HISTORY_EVENT_ADD hea = {0};
-
- if (!ServiceExists(MS_HISTORYEVENTS_ADD_TO_HISTORY))
- return NULL;
-
- hea.cbSize = sizeof(hea);
- hea.hContact = hContact;
- hea.eventType = eventType;
- hea.templateNum = templateNum;
- hea.flags = flags;
- hea.timestamp = timestamp;
- hea.addToMetaToo = addToMetaToo;
-
- return (HANDLE) CallService(MS_HISTORYEVENTS_ADD_TO_HISTORY, (WPARAM) &hea, 0);
-}
-
-static BOOL HistoryEvents_IsEnabledTemplate(WORD eventType, int templateNum)
-{
- return (BOOL) CallService(MS_HISTORYEVENTS_IS_ENABLED_TEMPLATE, eventType, templateNum);
-}
-
-#ifdef UNICODE
-# define HistoryEvents_GetTextT HistoryEvents_GetTextW
-#else
-# define HistoryEvents_GetTextT HistoryEvents_GetTextA
-#endif
-
-
-
-#endif // __M_HISTORYEVENTS_H__
diff --git a/plugins/ExternalAPI/m_historykeeper.h b/plugins/ExternalAPI/m_historykeeper.h deleted file mode 100644 index 7c4a25de84..0000000000 --- a/plugins/ExternalAPI/m_historykeeper.h +++ /dev/null @@ -1,95 +0,0 @@ -/*
-Copyright (C) 2006-2009 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-
-#ifndef __M_HISTORYKEEPER_H__
-# define __M_HISTORYKEEPER_H__
-
-
-#define MIID_STATUS_MESSAGE_CHANGE_LOGGER { 0x821be252, 0xe20b, 0x41e7, { 0xa5, 0x1d, 0x3c, 0x34, 0x2e, 0x38, 0xae, 0x22 } }
-#define MIID_STATUS_MESSAGE_CHANGE_NOTIFIER { 0xb628b23b, 0x47ae, 0x430e, { 0x94, 0x81, 0x15, 0x9f, 0xa7, 0x26, 0xc4, 0x3a } }
-#define MIID_NICKNAME_CHANGE_LOGGER { 0x478be45e, 0xd331, 0x4d63, { 0xa6, 0x57, 0x85, 0xda, 0x45, 0xf8, 0xc, 0xe0 } }
-#define MIID_NICKNAME_CHANGE_NOTIFIER { 0xc749d46a, 0x885e, 0x46bf, { 0xaa, 0x4c, 0xe1, 0xae, 0xc5, 0xc9, 0xd0, 0x93 } }
-
-#define EVENTTYPE_STATUSCHANGE 25368
-#define EVENTTYPE_NICKNAME_CHANGE 9001
-#define EVENTTYPE_STATUSMESSAGE_CHANGE 9002
-#define EVENTTYPE_CLIENT_CHANGE 9005
-#define EVENTTYPE_XSTATUS_CHANGE 9006
-#define EVENTTYPE_LISTENINGTO_CHANGE 9007
-#define EVENTTYPE_XSTATUS_MESSAGE_CHANGE 9008
-#define EVENTTYPE_IDLE_CHANGE 9009
-
-
-/*
-Return TRUE is Status Message History is enabled for this contact
-
-wParam: hContact
-lParam: ignored
-*/
-#define MS_SMH_ENABLED "SMH/Enabled"
-
-
-/*
-Enable Status Message History for a contact
-
-wParam: hContact
-lParam: ignored
-*/
-#define MS_SMH_ENABLE "SMH/Enable"
-
-
-/*
-Disable Status Message History for a contact
-
-wParam: hContact
-lParam: ignored
-*/
-#define MS_SMH_DISABLE "SMH/Disable"
-
-
-/*
-Return TRUE is Nick History is enabled for this contact
-
-wParam: hContact
-lParam: ignored
-*/
-#define MS_NICKHISTORY_ENABLED "NickHistory/Enabled"
-
-
-/*
-Enable Nick History for a contact
-
-wParam: hContact
-lParam: ignored
-*/
-#define MS_NICKHISTORY_ENABLE "NickHistory/Enable"
-
-
-/*
-Disable Nick History for a contact
-
-wParam: hContact
-lParam: ignored
-*/
-#define MS_NICKHISTORY_DISABLE "NickHistory/Disable"
-
-
-
-#endif // __M_HISTORYKEEPER_H__
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 130ddeff2d..9ce653839e 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -66,7 +66,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;
}
@@ -82,8 +82,8 @@ END_GROUPLOOP: DBDeleteContactSetting(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_b(hContact, pszModule, "ChatRoom", (BYTE)iType);
+ 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);
- 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;
}
@@ -106,10 +106,10 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) char *szProto = GetContactProto(hContact);
if ( MM_FindModule( szProto )) {
if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) {
- int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
+ int i = db_get_b(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);
}
}
}
@@ -129,7 +129,7 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) szProto = GetContactProto(hContact);
if ( MM_FindModule(szProto)) {
- if (DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0) == 0)
+ if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) {
@@ -137,7 +137,7 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) if ( si ) {
// is the "toggle visibility option set, so we need to close the window?
if (si->hWnd != NULL
- && DBGetContactSettingByte(NULL, "Chat", "ToggleVisibility", 0)==1
+ && db_get_b(NULL, "Chat", "ToggleVisibility", 0)==1
&& !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)
&& IsWindowVisible(si->hWnd)
&& !IsIconic(si->hWnd))
@@ -202,7 +202,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if ( szProto ) {
// display this menu item only for chats
- if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 )) {
+ if ( db_get_b( hContact, szProto, "ChatRoom", 0 )) {
// still hide it for offline protos
if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) {
clmi.flags &= ~CMIF_HIDDEN;
@@ -296,7 +296,7 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) while (hContact) {
char *szProto = GetContactProto(hContact);
if (szProto && !lstrcmpiA(szProto, pszModule)) {
- if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0) != 0 ) {
+ if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0 ) {
DBVARIANT dbv;
if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) {
if ( !lstrcmpi(dbv.ptszVal, pszRoom)) {
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index d6e5895a02..5009e3bdbc 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -49,7 +49,7 @@ int Chat_Load() int Chat_Unload(void)
{
- DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
+ db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
CList_SetAllOffline(TRUE, NULL);
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 0807ea9f7e..28eb7e91ff 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -117,7 +117,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta {
CList_SetOffline(pTemp->windowData.hContact, pTemp->iType == GCW_CHATROOM?TRUE:FALSE);
/* if (pTemp->iType != GCW_SERVER)
- DBWriteContactSettingByte(pTemp->windowData.hContact, "CList", "Hidden", 1);*/
+ db_set_b(pTemp->windowData.hContact, "CList", "Hidden", 1);*/
}
DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule , "Topic", "");
DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule, "StatusBar", "");
@@ -587,7 +587,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) if ( pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE )
DBDeleteContactSetting(pTemp->windowData.hContact, "CList", "Hidden");
- DBWriteContactSettingWord(pTemp->windowData.hContact, pTemp->pszModule, "Status", (WORD)wStatus);
+ db_set_w(pTemp->windowData.hContact, pTemp->pszModule, "Status", (WORD)wStatus);
}
PostMessage(pTemp->hWnd, GC_FIXTABICONS, 0, 0);
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 86c21c65df..4a82d7da0d 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -133,7 +133,7 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, struct branch_t *branch if (branch[i].iMode)
iState = ((DBGetContactSettingDword(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1;
else
- iState = DBGetContactSettingByte(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1;
+ iState = db_get_b(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1;
tvis.item.state=INDEXTOSTATEIMAGEMASK(iState);
branch[i].hItem = TreeView_InsertItem(hwndTree, &tvis);
}
@@ -158,7 +158,7 @@ static void SaveBranch(HWND hwndTree, struct branch_t *branch, int nValues) iState |= GC_EVENT_REMOVESTATUS;
DBWriteContactSettingDword(NULL, "Chat", branch[i].szDBName, (DWORD)iState);
}
- else DBWriteContactSettingByte(NULL, "Chat", branch[i].szDBName, bChecked);
+ else db_set_b(NULL, "Chat", branch[i].szDBName, bChecked);
} }
static void CheckHeading(HWND hwndTree, HTREEITEM hHeading)
@@ -253,9 +253,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETRANGE,0,MAKELONG(255,10));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"Chat","NicklistRowDist",12),0));
- hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), DBGetContactSettingByte(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE);
- hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), DBGetContactSettingByte(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE);
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"Chat","NicklistRowDist",12),0));
+ hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE);
+ hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, SIZEOF(branch4), 0x1000);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
@@ -336,7 +336,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa iLen = SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_GETPOS,0,0);
if (iLen > 0)
- DBWriteContactSettingByte(NULL, "Chat", "NicklistRowDist", (BYTE)iLen);
+ db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen);
else
DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, SIZEOF(branch1));
@@ -352,9 +352,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa case WM_DESTROY:
{
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch1Exp", b);
+ db_set_b(NULL, "Chat", "Branch1Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch5Exp", b);
+ db_set_b(NULL, "Chat", "Branch5Exp", b);
}
break;
}
@@ -431,8 +431,8 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMIT), g_Settings.LoggingEnabled?TRUE:FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMITTEXT2), g_Settings.LoggingEnabled?TRUE:FALSE);
- hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance"), DBGetContactSettingByte(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE);
- hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Default events to show in new chat rooms if the \'event filter\' is enabled"), DBGetContactSettingByte(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE);
+ hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance"), db_get_b(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE);
+ hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Default events to show in new chat rooms if the \'event filter\' is enabled"), db_get_b(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, branch3, SIZEOF(branch3), 0x03E0);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
@@ -598,15 +598,15 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing");
g_Settings.HighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED?TRUE:FALSE;
- DBWriteContactSettingByte(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled);
+ db_set_b(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled);
g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED?TRUE:FALSE;
- DBWriteContactSettingByte(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
+ db_set_b(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
iLen = SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_GETPOS,0,0);
- DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
+ db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen);
iLen = SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_GETPOS,0,0);
- DBWriteContactSettingWord(NULL, "Chat", "LoggingLimit", (WORD)iLen);
+ db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen);
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch2, SIZEOF(branch2));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch3, SIZEOF(branch3));
@@ -616,11 +616,11 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000);
g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000);
g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000);
- g_Settings.StripFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrimFormatting", 0);
- g_Settings.TrayIconInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrayIconInactiveOnly", 1);
- g_Settings.PopUpInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "PopUpInactiveOnly", 1);
+ g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "TrimFormatting", 0);
+ g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
+ g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1);
- g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
+ g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
MM_FontsChanged();
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
return TRUE;
@@ -640,9 +640,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa }
{
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch2Exp", b);
+ db_set_b(NULL, "Chat", "Branch2Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
- DBWriteContactSettingByte(NULL, "Chat", "Branch3Exp", b);
+ db_set_b(NULL, "Chat", "Branch3Exp", b);
}
break;
}
@@ -725,11 +725,11 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam iLen = 1;
g_Settings.iPopupStyle = iLen;
- DBWriteContactSettingByte(NULL, "Chat", "PopupStyle", (BYTE)iLen);
+ db_set_b(NULL, "Chat", "PopupStyle", (BYTE)iLen);
iLen = SendDlgItemMessage(hwndDlg,IDC_CHAT_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_CHAT_BKG,CPM_GETCOLOUR,0,0);
DBWriteContactSettingDword(NULL, "Chat", "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg,IDC_CHAT_BKG,CPM_GETCOLOUR,0,0));
@@ -773,34 +773,34 @@ void LoadGlobalSettings(void) {
LOGFONT lf;
- g_Settings.LogLimitNames = DBGetContactSettingByte(NULL, "Chat", "LogLimitNames", 1);
- g_Settings.ShowTime = DBGetContactSettingByte(NULL, "Chat", "ShowTimeStamp", 1);
- g_Settings.SoundsFocus = DBGetContactSettingByte(NULL, "Chat", "SoundsFocus", 0);
- g_Settings.ShowTimeIfChanged = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowTimeStampIfChanged", 0);
- g_Settings.TimeStampEventColour = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TimeStampEventColour", 0);
+ g_Settings.LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1);
+ g_Settings.ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1);
+ g_Settings.SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0);
+ g_Settings.ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
+ g_Settings.TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
g_Settings.iEventLimit = DBGetContactSettingWord(NULL, "Chat", "LogLimit", 100);
g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000);
g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000);
g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000);
g_Settings.LoggingLimit = DBGetContactSettingWord(NULL, "Chat", "LoggingLimit", 100);
- g_Settings.LoggingEnabled = (BOOL)DBGetContactSettingByte(NULL, "Chat", "LoggingEnabled", 0);
- g_Settings.FlashWindow = (BOOL)DBGetContactSettingByte(NULL, "Chat", "FlashWindow", 0);
- g_Settings.HighlightEnabled = (BOOL)DBGetContactSettingByte(NULL, "Chat", "HighlightEnabled", 1);
+ g_Settings.LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
+ g_Settings.FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
+ g_Settings.HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
g_Settings.crUserListColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font18Col", RGB(0,0,0));
g_Settings.crUserListBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
g_Settings.crUserListSelectedBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
g_Settings.crUserListHeadingsColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font19Col", RGB(170,170,170));
g_Settings.crLogBackground = DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
- g_Settings.StripFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "StripFormatting", 0);
- g_Settings.TrayIconInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrayIconInactiveOnly", 1);
- g_Settings.PopUpInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "PopUpInactiveOnly", 1);
- g_Settings.AddColonToAutoComplete = (BOOL)DBGetContactSettingByte(NULL, "Chat", "AddColonToAutoComplete", 1);
- g_Settings.iPopupStyle = DBGetContactSettingByte(NULL, "Chat", "PopupStyle", 1);
+ g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
+ g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
+ g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1);
+ g_Settings.AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
+ g_Settings.iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
g_Settings.iPopupTimeout = DBGetContactSettingWord(NULL, "Chat", "PopupTimeout", 3);
g_Settings.crPUBkgColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
g_Settings.crPUTextColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorText", 0);
- g_Settings.ShowContactStatus = DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0);
- g_Settings.ContactStatusFirst = DBGetContactSettingByte(NULL, "Chat", "ContactStatusFirst", 0);
+ g_Settings.ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
+ g_Settings.ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
InitSetting( &g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
InitSetting( &g_Settings.pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
@@ -816,7 +816,7 @@ void LoadGlobalSettings(void) }
else lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
- g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
+ g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE;
if (g_Settings.MessageBoxFont)
DeleteObject(g_Settings.MessageBoxFont);
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index cb1375c491..6e798f364e 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -222,8 +222,8 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->iSplitterX = g_Settings.iSplitterX;
si->iSplitterY = g_Settings.iSplitterY;
si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
- si->bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0);
- si->bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1);
+ si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
+ si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
if ( !( gcw->dwFlags & GC_UNICODE )) {
si->pszID = mir_strdup( gcw->pszID );
@@ -302,7 +302,7 @@ static INT_PTR DoControl(GCEVENT * gce, WPARAM wp) SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
si->bInitDone = TRUE;
- if (wp != SESSION_INITDONE || DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0) == 0)
+ if (wp != SESSION_INITDONE || db_get_b(NULL, "Chat", "PopupOnJoin", 0) == 0)
ShowRoom(si, wp, TRUE);
return 0;
} }
@@ -506,7 +506,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if ( gce->pszText ) {
replaceStr( &si->ptszTopic, gce->ptszText);
DBWriteContactSettingTString( si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic ));
- if ( DBGetContactSettingByte( NULL, "Chat", "TopicOnClist", 0 ))
+ if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 ))
DBWriteContactSettingTString( si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic ));
} }
break;
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 7d12ba29b9..5d528f75dc 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -280,9 +280,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
if (bInactive || !g_Settings.SoundsFocus)
SkinPlaySound("ChatHighlight");
- if (bInactive && si->hWnd && DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0)
+ if (bInactive && si->hWnd && db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0)
SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- if (DBGetContactSettingByte(si->windowData.hContact, "CList", "Hidden", 0) != 0)
+ if (db_get_b(si->windowData.hContact, "CList", "Hidden", 0) != 0)
DBDeleteContactSetting(si->windowData.hContact, "CList", "Hidden");
if (bInactive)
DoTrayIcon(si, gce);
@@ -334,7 +334,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh if (bInactive && !( si->wState & STATE_TALK )) {
si->wState |= STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule,"ApparentMode",(LPARAM)(WORD) 40071);
+ db_set_w(si->windowData.hContact, si->pszModule,"ApparentMode",(LPARAM)(WORD) 40071);
}
if (bInactive && si->hWnd)
SendMessage(si->hWnd, GC_SETTABHIGHLIGHT, 0, 0);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 3a9a9e0350..406207adbb 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -265,11 +265,11 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, dat->szSearchQuery = NULL;
mir_free(dat->szSearchResult);
dat->szSearchResult = NULL;
- if (( isCtrl != 0 ) ^ (0 != DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
+ if (( isCtrl != 0 ) ^ (0 != db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
if (dat->lastEnterTime + 2 < time(NULL))
dat->lastEnterTime = time(NULL);
else {
@@ -627,7 +627,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L HWND hColor = GetDlgItem(GetParent(hwnd), IDC_CHAT_COLOR);
HWND hBGColor = GetDlgItem(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) != 0) {
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) {
if (hFilter == hwnd)
SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
if (hColor == hwnd)
@@ -1118,7 +1118,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)*0x7FFFFFFF, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback);
- if (DBGetContactSettingByte(NULL, "Chat", "UseIEView", 0)) {
+ if (db_get_b(NULL, "Chat", "UseIEView", 0)) {
IEVIEWWINDOW ieWindow;
IEVIEWEVENT iee;
@@ -1191,10 +1191,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) ih = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListFont,FALSE);
ih2 = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListHeadingsFont,FALSE);
- height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
font = ih > ih2?ih:ih2;
// make sure we have space for icon!
- if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
+ if (db_get_b(NULL, "Chat", "ShowContactStatus", 0))
font = font > 16 ? font : 16;
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
@@ -1384,7 +1384,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) si->wState |= GC_EVENT_HIGHLIGHT;
SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
+ if (db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
}
break;
@@ -1403,7 +1403,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) if (si->wState & STATE_TALK) {
si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
}
if (si->wState & GC_EVENT_HIGHLIGHT) {
@@ -1440,9 +1440,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
int font = ih > ih2?ih:ih2;
- int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
// make sure we have space for icon!
- if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
+ if (db_get_b(NULL, "Chat", "ShowContactStatus", 0))
font = font > 16 ? font : 16;
mis->itemHeight = height > font?height:font;
return TRUE;
@@ -1553,7 +1553,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
return TRUE;
@@ -1566,7 +1566,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) goto LABEL_SHOWWINDOW;
case SESSION_INITDONE:
- if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0)
+ if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0)
return TRUE;
// fall through
case WINDOW_VISIBLE:
@@ -1693,7 +1693,7 @@ LABEL_SHOWWINDOW: SetActiveSession(si->ptszID, si->pszModule);
if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0)
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
}
@@ -1901,7 +1901,7 @@ LABEL_SHOWWINDOW: si->bFilterEnabled = !si->bFilterEnabled;
SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
- if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) {
+ if (si->bFilterEnabled && db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) {
SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
break;
}
@@ -1920,7 +1920,7 @@ LABEL_SHOWWINDOW: break;
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0)
SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
else if (si->bBGSet){
cf.dwMask = CFM_BACKCOLOR;
@@ -1953,7 +1953,7 @@ LABEL_SHOWWINDOW: break;
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0)
SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
else if (si->bFGSet) {
cf.dwMask = CFM_COLOR;
diff --git a/plugins/Scriver/src/commonheaders.h b/plugins/Scriver/src/commonheaders.h index be6494897c..9eeef8af3b 100644 --- a/plugins/Scriver/src/commonheaders.h +++ b/plugins/Scriver/src/commonheaders.h @@ -69,7 +69,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_ieview.h>
#include <m_smileyadd.h>
#include <m_metacontacts.h>
-#include <m_historyevents.h>
#include "resource.h"
#include "Version.h"
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index e535e6c47c..e5dbf2a84e 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -299,102 +299,102 @@ void ReloadGlobals() {
g_dat.flags = 0;
g_dat.flags2 = 0;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
g_dat.flags |= SMF_AVATAR;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS))
g_dat.flags |= SMF_SHOWPROGRESS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
g_dat.flags |= SMF_SHOWICONS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
g_dat.flags |= SMF_SHOWTIME;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS))
g_dat.flags |= SMF_SHOWSECONDS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE))
g_dat.flags |= SMF_SHOWDATE;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE))
g_dat.flags |= SMF_LONGDATE;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE))
g_dat.flags |= SMF_RELATIVEDATE;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES))
g_dat.flags |= SMF_GROUPMESSAGES;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS))
g_dat.flags |= SMF_MARKFOLLOWUPS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE))
g_dat.flags |= SMF_MSGONNEWLINE;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES))
g_dat.flags |= SMF_DRAWLINES;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
g_dat.flags |= SMF_HIDENAMES;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP))
g_dat.flags |= SMF_AUTOPOPUP;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED))
g_dat.flags |= SMF_STAYMINIMIZED;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS))
g_dat.flags |= SMF_SAVEDRAFTS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP))
g_dat.flags |= SMF_DELTEMP;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))
g_dat.flags |= SMF_SENDONENTER;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER))
g_dat.flags |= SMF_SENDONDBLENTER;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON))
g_dat.flags |= SMF_STATUSICON;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT))
g_dat.flags |= SMF_INDENTTEXT;
g_dat.openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
g_dat.indentSize = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE);
g_dat.logLineColour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR);
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS))
g_dat.flags2 |= SMF2_USETABS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM))
g_dat.flags2 |= SMF2_TABSATBOTTOM;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE))
g_dat.flags2 |= SMF2_SWITCHTOACTIVE;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES))
g_dat.flags2 |= SMF2_LIMITNAMES;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB))
g_dat.flags2 |= SMF2_HIDEONETAB;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS))
g_dat.flags2 |= SMF2_SEPARATECHATSCONTAINERS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON))
g_dat.flags2 |= SMF2_TABCLOSEBUTTON;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS))
g_dat.flags2 |= SMF2_LIMITTABS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS))
g_dat.flags2 |= SMF2_LIMITCHATSTABS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS))
g_dat.flags2 |= SMF2_HIDECONTAINERS;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR))
g_dat.flags2 |= SMF2_SHOWSTATUSBAR;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR))
g_dat.flags2 |= SMF2_SHOWTITLEBAR;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
g_dat.flags2 |= SMF2_SHOWTOOLBAR;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR))
g_dat.flags2 |= SMF2_SHOWINFOBAR;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
g_dat.flags2 |= SMF2_SHOWTYPING;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN))
g_dat.flags2 |= SMF2_SHOWTYPINGWIN;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN))
g_dat.flags2 |= SMF2_SHOWTYPINGTRAY;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST))
g_dat.flags2 |= SMF2_SHOWTYPINGCLIST;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH))
g_dat.flags2 |= SMF2_SHOWTYPINGSWITCH;
if (LOBYTE(LOWORD(GetVersion())) >= 5 && pSetLayeredWindowAttributes != NULL) {
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY))
g_dat.flags2 |= SMF2_USETRANSPARENCY;
g_dat.activeAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA);
g_dat.inactiveAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA);
}
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW))
g_dat.flags |= SMF_USEIEVIEW;
g_dat.buttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, SRMSGDEFSET_BUTTONVISIBILITY);
@@ -456,7 +456,7 @@ static int ackevent(WPARAM wParam, LPARAM lParam) if (item->hwndErrorDlg != NULL)
DestroyWindow(item->hwndErrorDlg);
- if (RemoveSendQueueItem(item) && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
+ if (RemoveSendQueueItem(item) && db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
if (hwndSender != NULL)
DestroyWindow(hwndSender);
}
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index b2ba79baf7..c6efc0d6a9 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -59,7 +59,7 @@ void SetupInfobar(InfobarWindowData* idat) { }
static HICON GetExtraStatusIcon(InfobarWindowData* idat) {
- BYTE bXStatus = DBGetContactSettingByte(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
+ BYTE bXStatus = db_get_b(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
if (bXStatus > 0) {
return (HICON) CallProtoService(idat->mwd->szProto, "/GetXStatusIcon", bXStatus, 0);
}
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 5e6e97f2b0..1a6f18c15a 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -202,7 +202,7 @@ int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, Common return FALSE;
}
- if ((wParam == VK_UP || wParam == VK_DOWN) && isCtrl && !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
+ if ((wParam == VK_UP || wParam == VK_DOWN) && isCtrl && !db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
if (windowData->cmdList) {
TCmdList *cmdListNew = NULL;
if (wParam == VK_UP) {
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index cebcd462aa..5fb5dc0620 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -230,7 +230,7 @@ static void SetDialogToType(HWND hwndDlg) if (dat->windowData.hContact) {
ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
- if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0))
+ if (!db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
if (!g_dat.smileyAddInstalled)
@@ -260,7 +260,7 @@ void SetStatusIcon(struct SrmmWindowData *dat) { char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 &&
- DBGetContactSettingByte(NULL,"CLC","Meta",0) == 0) {
+ db_get_b(NULL,"CLC","Meta",0) == 0) {
hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0);
if (hContact != NULL)
szProto = GetContactProto(hContact);
@@ -283,22 +283,26 @@ void SetStatusIcon(struct SrmmWindowData *dat) { dat->statusIconOverlay = ImageList_GetIcon(g_dat.hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
}
-void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd) {
- if (dat->showTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN)) {
+void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd)
+{
+ if (dat->showTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN))
tbd->hIconNot = tbd->hIcon = GetCachedIcon("scriver_TYPING");
- } else if (dat->showUnread && (GetActiveWindow() != dat->hwndParent || GetForegroundWindow() != dat->hwndParent)) {
+ else if (dat->showUnread && (GetActiveWindow() != dat->hwndParent || GetForegroundWindow() != dat->hwndParent)) {
tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? dat->statusIcon : g_dat.hMsgIcon;
tbd->hIconNot = (g_dat.flags & SMF_STATUSICON) ? g_dat.hMsgIcon : GetCachedIcon("scriver_OVERLAY");
- } else {
+ }
+ else {
tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? dat->statusIcon : g_dat.hMsgIcon;
tbd->hIconNot = NULL;
}
tbd->hIconBig = (g_dat.flags & SMF_STATUSICON) ? dat->statusIconBig : g_dat.hMsgIconBig;
}
-HICON GetTabIcon(struct SrmmWindowData *dat) {
+HICON GetTabIcon(struct SrmmWindowData *dat)
+{
if (dat->showTyping)
return GetCachedIcon("scriver_TYPING");
+
if (dat->showUnread != 0)
return dat->statusIconOverlay;
@@ -314,91 +318,90 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, {
static BOOL inMenu = FALSE;
switch (msg) {
- case WM_MEASUREITEM:
- MeasureMenuItem(wParam, lParam);
+ case WM_MEASUREITEM:
+ MeasureMenuItem(wParam, lParam);
+ return TRUE;
+
+ case WM_DRAWITEM:
+ return DrawMenuItem(wParam, lParam);
+
+ case WM_SETCURSOR:
+ if (inMenu) {
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
return TRUE;
- case WM_DRAWITEM:
- return DrawMenuItem(wParam, lParam);
- case WM_SETCURSOR:
- if (inMenu) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
- return TRUE;
- }
+ }
break;
- case WM_CONTEXTMENU:
- {
- HMENU hMenu, hSubMenu;
- TCHAR *pszWord;
- POINT pt;
- POINTL ptl;
- int uID;
- CHARRANGE sel, all = { 0, -1 };
- hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- hSubMenu = GetSubMenu(hMenu, 0);
- TranslateMenu(hSubMenu);
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
- if (sel.cpMin == sel.cpMax)
- EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
-
- if (lParam == 0xFFFFFFFF) {
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax);
- ClientToScreen(hwnd, &pt);
- } else {
- pt.x = (short) LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
- }
- ptl.x = (LONG)pt.x;
- ptl.y = (LONG)pt.y;
- ScreenToClient(hwnd, (LPPOINT)&ptl);
- pszWord = GetRichTextWord(hwnd, &ptl);
- if ( pszWord && pszWord[0] ) {
- TCHAR szMenuText[4096];
- mir_sntprintf( szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWord );
- ModifyMenu( hSubMenu, 5, MF_STRING|MF_BYPOSITION, 5, szMenuText );
- SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList);
- }
- else ModifyMenu( hSubMenu, 5, MF_STRING|MF_GRAYED|MF_BYPOSITION, 5, TranslateT( "No word to look up" ));
- inMenu = TRUE;
- uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
- inMenu = FALSE;
- switch (uID) {
- case IDM_COPY:
- SendMessage(hwnd, WM_COPY, 0, 0);
- break;
- case IDM_COPYALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all);
- SendMessage(hwnd, WM_COPY, 0, 0);
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel);
- break;
- case IDM_SELECTALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all);
- break;
- case IDM_CLEAR:
- SendMessage(GetParent(hwnd), DM_CLEARLOG, 0, 0);
- break;
- case IDM_SEARCH_GOOGLE:
- case IDM_SEARCH_BING:
- case IDM_SEARCH_YANDEX:
- case IDM_SEARCH_YAHOO:
- case IDM_SEARCH_WIKIPEDIA:
- case IDM_SEARCH_FOODNETWORK:
- case IDM_SEARCH_GOOGLE_MAPS:
- case IDM_SEARCH_GOOGLE_TRANSLATE:
- SearchWord(pszWord, uID - IDM_SEARCH_GOOGLE + SEARCHENGINE_GOOGLE);
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
- break;
- }
- DestroyMenu(hMenu);
- mir_free(pszWord);
- return TRUE;
+
+ case WM_CONTEXTMENU:
+ HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 0);
+ TranslateMenu(hSubMenu);
+
+ CHARRANGE sel, all = { 0, -1 };
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax)
+ EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
+
+ POINT pt;
+ if (lParam == 0xFFFFFFFF) {
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short) LOWORD(lParam);
+ pt.y = (short) HIWORD(lParam);
+ }
+
+ POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
+ ScreenToClient(hwnd, (LPPOINT)&ptl);
+ mir_ptr<TCHAR> pszWord( GetRichTextWord(hwnd, &ptl));
+ if ( pszWord && pszWord[0] ) {
+ TCHAR szMenuText[4096];
+ mir_sntprintf( szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWord );
+ ModifyMenu( hSubMenu, 5, MF_STRING|MF_BYPOSITION, 5, szMenuText );
+ SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList);
+ }
+ else ModifyMenu( hSubMenu, 5, MF_STRING|MF_GRAYED|MF_BYPOSITION, 5, TranslateT( "No word to look up" ));
+
+ inMenu = TRUE;
+ int uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ inMenu = FALSE;
+
+ switch (uID) {
+ case IDM_COPY:
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ break;
+ case IDM_COPYALL:
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all);
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel);
+ break;
+ case IDM_SELECTALL:
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all);
+ break;
+ case IDM_CLEAR:
+ SendMessage(GetParent(hwnd), DM_CLEARLOG, 0, 0);
+ break;
+ case IDM_SEARCH_GOOGLE:
+ case IDM_SEARCH_BING:
+ case IDM_SEARCH_YANDEX:
+ case IDM_SEARCH_YAHOO:
+ case IDM_SEARCH_WIKIPEDIA:
+ case IDM_SEARCH_FOODNETWORK:
+ case IDM_SEARCH_GOOGLE_MAPS:
+ case IDM_SEARCH_GOOGLE_TRANSLATE:
+ SearchWord(pszWord, uID - IDM_SEARCH_GOOGLE + SEARCHENGINE_GOOGLE);
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ break;
}
+ DestroyMenu(hMenu);
+ return TRUE;
}
return mir_callNextSubclass(hwnd, LogEditSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- int result = -1;
struct MsgEditSubclassData *dat;
struct SrmmWindowData *pdat;
CommonWindowData *windowData;
@@ -408,10 +411,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar pdat=(struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
windowData = &pdat->windowData;
- result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
- if (result != -1) {
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
+ if (result != -1)
return result;
- }
switch (msg) {
case EM_SUBCLASSED:
@@ -421,34 +423,30 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return 0;
case WM_KEYDOWN:
- {
- if (wParam == VK_RETURN) {
- if ((isCtrl != 0) ^ (0 != (g_dat.flags & SMF_SENDONENTER))) {
+ if (wParam == VK_RETURN) {
+ if ((isCtrl != 0) ^ (0 != (g_dat.flags & SMF_SENDONENTER))) {
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ if (g_dat.flags & SMF_SENDONDBLENTER) {
+ if (dat->lastEnterTime + ENTERCLICKTIME < GetTickCount())
+ dat->lastEnterTime = GetTickCount();
+ else {
+ SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
+ SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if (g_dat.flags & SMF_SENDONDBLENTER) {
- if (dat->lastEnterTime + ENTERCLICKTIME < GetTickCount())
- dat->lastEnterTime = GetTickCount();
- else {
- SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
- SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- }
- }
- else
- dat->lastEnterTime = 0;
- if (((wParam == VK_INSERT && (GetKeyState(VK_SHIFT) & 0x8000)) || (wParam == 'V' && (GetKeyState(VK_CONTROL) & 0x8000))) &&
- !(GetKeyState(VK_MENU) & 0x8000))
- {
- SendMessage(hwnd, WM_PASTE, 0, 0);
- return 0;
}
}
+ else dat->lastEnterTime = 0;
+
+ if (((wParam == VK_INSERT && (GetKeyState(VK_SHIFT) & 0x8000)) || (wParam == 'V' && (GetKeyState(VK_CONTROL) & 0x8000))) && !(GetKeyState(VK_MENU) & 0x8000)) {
+ SendMessage(hwnd, WM_PASTE, 0, 0);
+ return 0;
+ }
break;
- //fall through
+
case WM_MOUSEWHEEL:
if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0)
SendMessage(GetDlgItem(GetParent(hwnd), IDC_LOG), WM_MOUSEWHEEL, wParam, lParam);
@@ -468,26 +466,27 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return 0;
}
break;
+
case WM_PASTE:
- if (IsClipboardFormatAvailable(CF_HDROP))
- {
- if (OpenClipboard(hwnd))
- {
+ if (IsClipboardFormatAvailable(CF_HDROP)) {
+ if (OpenClipboard(hwnd)) {
HANDLE hDrop = GetClipboardData(CF_HDROP);
if (hDrop)
SendMessage(hwnd, WM_DROPFILES, (WPARAM)hDrop, 0);
CloseClipboard();
}
}
- else
- SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
+ else SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
return 0;
+
case WM_DROPFILES:
SendMessage(GetParent(hwnd), WM_DROPFILES, wParam, lParam);
return 0;
+
case WM_CONTEXTMENU:
InputAreaContextMenu(hwnd, wParam, lParam, pdat->windowData.hContact);
return TRUE;
+
case EM_UNSUBCLASSED:
mir_free(dat);
return 0;
@@ -513,8 +512,8 @@ static void UnsubclassLogEdit(HWND hwnd) { SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
}
-static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, int h) {
- HDWP hdwp;
+static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, int h)
+{
ParentWindowData *pdat = dat->parent;
int hSplitterPos = dat->splitterPos, toolbarHeight = pdat->flags2&SMF2_SHOWTOOLBAR ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0;
int hSplitterMinTop = toolbarHeight + dat->windowData.minLogBoxHeight, hSplitterMinBottom = dat->windowData.minEditBoxHeight;
@@ -572,7 +571,8 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, logY = infobarInnerHeight;
logH = h-hSplitterPos-toolbarHeight - infobarInnerHeight;
- hdwp = BeginDeferWindowPos(15);
+
+ HDWP hdwp = BeginDeferWindowPos(15);
hdwp = DeferWindowPos(hdwp, dat->infobarData->hWnd, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_LOG), 0, 1, logY, w-2, logH, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
@@ -580,54 +580,35 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTER), 0, 0, h - hSplitterPos-1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility);
-
- /*
- if (hSplitterPos - SPLITTER_HEIGHT - toolbarHeight - 2< dat->avatarHeight) {
- hSplitterPos = dat->avatarHeight + SPLITTER_HEIGHT + toolbarHeight + 2;
- }
- dat->splitterPos = hSplitterPos;
- hdwp = BeginDeferWindowPos(12);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_LOG), 0, 0, 0, w-vSplitterPos, h-hSplitterPos, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, h - hSplitterPos + SPLITTER_HEIGHT, w, hSplitterPos - SPLITTER_HEIGHT - toolbarHeight -2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTER), 0, 0, h - hSplitterPos-1, w, SPLITTER_HEIGHT + 1, SWP_NOZORDER);
- if (dat->avatarHeight + 1 < hSplitterPos - toolbarHeight) {
- aPos = h - (hSplitterPos + toolbarHeight + dat->avatarHeight - 1) / 2;
- } else {
- aPos = h - (hSplitterPos + toolbarHeight + dat->avatarHeight + 1) / 2;
- }
- vPos = h - toolbarHeight;
- hdwp = ResizeToolbar(hwndDlg, hdwp, w, vPos, toolbarHeight, SIZEOF(buttonControls),
- buttonControls, buttonWidth, buttonSpacing, buttonAlignment, g_dat.buttonVisibility);
-
-*/
EndDeferWindowPos(hdwp);
+
if (dat->windowData.hwndLog != NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = hwndDlg;
ieWindow.hwnd = dat->windowData.hwndLog;
- ieWindow.x = 0;
- ieWindow.y = logY;
- ieWindow.cx = w;
- ieWindow.cy = logH;
+ ieWindow.x = 0;
+ ieWindow.y = logY;
+ ieWindow.cx = w;
+ ieWindow.cy = logH;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- } else {
- RedrawWindow(GetDlgItem(hwndDlg, IDC_LOG), NULL, NULL, RDW_INVALIDATE);
}
+ else RedrawWindow(GetDlgItem(hwndDlg, IDC_LOG), NULL, NULL, RDW_INVALIDATE);
+
RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
- RefreshInfobar(dat->infobarData);
+ RefreshInfobar(dat->infobarData);
RedrawWindow(GetDlgItem(hwndDlg, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE);
}
-static void UpdateReadChars(HWND hwndDlg, struct SrmmWindowData * dat)
+static void UpdateReadChars(HWND hwndDlg, SrmmWindowData *dat)
{
if (dat->parent->hwndActive == hwndDlg) {
TCHAR szText[256];
- StatusBarData sbd;
int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE);
+
+ StatusBarData sbd;
sbd.iItem = 1;
sbd.iFlags = SBDF_TEXT | SBDF_ICON;
sbd.hIcon = NULL;
@@ -637,45 +618,51 @@ static void UpdateReadChars(HWND hwndDlg, struct SrmmWindowData * dat) }
}
-void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat)
+void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat)
{
INT_PTR res = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->windowData.hContact, 0);
dat->ace = res != CALLSERVICE_NOTFOUND ? (AVATARCACHEENTRY*)res : NULL;
dat->avatarPic = (dat->ace != NULL && (dat->ace->dwFlags & AVS_HIDEONCLIST) == 0) ? dat->ace->hbmPic : NULL;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
- RefreshInfobar(dat->infobarData);
+ RefreshInfobar(dat->infobarData);
RedrawWindow(GetDlgItem(hwndDlg, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE);
}
-static BOOL IsTypingNotificationSupported(struct SrmmWindowData *dat) {
+static BOOL IsTypingNotificationSupported(SrmmWindowData *dat)
+{
DWORD typeCaps;
if (!dat->windowData.hContact)
return FALSE;
+
if (!dat->szProto)
return FALSE;
+
typeCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (!(typeCaps & PF4_SUPPORTTYPING))
return FALSE;
return TRUE;
}
-static BOOL IsTypingNotificationEnabled(struct SrmmWindowData *dat) {
- DWORD protoStatus;
- DWORD protoCaps;
- if (!DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
+static BOOL IsTypingNotificationEnabled(SrmmWindowData *dat)
+{
+ if (!db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
return FALSE;
- protoStatus = CallProtoService(dat->szProto, PS_GETSTATUS, 0, 0);
+
+ DWORD protoStatus = CallProtoService(dat->szProto, PS_GETSTATUS, 0, 0);
if (protoStatus < ID_STATUS_ONLINE)
return FALSE;
- protoCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+
+ DWORD protoCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return FALSE;
+
if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return FALSE;
- if (DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0)
- && !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
+
+ if (db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0)
+ && !db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
return FALSE;
return TRUE;
}
@@ -685,13 +672,14 @@ static BOOL IsTypingNotificationEnabled(struct SrmmWindowData *dat) { // Don't send to protocols that are offline
// Don't send to users who are not visible and
// Don't send to users who are not on the visible list when you are in invisible mode.
-static void NotifyTyping(struct SrmmWindowData *dat, int mode) {
- if (!IsTypingNotificationSupported(dat)) {
+static void NotifyTyping(struct SrmmWindowData *dat, int mode)
+{
+ if (!IsTypingNotificationSupported(dat))
return;
- }
- if (!IsTypingNotificationEnabled(dat)) {
+
+ if (!IsTypingNotificationEnabled(dat))
return;
- }
+
// End user check
dat->nTypeMode = mode;
CallService(MS_PROTO_SELFISTYPING, (WPARAM) dat->windowData.hContact, dat->nTypeMode);
@@ -715,18 +703,16 @@ static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa MoveWindow(hwndDlg, rcChild.left, rcChild.top, rcChild.right, rcChild.bottom, FALSE);
}
return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDYES:
case IDNO:
case IDCANCEL:
- {
- int result = LOWORD(wParam);
- if (IsDlgButtonChecked(hwndDlg, IDC_REMEMBER)) {
- result |= 0x10000;
- }
- EndDialog(hwndDlg, result);
- }
+ int result = LOWORD(wParam);
+ if (IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
+ result |= 0x10000;
+ EndDialog(hwndDlg, result);
return TRUE;
}
break;
@@ -735,13 +721,13 @@ static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa return FALSE;
}
-
INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HMENU hToolbarMenu;
- struct SrmmWindowData *dat;
- dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (!dat && msg!=WM_INITDIALOG) return FALSE;
+ SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (!dat && msg != WM_INITDIALOG)
+ return FALSE;
+
switch (msg) {
case WM_INITDIALOG:
{
@@ -749,13 +735,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int notifyUnread = 0;
RECT minEditInit;
NewMessageWindowLParam *newData = (NewMessageWindowLParam *) lParam;
- //TranslateDialogDefault(hwndDlg);
dat = (struct SrmmWindowData *) mir_alloc(sizeof(struct SrmmWindowData));
ZeroMemory(dat, sizeof(struct SrmmWindowData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
dat->windowData.hContact = newData->hContact;
NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPENING);
-// SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTMODE, TM_PLAINTEXT, 0);
dat->hwnd = hwndDlg;
dat->hwndParent = GetParent(hwndDlg);
@@ -783,9 +767,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->lastEventTime = time(NULL);
dat->startTime = time(NULL);
dat->flags = 0;
- if (DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) 0)) {
+ if (db_get_b(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) 0))
dat->flags |= SMF_RTL;
- }
+
dat->flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
{
PARAFORMAT2 pf2;
@@ -795,7 +779,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!(dat->flags & SMF_RTL)) {
pf2.wEffects = 0;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE) & ~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
- } else {
+ }
+ else {
pf2.wEffects = PFE_RTLPARA;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
}
@@ -811,11 +796,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP pf2.dwMask = PFM_RTLPARA;
pf2.wEffects = 0;
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- if (dat->flags & SMF_RTL) {
+ if (dat->flags & SMF_RTL)
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE) | WS_EX_LEFTSCROLLBAR);
- } else {
+ else
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE) & ~WS_EX_LEFTSCROLLBAR);
- }
}
dat->windowData.codePage = DBGetContactSettingWord(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD) CP_ACP);
dat->ace = NULL;
@@ -824,9 +808,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->windowData.minLogBoxHeight = dat->windowData.minEditBoxHeight;
dat->toolbarSize.cy = TOOLBAR_HEIGHT;
dat->toolbarSize.cx = GetToolbarWidth(SIZEOF(toolbarButtons), toolbarButtons);
- if (dat->splitterPos == -1) {
+ if (dat->splitterPos == -1)
dat->splitterPos = dat->windowData.minEditBoxHeight;
- }
WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->windowData.hContact);
if (newData->szInitialText) {
@@ -834,19 +817,18 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText);
else
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- } else if (g_dat.flags & SMF_SAVEDRAFTS) {
- TCmdList *draft = tcmdlist_get2(g_dat.draftList, dat->windowData.hContact);
- if (draft != NULL) {
+ }
+ else if (g_dat.flags & SMF_SAVEDRAFTS) {
+ TCmdList *draft = tcmdlist_get2(g_dat.draftList, dat->windowData.hContact);
+ if (draft != NULL)
len = SetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), draft->szCmd, dat->windowData.codePage);
- }
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
}
SendMessage(hwndDlg, DM_CHANGEICONS, 0, 0);
// Make them flat buttons
{
- int i;
- for (i = 0; i < SIZEOF(toolbarButtons) ; i++)
+ for (int i = 0; i < SIZEOF(toolbarButtons) ; i++)
SendMessage(GetDlgItem(hwndDlg, toolbarButtons[i].controlId), BUTTONSETASFLATBTN, TRUE, 0);
}
SendMessage(GetDlgItem(hwndDlg, IDC_ADD), BUTTONADDTOOLTIP, (WPARAM) Translate("Add Contact Permanently to List"), 0);
@@ -871,8 +853,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
if (dat->windowData.hContact) {
if (dat->szProto) {
- int nMax;
- nMax = CallProtoService(dat->szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, (LPARAM) dat->windowData.hContact);
+ int nMax = CallProtoService(dat->szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, (LPARAM) dat->windowData.hContact);
if (nMax)
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, (WPARAM) nMax, 0);
}
@@ -885,38 +866,32 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SubclassMessageEdit(GetDlgItem(hwndDlg, IDC_MESSAGE));
dat->infobarData = CreateInfobar(hwndDlg, dat);
if (dat->flags & SMF_USEIEVIEW) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ IEVIEWWINDOW ieWindow = { sizeof(IEVIEWWINDOW) };
ieWindow.iType = IEW_CREATE;
- ieWindow.dwFlags = 0;
ieWindow.dwMode = IEWM_SCRIVER;
ieWindow.parent = hwndDlg;
- ieWindow.x = 0;
- ieWindow.y = 0;
ieWindow.cx = 200;
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
dat->windowData.hwndLog = ieWindow.hwnd;
- if (dat->windowData.hwndLog == NULL) {
+ if (dat->windowData.hwndLog == NULL)
dat->flags ^= SMF_USEIEVIEW;
- }
}
if (dat->windowData.hContact) {
- int historyMode = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
+ int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
// This finds the first message to display, it works like shit
dat->hDbEventFirst = db_event_firstUnread(dat->windowData.hContact);
if (dat->hDbEventFirst != NULL) {
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(dat->hDbEventFirst, &dbei);
- if (DbEventIsMessageOrCustom(&dbei) && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
+ if (DbEventIsMessageOrCustom(&dbei) && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT))
notifyUnread = 1;
- }
}
switch (historyMode) {
case LOADHISTORY_COUNT:
{
- HANDLE hPrevEvent;
DBEVENTINFO dbei = { sizeof(dbei) };
+ HANDLE hPrevEvent;
for (int i = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i > 0; i--) {
if (dat->hDbEventFirst == NULL)
hPrevEvent = db_event_last(dat->windowData.hContact);
@@ -930,8 +905,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!DbEventIsShown(&dbei, dat))
i++;
}
- break;
}
+ break;
+
case LOADHISTORY_TIME:
{
HANDLE hPrevEvent;
@@ -987,18 +963,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(dat->hwndParent, CM_STARTFLASHING, 0, 0);
}
dat->messagesInProgress = ReattachSendQueueItems(hwndDlg, dat->windowData.hContact);
- if (dat->messagesInProgress > 0) {
+ if (dat->messagesInProgress > 0)
SendMessage(hwndDlg, DM_SHOWMESSAGESENDING, 0, 0);
- }
+
NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPEN);
- return TRUE;
}
+ return TRUE;
+
case DM_GETCONTEXTMENU:
{
HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) dat->windowData.hContact, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)hMenu);
- return TRUE;
}
+ return TRUE;
+
case WM_CONTEXTMENU:
if (dat->hwndParent == (HWND) wParam) {
POINT pt;
@@ -1008,9 +986,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DestroyMenu(hMenu);
}
break;
+
case WM_LBUTTONDBLCLK:
SendMessage(dat->hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0);
break;
+
case WM_RBUTTONUP:
{
int i;
@@ -1029,7 +1009,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
}
-// TranslateMenu(hToolbarMenu);
pt.x = (short) LOWORD(GetMessagePos());
pt.y = (short) HIWORD(GetMessagePos());
i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
@@ -1039,13 +1018,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
DestroyMenu(hToolbarMenu);
- return TRUE;
}
+ return TRUE;
+
case WM_DROPFILES:
- if (dat->szProto==NULL) break;
+ if (dat->szProto == NULL) break;
if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1,0)&PF1_FILESEND)) break;
- if (dat->wStatus==ID_STATUS_OFFLINE) break;
- if (dat->windowData.hContact!=NULL) {
+ if (dat->wStatus == ID_STATUS_OFFLINE) break;
+ if (dat->windowData.hContact != NULL) {
TCHAR szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
int fileCount = DragQueryFile(hDrop,-1,NULL,0), totalCount = 0, i;
@@ -1065,15 +1045,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case DM_GETAVATAR:
- {
- PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai), dat->windowData.hContact };
- CallProtoService(dat->szProto, PS_GETAVATARINFOT, GAIF_FORCE, (LPARAM)&ai);
- ShowAvatar(hwndDlg, dat);
+ {
+ PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai), dat->windowData.hContact };
+ CallProtoService(dat->szProto, PS_GETAVATARINFOT, GAIF_FORCE, (LPARAM)&ai);
+ ShowAvatar(hwndDlg, dat);
+ }
break;
- }
+
case DM_TYPING:
dat->nTypeSecs = (int) lParam > 0 ? (int) lParam : 0;
break;
+
case DM_CHANGEICONS:
SendDlgItemMessage(hwndDlg, IDC_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_ADD"));
SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_USERDETAILS"));
@@ -1119,73 +1101,61 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case DM_CLISTSETTINGSCHANGED:
- {
- if ((HANDLE)wParam == dat->windowData.hContact) {
- if (dat->windowData.hContact && dat->szProto) {
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- char idbuf[128];
- char buf[128];
- GetContactUniqueId(dat, idbuf, sizeof(idbuf));
- mir_snprintf(buf, sizeof(buf), Translate("User Menu - %s"), idbuf);
- SendMessage(GetDlgItem(hwndDlg, IDC_USERMENU), BUTTONADDTOOLTIP, (WPARAM) buf, 0);
-
- if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) {
- DWORD wStatus;
- wStatus = DBGetContactSettingWord( dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- // log status change - should be moved to a separate place
- if (dat->wStatus != wStatus && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) {
- DBEVENTINFO dbei;
- TCHAR buffer[512];
- char blob[2048];
- HANDLE hNewEvent;
- int iLen;
- TCHAR *szOldStatus = mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR));
- TCHAR *szNewStatus = mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) wStatus, GSMDF_TCHAR));
- if (wStatus == ID_STATUS_OFFLINE) {
- iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("signed off (was %s)"), szOldStatus);
- SendMessage(hwndDlg, DM_TYPING, 0, 0);
- }
- else if (dat->wStatus == ID_STATUS_OFFLINE) {
- iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("signed on (%s)"), szNewStatus);
- }
- else {
- iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("is now %s (was %s)"), szNewStatus, szOldStatus);
- }
- mir_free(szOldStatus);
- mir_free(szNewStatus);
-
- {
- int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, sizeof(blob), 0, 0);
- memcpy( blob+ansiLen, buffer, sizeof(TCHAR)*(iLen+1));
- dbei.cbBlob = ansiLen + sizeof(TCHAR)*(iLen+1);
- }
-
- //iLen = strlen(buffer) + 1;
- //MultiByteToWideChar(CP_ACP, 0, buffer, iLen, (LPWSTR) & buffer[iLen], iLen);
- dbei.cbSize = sizeof(dbei);
- dbei.pBlob = (PBYTE) blob;
- // dbei.cbBlob = (strlen(buffer) + 1) * (sizeof(TCHAR) + 1);
- dbei.eventType = EVENTTYPE_STATUSCHANGE;
- dbei.flags = 0;
- dbei.timestamp = time(NULL);
- dbei.szModule = dat->szProto;
- hNewEvent = db_event_add(dat->windowData.hContact, &dbei);
- if (dat->hDbEventFirst == NULL) {
- dat->hDbEventFirst = hNewEvent;
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- }
- }
- dat->wStatus = wStatus;
- }
- SetStatusIcon(dat);
- SendMessage(hwndDlg, DM_UPDATEICON, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
- ShowAvatar(hwndDlg, dat);
- }
+ if ((HANDLE)wParam == dat->windowData.hContact) {
+ if (dat->windowData.hContact && dat->szProto) {
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
+ char idbuf[128];
+ char buf[128];
+ GetContactUniqueId(dat, idbuf, sizeof(idbuf));
+ mir_snprintf(buf, sizeof(buf), Translate("User Menu - %s"), idbuf);
+ SendMessage(GetDlgItem(hwndDlg, IDC_USERMENU), BUTTONADDTOOLTIP, (WPARAM) buf, 0);
+
+ if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) {
+ DWORD wStatus;
+ wStatus = DBGetContactSettingWord( dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ // log status change - should be moved to a separate place
+ if (dat->wStatus != wStatus && db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) {
+ mir_ptr<TCHAR> szOldStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR)));
+ mir_ptr<TCHAR> szNewStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) wStatus, GSMDF_TCHAR)));
+
+ int iLen;
+ TCHAR buffer[512];
+ if (wStatus == ID_STATUS_OFFLINE) {
+ iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("signed off (was %s)"), szOldStatus);
+ SendMessage(hwndDlg, DM_TYPING, 0, 0);
+ }
+ else if (dat->wStatus == ID_STATUS_OFFLINE)
+ iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("signed on (%s)"), szNewStatus);
+ else
+ iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("is now %s (was %s)"), szNewStatus, szOldStatus);
+
+ char blob[2048];
+ int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, sizeof(blob), 0, 0);
+ memcpy(blob+ansiLen, buffer, sizeof(TCHAR)*(iLen+1));
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = ansiLen + sizeof(TCHAR)*(iLen+1);
+ dbei.pBlob = (PBYTE)blob;
+ dbei.eventType = EVENTTYPE_STATUSCHANGE;
+ dbei.timestamp = time(NULL);
+ dbei.szModule = dat->szProto;
+ HANDLE hNewEvent = db_event_add(dat->windowData.hContact, &dbei);
+ if (dat->hDbEventFirst == NULL) {
+ dat->hDbEventFirst = hNewEvent;
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ }
+ }
+ dat->wStatus = wStatus;
+ }
+ SetStatusIcon(dat);
+ SendMessage(hwndDlg, DM_UPDATEICON, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
+ ShowAvatar(hwndDlg, dat);
}
- break;
}
+ break;
+
case DM_OPTIONSAPPLIED:
{
PARAFORMAT2 pf2;
@@ -1197,25 +1167,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->flags &= ~SMF_USEIEVIEW;
dat->flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
if (dat->flags & SMF_USEIEVIEW && dat->windowData.hwndLog == NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_CREATE;
- ieWindow.dwFlags = 0;
ieWindow.dwMode = IEWM_SCRIVER;
ieWindow.parent = hwndDlg;
- ieWindow.x = 0;
- ieWindow.y = 0;
ieWindow.cx = 200;
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
dat->windowData.hwndLog = ieWindow.hwnd;
- if (dat->windowData.hwndLog == NULL) {
+ if (dat->windowData.hwndLog == NULL)
dat->flags ^= SMF_USEIEVIEW;
- }
- } else if (!(dat->flags & SMF_USEIEVIEW) && dat->windowData.hwndLog != NULL) {
+ }
+ else if (!(dat->flags & SMF_USEIEVIEW) && dat->windowData.hwndLog != NULL) {
if (dat->windowData.hwndLog != NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_DESTROY;
ieWindow.hwnd = dat->windowData.hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
@@ -1257,52 +1222,54 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
SetupInfobar(dat->infobarData);
- break;
}
- case DM_USERNAMETOCLIP:
- {
+ break;
+
+ case DM_USERNAMETOCLIP:
+ if (dat->windowData.hContact) {
char buf[128];
- HGLOBAL hData;
+ GetContactUniqueId(dat, buf, sizeof(buf));
+ if (!OpenClipboard(hwndDlg) || !lstrlenA(buf))
+ break;
- if (dat->windowData.hContact) {
- GetContactUniqueId(dat, buf, sizeof(buf));
- if (!OpenClipboard(hwndDlg) || !lstrlenA(buf)) break;
- EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(buf) + 1);
- lstrcpyA((LPSTR)GlobalLock(hData), buf);
- GlobalUnlock(hData);
- SetClipboardData(CF_TEXT, hData);
- CloseClipboard();
- }
- break;
+ EmptyClipboard();
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(buf) + 1);
+ lstrcpyA((LPSTR)GlobalLock(hData), buf);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_TEXT, hData);
+ CloseClipboard();
}
+ break;
+
case DM_SWITCHINFOBAR:
case DM_SWITCHTOOLBAR:
SetDialogToType(hwndDlg);
-// SendMessage(dat->hwndParent, DM_SWITCHTOOLBAR, 0, 0);
break;
+
case DM_GETCODEPAGE:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, dat->windowData.codePage);
return TRUE;
+
case DM_SETCODEPAGE:
dat->windowData.codePage = (int) lParam;
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
break;
+
case DM_SWITCHTYPING:
if (IsTypingNotificationSupported(dat)) {
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
sid.szModule = SRMMMOD;
sid.dwId = 1;
- {
- BYTE typingNotify = (DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
- DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)));
- DBWriteContactSettingByte(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)!typingNotify);
- sid.flags = typingNotify ? MBF_DISABLED : 0;
- }
+
+ BYTE typingNotify = (db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
+ db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)));
+ db_set_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)!typingNotify);
+ sid.flags = typingNotify ? MBF_DISABLED : 0;
ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid);
}
break;
+
case DM_SWITCHRTL:
{
PARAFORMAT2 pf2;
@@ -1314,7 +1281,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP pf2.wEffects = PFE_RTLPARA;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE) | WS_EX_LEFTSCROLLBAR);
- } else {
+ }
+ else {
pf2.wEffects = 0;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE),GWL_EXSTYLE) &~ (WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE) &~ (WS_EX_LEFTSCROLLBAR));
@@ -1323,11 +1291,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
break;
+
case DM_GETWINDOWSTATE:
{
- UINT state = 0;
-
- state |= MSG_WINDOW_STATE_EXISTS;
+ UINT state = MSG_WINDOW_STATE_EXISTS;
if (IsWindowVisible(hwndDlg))
state |= MSG_WINDOW_STATE_VISIBLE;
if (GetForegroundWindow()==dat->hwndParent)
@@ -1335,13 +1302,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (IsIconic(dat->hwndParent))
state |= MSG_WINDOW_STATE_ICONIC;
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
- return TRUE;
-
}
+ return TRUE;
+
case DM_ACTIVATE:
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_ACTIVE)
break;
+
//fall through
case WM_MOUSEACTIVATE:
if (dat->hDbUnreadEventFirst != NULL) {
@@ -1350,9 +1318,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP while (hDbEvent != NULL) {
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags & DBEF_SENT) && (DbEventIsMessageOrCustom(&dbei) || dbei.eventType == EVENTTYPE_URL)) {
+ if (!(dbei.flags & DBEF_SENT) && (DbEventIsMessageOrCustom(&dbei) || dbei.eventType == EVENTTYPE_URL))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM) dat->windowData.hContact, (LPARAM) hDbEvent);
- }
hDbEvent = db_event_next(hDbEvent);
}
}
@@ -1362,102 +1329,92 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, DM_UPDATEICON, 0, 0);
}
break;
+
case WM_LBUTTONDOWN:
SendMessage(dat->hwndParent, WM_LBUTTONDOWN, wParam, lParam);
return TRUE;
+
case DM_SETFOCUS:
if (lParam == WM_MOUSEACTIVATE) {
HWND hLog;
- RECT rc;
POINT pt;
GetCursorPos(&pt);
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->windowData.hwndLog != NULL)
hLog = dat->windowData.hwndLog;
- } else {
+ else
hLog = GetDlgItem(hwndDlg, IDC_LOG);
- }
+
+ RECT rc;
GetWindowRect(hLog, &rc);
- if (pt.x >= rc.left && pt.x <= rc.right && pt.y >= rc.top && pt.y <=rc.bottom) {
- // SetFocus(hLog);
+ if (pt.x >= rc.left && pt.x <= rc.right && pt.y >= rc.top && pt.y <=rc.bottom)
return TRUE;
- }
}
- if (g_dat.hFocusWnd == hwndDlg) {
+ if (g_dat.hFocusWnd == hwndDlg)
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- }
return TRUE;
+
case WM_SETFOCUS:
SendMessage(dat->hwndParent, CM_ACTIVATECHILD, 0, (LPARAM)hwndDlg);
g_dat.hFocusWnd = hwndDlg;
PostMessage(hwndDlg, DM_SETFOCUS, 0, 0);
return TRUE;
+
case DM_SETPARENT:
dat->hwndParent = (HWND) lParam;
dat->parent = (ParentWindowData *) GetWindowLongPtr(dat->hwndParent, GWLP_USERDATA);
SetParent(hwndDlg, dat->hwndParent);
return TRUE;
+
case WM_GETMINMAXINFO:
{
MINMAXINFO *mmi = (MINMAXINFO *) lParam;
mmi->ptMinTrackSize.x = dat->toolbarSize.cx + BOTTOM_RIGHT_AVATAR_HEIGHT;
mmi->ptMinTrackSize.y = dat->windowData.minLogBoxHeight + dat->toolbarSize.cy + dat->windowData.minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - dat->toolbarSize.cy) + 5;
- return 0;
}
+ return 0;
+
case WM_SIZE:
- {
- if (wParam==SIZE_RESTORED || wParam==SIZE_MAXIMIZED) {
- RECT rc;
- int dlgWidth, dlgHeight;
- dlgWidth = LOWORD(lParam);
- dlgHeight = HIWORD(lParam);
- /*if (dlgWidth == 0 && dlgHeight ==0) */{
- GetClientRect(hwndDlg, &rc);
- dlgWidth = rc.right - rc.left;
- dlgHeight = rc.bottom - rc.top;
- }
- MessageDialogResize(hwndDlg, dat, dlgWidth, dlgHeight);
- }
- return TRUE;
+ if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
+ RECT rc;
+ GetClientRect(hwndDlg, &rc);
+ MessageDialogResize(hwndDlg, dat, rc.right - rc.left, rc.bottom - rc.top);
}
+ return TRUE;
+
case DM_SPLITTERMOVED:
- {
- POINT pt;
- RECT rc;
- RECT rcLog;
- if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
- int oldSplitterY;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
- GetClientRect(hwndDlg, &rc);
- pt.x = 0;
- pt.y = wParam;
- ScreenToClient(hwndDlg, &pt);
- oldSplitterY = dat->splitterPos;
- dat->splitterPos = rc.bottom - pt.y;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- }
- break;
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
+ RECT rc, rcLog;
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
+ GetClientRect(hwndDlg, &rc);
+
+ POINT pt = { 0, wParam };
+ ScreenToClient(hwndDlg, &pt);
+ dat->splitterPos = rc.bottom - pt.y;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
+ break;
+
case DM_REMAKELOG:
dat->lastEventType = -1;
- if (wParam == 0 || (HANDLE) wParam == dat->windowData.hContact) {
- //StreamInEvents(hwndDlg, dat->hDbEventFirst, 0, 0);
+ if (wParam == 0 || (HANDLE) wParam == dat->windowData.hContact)
StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0);
- }
+
InvalidateRect(GetDlgItem(hwndDlg, IDC_LOG), NULL, FALSE);
break;
+
case DM_APPENDTOLOG: //takes wParam=hDbEvent
StreamInEvents(hwndDlg, (HANDLE) wParam, 1, 1);
break;
+
case DM_SCROLLLOGTOBOTTOM:
if (dat->windowData.hwndLog == NULL) {
- SCROLLINFO si = { 0 };
if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_STYLE) & WS_VSCROLL) == 0)
break;
- si.cbSize = sizeof(si);
+
+ SCROLLINFO si = { sizeof(si) };
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
if (GetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si)) {
if (GetDlgItem(hwndDlg, IDC_LOG) != GetFocus()) {
-// if (si.nPos + si.nPage >= si.nMax) {
si.fMask = SIF_POS;
si.nPos = si.nMax - si.nPage + 1;
SetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si, TRUE);
@@ -1465,7 +1422,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
RedrawWindow(GetDlgItem(hwndDlg, IDC_LOG), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
- } else {
+ }
+ else {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_SCROLLBOTTOM;
@@ -1473,6 +1431,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
break;
+
case HM_DBEVENTADDED:
if ((HANDLE)wParam == dat->windowData.hContact) {
HANDLE hDbEvent = (HANDLE)lParam;
@@ -1481,10 +1440,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->hDbEventFirst == NULL)
dat->hDbEventFirst = hDbEvent;
if (DbEventIsShown(&dbei, dat)) {
- int heFlags = HistoryEvents_GetFlags(dbei.eventType);
- if (heFlags != -1 && (heFlags & HISTORYEVENTS_FLAG_DEFAULT))
- heFlags = -1;
-
if (DbEventIsMessageOrCustom(&dbei) && !(dbei.flags & (DBEF_SENT))) {
/* store the event when the container is hidden so that clist notifications can be removed */
if (!IsWindowVisible(GetParent(hwndDlg)) && dat->hDbUnreadEventFirst == NULL)
@@ -1494,18 +1449,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (GetForegroundWindow()==dat->hwndParent && dat->parent->hwndActive == hwndDlg)
SkinPlaySound("RecvMsgActive");
else SkinPlaySound("RecvMsgInactive");
- if ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(dat->hwndParent) || GetActiveWindow() != dat->hwndParent) && IsWindowVisible(dat->hwndParent)) {
+ if ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(dat->hwndParent) || GetActiveWindow() != dat->hwndParent) && IsWindowVisible(dat->hwndParent))
SendMessage(dat->hwndParent, CM_ACTIVATECHILD, 0, (LPARAM)hwndDlg);
- }
- if (IsAutoPopup(dat->windowData.hContact)) {
+ if (IsAutoPopup(dat->windowData.hContact))
SendMessage(GetParent(hwndDlg), CM_POPUPWINDOW, 1, (LPARAM)hwndDlg);
- }
}
if (hDbEvent != dat->hDbEventFirst && db_event_next(hDbEvent) == NULL)
SendMessage(hwndDlg, DM_APPENDTOLOG, WPARAM(hDbEvent), 0);
else
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- if (!(dbei.flags & DBEF_SENT) && dbei.eventType != EVENTTYPE_STATUSCHANGE && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE && (heFlags == -1 || (heFlags & HISTORYEVENTS_FLAG_FLASH_MSG_WINDOW))) {
+ if (!(dbei.flags & DBEF_SENT) && dbei.eventType != EVENTTYPE_STATUSCHANGE && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
if (GetActiveWindow() != dat->hwndParent || GetForegroundWindow() != dat->hwndParent || dat->parent->hwndActive != hwndDlg) {
dat->showUnread = 1;
SendMessage(hwndDlg, DM_UPDATEICON, 0, 0);
@@ -1516,6 +1469,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
break;
+
case DM_UPDATESTATUSBAR:
if (dat->parent->hwndActive == hwndDlg) {
TCHAR szText[256];
@@ -1526,22 +1480,24 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP sbd.hIcon = GetCachedIcon("scriver_DELIVERING");
sbd.pszText = szText;
mir_sntprintf(szText, SIZEOF(szText), TranslateT("Sending in progress: %d message(s) left..."), dat->messagesInProgress);
- } else if (dat->nTypeSecs) {
+ }
+ else if (dat->nTypeSecs) {
TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
sbd.hIcon = GetCachedIcon("scriver_TYPING");
sbd.pszText = szText;
mir_sntprintf(szText, SIZEOF(szText), TranslateT("%s is typing a message..."), szContactName);
mir_free(szContactName);
dat->nTypeSecs--;
- } else if (dat->lastMessage) {
+ }
+ else if (dat->lastMessage) {
TCHAR date[64], time[64];
tmi.printTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0);
tmi.printTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0);
mir_sntprintf(szText, SIZEOF(szText), TranslateT("Last message received on %s at %s."), date, time);
sbd.pszText = szText;
- } else {
- sbd.pszText = _T("");
}
+ else sbd.pszText = _T("");
+
SendMessage(dat->hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)hwndDlg);
UpdateReadChars(hwndDlg, dat);
sid.cbSize = sizeof(sid);
@@ -1549,15 +1505,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP sid.flags = MBF_DISABLED;
ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid);
sid.dwId = 1;
- if (IsTypingNotificationSupported(dat) && g_dat.flags2 & SMF2_SHOWTYPINGSWITCH) {
- sid.flags = (DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
- DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) ? 0 : MBF_DISABLED;
- } else {
+ if (IsTypingNotificationSupported(dat) && g_dat.flags2 & SMF2_SHOWTYPINGSWITCH)
+ sid.flags = (db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
+ db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) ? 0 : MBF_DISABLED;
+ else
sid.flags = MBF_HIDDEN;
- }
+
ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid);
}
break;
+
case DM_CLEARLOG:
// IEVIew MOD Begin
if (dat->windowData.hwndLog != NULL) {
@@ -1577,17 +1534,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->hDbEventFirst = NULL;
dat->lastEventType = -1;
break;
+
case WM_TIMER:
- if (wParam == TIMERID_MSGSEND) {
+ if (wParam == TIMERID_MSGSEND)
ReportSendQueueTimeouts(hwndDlg);
- } else if (wParam == TIMERID_TYPE) {
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - dat->nLastTyping > TIMEOUT_TYPEOFF) {
+ else if (wParam == TIMERID_TYPE) {
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - dat->nLastTyping > TIMEOUT_TYPEOFF)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
- }
+
if (dat->showTyping) {
- if (dat->nTypeSecs) {
+ if (dat->nTypeSecs)
dat->nTypeSecs--;
- }
else {
dat->showTyping = 0;
SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
@@ -1601,20 +1558,18 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, DM_UPDATEICON, 0, 0);
}
}
- } else if (wParam == TIMERID_UNREAD) {
+ }
+ else if (wParam == TIMERID_UNREAD) {
TabControlData tcd;
tcd.iFlags = TCDF_ICON;
if (!dat->showTyping) {
dat->showUnread++;
- if (dat->showUnread & 1) {
- tcd.hIcon = dat->statusIconOverlay;
- } else {
- tcd.hIcon = dat->statusIcon;
- }
+ tcd.hIcon = (dat->showUnread & 1) ? dat->statusIconOverlay : dat->statusIcon;
SendMessage(dat->hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
}
}
break;
+
case DM_SENDMESSAGE:
if (lParam) {
MessageSendQueueItem *msi = (MessageSendQueueItem *)lParam;
@@ -1646,25 +1601,25 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendSendQueueItem(item);
}
break;
+
case DM_STARTMESSAGESENDING:
dat->messagesInProgress++;
case DM_SHOWMESSAGESENDING:
SetTimer(hwndDlg, TIMERID_MSGSEND, 1000, NULL);
- if (g_dat.flags & SMF_SHOWPROGRESS) {
+ if (g_dat.flags & SMF_SHOWPROGRESS)
SendMessage(dat->hwnd, DM_UPDATESTATUSBAR, 0, 0);
- }
break;
+
case DM_STOPMESSAGESENDING:
- if (dat->messagesInProgress>0) {
+ if (dat->messagesInProgress > 0) {
dat->messagesInProgress--;
- if (g_dat.flags & SMF_SHOWPROGRESS) {
+ if (g_dat.flags & SMF_SHOWPROGRESS)
SendMessage(dat->hwnd, DM_UPDATESTATUSBAR, 0, 0);
- }
}
- if (dat->messagesInProgress == 0) {
+ if (dat->messagesInProgress == 0)
KillTimer(hwndDlg, TIMERID_MSGSEND);
- }
break;
+
case DM_SHOWERRORMESSAGE:
if (lParam) {
ErrorWindowData *ewd = (ErrorWindowData *) lParam;
@@ -1672,6 +1627,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ewd->queueItem->hwndErrorDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwndDlg, ErrorDlgProc, (LPARAM) ewd);//hwndDlg
}
break;
+
case DM_ERRORDECIDED:
{
MessageSendQueueItem *item = (MessageSendQueueItem *) lParam;
@@ -1688,89 +1644,87 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
break;
+
case WM_MEASUREITEM:
- if (!MeasureMenuItem(wParam, lParam)) {
+ if (!MeasureMenuItem(wParam, lParam))
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- }
return TRUE;
case WM_DRAWITEM:
- if (!DrawMenuItem(wParam, lParam)) {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
- if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_AVATAR)) {
- RECT rect;
- HDC hdcMem = CreateCompatibleDC(dis->hDC);
- int avatarWidth = 0;
- int avatarHeight = 0;
- int itemWidth = dis->rcItem.right - dis->rcItem.left + 1;
- int itemHeight = dis->rcItem.bottom - dis->rcItem.top + 1;
- HBITMAP hbmMem = CreateCompatibleBitmap(dis->hDC, itemWidth, itemHeight);
- hbmMem = (HBITMAP) SelectObject(hdcMem, hbmMem);
- rect.top = 0;
- rect.left = 0;
- rect.right = itemWidth - 1;
- rect.bottom = itemHeight - 1;
- FillRect(hdcMem, &rect, GetSysColorBrush(COLOR_BTNFACE));
-
- if (dat->avatarPic && (g_dat.flags&SMF_AVATAR)) {
- BITMAP bminfo;
- GetObject(dat->avatarPic, sizeof(bminfo), &bminfo);
- if ( bminfo.bmWidth != 0 && bminfo.bmHeight != 0 ) {
- AVATARDRAWREQUEST adr;
- avatarHeight = itemHeight;
- avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
- if (avatarWidth > itemWidth) {
- avatarWidth = itemWidth;
- avatarHeight = bminfo.bmHeight * avatarWidth / bminfo.bmWidth;
- }
- ZeroMemory(&adr, sizeof(adr));
- adr.cbSize = sizeof (AVATARDRAWREQUEST);
- adr.hContact = dat->windowData.hContact;
- adr.hTargetDC = hdcMem;
- adr.rcDraw.left = (itemWidth - avatarWidth) / 2;
- adr.rcDraw.top = (itemHeight - avatarHeight) / 2;
- adr.rcDraw.right = avatarWidth - 1;
- adr.rcDraw.bottom = avatarHeight - 1;
- adr.dwFlags = AVDRQ_DRAWBORDER | AVDRQ_HIDEBORDERONTRANSPARENCY;
-
- CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr);
+ if (!DrawMenuItem(wParam, lParam)) {
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
+ if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_AVATAR)) {
+ RECT rect;
+ HDC hdcMem = CreateCompatibleDC(dis->hDC);
+ int avatarWidth = 0;
+ int avatarHeight = 0;
+ int itemWidth = dis->rcItem.right - dis->rcItem.left + 1;
+ int itemHeight = dis->rcItem.bottom - dis->rcItem.top + 1;
+ HBITMAP hbmMem = CreateCompatibleBitmap(dis->hDC, itemWidth, itemHeight);
+ hbmMem = (HBITMAP) SelectObject(hdcMem, hbmMem);
+ rect.top = 0;
+ rect.left = 0;
+ rect.right = itemWidth - 1;
+ rect.bottom = itemHeight - 1;
+ FillRect(hdcMem, &rect, GetSysColorBrush(COLOR_BTNFACE));
+
+ if (dat->avatarPic && (g_dat.flags&SMF_AVATAR)) {
+ BITMAP bminfo;
+ GetObject(dat->avatarPic, sizeof(bminfo), &bminfo);
+ if ( bminfo.bmWidth != 0 && bminfo.bmHeight != 0 ) {
+ AVATARDRAWREQUEST adr;
+ avatarHeight = itemHeight;
+ avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
+ if (avatarWidth > itemWidth) {
+ avatarWidth = itemWidth;
+ avatarHeight = bminfo.bmHeight * avatarWidth / bminfo.bmWidth;
}
+ ZeroMemory(&adr, sizeof(adr));
+ adr.cbSize = sizeof (AVATARDRAWREQUEST);
+ adr.hContact = dat->windowData.hContact;
+ adr.hTargetDC = hdcMem;
+ adr.rcDraw.left = (itemWidth - avatarWidth) / 2;
+ adr.rcDraw.top = (itemHeight - avatarHeight) / 2;
+ adr.rcDraw.right = avatarWidth - 1;
+ adr.rcDraw.bottom = avatarHeight - 1;
+ adr.dwFlags = AVDRQ_DRAWBORDER | AVDRQ_HIDEBORDERONTRANSPARENCY;
+
+ CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr);
}
- BitBlt(dis->hDC, 0, 0, itemWidth, itemHeight, hdcMem, 0, 0, SRCCOPY);
- hbmMem = (HBITMAP) SelectObject(hdcMem, hbmMem);
- DeleteObject(hbmMem);
- DeleteDC(hdcMem);
- return TRUE;
}
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+ BitBlt(dis->hDC, 0, 0, itemWidth, itemHeight, hdcMem, 0, 0, SRCCOPY);
+ hbmMem = (HBITMAP) SelectObject(hdcMem, hbmMem);
+ DeleteObject(hbmMem);
+ DeleteDC(hdcMem);
+ return TRUE;
}
+ }
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
case WM_COMMAND:
if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) dat->windowData.hContact))
break;
+
switch (LOWORD(wParam)) {
case IDC_SENDALL:
{
int result;
if (dat->sendAllConfirm == 0) {
result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CONFIRM_SENDALL), hwndDlg, ConfirmSendAllDlgProc, (LPARAM)hwndDlg);
- if (result & 0x10000) {
+ if (result & 0x10000)
dat->sendAllConfirm = result;
- }
- } else {
- result = dat->sendAllConfirm;
- }
- if (LOWORD(result) != IDYES) {
- break;
}
+ else result = dat->sendAllConfirm;
+ if (LOWORD(result) != IDYES)
+ break;
}
+
case IDOK:
//this is a 'send' button
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
break;
- //if (GetKeyState(VK_CTRL) & 0x8000) { // copy user name
- //SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
- //}
+
if (dat->windowData.hContact != NULL) {
GETTEXTEX gt = {0};
PARAFORMAT2 pf2;
@@ -1823,38 +1777,40 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_MESSAGE, _T(""));
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN))
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN))
ShowWindow(dat->hwndParent, SW_MINIMIZE);
- if (LOWORD(wParam) == IDC_SENDALL) {
+ if (LOWORD(wParam) == IDC_SENDALL)
SendMessage(dat->hwndParent, DM_SENDMESSAGE, 0, (LPARAM) &msi);
- } else {
+ else
SendMessage(hwndDlg, DM_SENDMESSAGE, 0, (LPARAM) &msi);
- }
mir_free (msi.sendBuffer);
}
return TRUE;
+
case IDCANCEL:
DestroyWindow(hwndDlg);
return TRUE;
+
case IDC_USERMENU:
- {
- if (GetKeyState(VK_SHIFT) & 0x8000) { // copy user name
- SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
- } else {
- RECT rc;
- HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) dat->windowData.hContact, 0);
- GetWindowRect(GetDlgItem(hwndDlg, LOWORD(wParam)), &rc);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
- DestroyMenu(hMenu);
- }
+ if (GetKeyState(VK_SHIFT) & 0x8000) // copy user name
+ SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
+ else {
+ RECT rc;
+ HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) dat->windowData.hContact, 0);
+ GetWindowRect(GetDlgItem(hwndDlg, LOWORD(wParam)), &rc);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ DestroyMenu(hMenu);
}
break;
+
case IDC_HISTORY:
CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM) dat->windowData.hContact, 0);
break;
+
case IDC_DETAILS:
CallService(MS_USERINFO_SHOWDIALOG, (WPARAM) dat->windowData.hContact, 0);
break;
+
case IDC_SMILEYS:
if (g_dat.smileyAddInstalled) {
SMADD_SHOWSEL3 smaddInfo;
@@ -1879,29 +1835,30 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
}
break;
+
case IDC_QUOTE:
- {
- DBEVENTINFO dbei = { 0 };
+ if (dat->hDbEventLast != NULL) {
SETTEXTEX st;
- TCHAR *buffer = NULL;
st.flags = ST_SELECTION;
st.codepage = 1200;
- if (dat->hDbEventLast==NULL) break;
- if (dat->windowData.hwndLog != NULL) {
+ TCHAR *buffer = NULL;
+ if (dat->windowData.hwndLog != NULL)
buffer = GetIEViewSelection(dat);
- } else {
+ else
buffer = GetRichEditSelection(GetDlgItem(hwndDlg, IDC_LOG));
- }
+
if (buffer!=NULL) {
TCHAR *quotedBuffer = GetQuotedTextW(buffer);
SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETTEXTEX, (WPARAM) &st, (LPARAM)quotedBuffer);
mir_free(quotedBuffer);
mir_free(buffer);
- } else {
- dbei.cbSize = sizeof(dbei);
+ }
+ else {
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = db_event_getBlobSize(dat->hDbEventLast);
- if (dbei.cbBlob == 0xFFFFFFFF) break;
+ if (dbei.cbBlob == 0xFFFFFFFF)
+ break;
dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob);
db_event_get(dat->hDbEventLast, &dbei);
if (DbEventIsMessageOrCustom(&dbei) || dbei.eventType == EVENTTYPE_STATUSCHANGE) {
@@ -1916,20 +1873,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mir_free(dbei.pBlob);
}
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- break;
}
+ break;
+
case IDC_ADD:
{
ADDCONTACTSTRUCT acs = { 0 };
-
acs.handle = dat->windowData.hContact;
acs.handleType = HANDLE_CONTACT;
acs.szProto = 0;
CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM) & acs);
}
- if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0)) {
+ if (!db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
- }
+
case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE);
@@ -1954,8 +1911,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case WM_NOTIFY:
{
- LPNMHDR pNmhdr;
- pNmhdr = (LPNMHDR)lParam;
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
switch (pNmhdr->idFrom) {
case IDC_LOG:
switch (pNmhdr->code) {
@@ -2004,6 +1960,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetCursor(hCurHyperlinkHand);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
+
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_MESSAGE),(ENLINK*)lParam)) {
@@ -2027,9 +1984,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
REQRESIZE *rr = (REQRESIZE *)lParam;
int height = rr->rc.bottom - rr->rc.top + 1;
- if (height < g_dat.minInputAreaHeight) {
+ if (height < g_dat.minInputAreaHeight)
height = g_dat.minInputAreaHeight;
- }
+
if (dat->desiredInputAreaHeight != height) {
dat->desiredInputAreaHeight = height;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -2041,48 +1998,47 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
break;
+
case WM_CHAR:
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), msg, wParam, lParam);
break;
+
case WM_DESTROY:
NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON) {
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
- }
+
Skin_ReleaseIcon(dat->statusIcon);
Skin_ReleaseIcon(dat->statusIconBig);
if (dat->statusIconOverlay != NULL) DestroyIcon(dat->statusIconOverlay);
dat->statusIcon = NULL;
dat->statusIconOverlay = NULL;
ReleaseSendQueueItems(hwndDlg);
- if (g_dat.flags & SMF_SAVEDRAFTS) {
+ if (g_dat.flags & SMF_SAVEDRAFTS)
saveDraftMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.hContact, dat->windowData.codePage);
- } else {
+ else
g_dat.draftList = tcmdlist_remove2(g_dat.draftList, dat->windowData.hContact);
- }
+
tcmdlist_free(dat->windowData.cmdList);
WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
UnsubclassMessageEdit(GetDlgItem(hwndDlg, IDC_MESSAGE));
UnsubclassLogEdit(GetDlgItem(hwndDlg, IDC_LOG));
- {
- HFONT hFont;
- hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
- if (hFont != NULL && hFont != (HFONT) SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
- DeleteObject(hFont);
- }
- DBWriteContactSettingByte(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) ((dat->flags & SMF_RTL) ? 1 : 0));
- DBWriteContactSettingWord(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD) dat->windowData.codePage);
- if (dat->windowData.hContact && (g_dat.flags & SMF_DELTEMP)) {
- if (DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0)) {
+
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ if (hFont != NULL && hFont != (HFONT) SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
+ DeleteObject(hFont);
+
+ db_set_b(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) ((dat->flags & SMF_RTL) ? 1 : 0));
+ db_set_w(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD) dat->windowData.codePage);
+ if (dat->windowData.hContact && (g_dat.flags & SMF_DELTEMP))
+ if (db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)dat->windowData.hContact, 0);
- }
- }
+
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
SendMessage(dat->hwndParent, CM_REMOVECHILD, 0, (LPARAM) hwndDlg);
if (dat->windowData.hwndLog != NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_DESTROY;
ieWindow.hwnd = dat->windowData.hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 2e6c95e393..8eac446e9a 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -144,29 +144,23 @@ int DbEventIsMessageOrCustom(DBEVENTINFO* dbei) int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat)
{
- int heFlags;
-
switch (dbei->eventType) {
- case EVENTTYPE_MESSAGE:
- return 1;
- case EVENTTYPE_STATUSCHANGE:
- case EVENTTYPE_JABBER_CHATSTATES:
- case EVENTTYPE_JABBER_PRESENCE:
- if (!DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) {
-// if (dbei->flags & DBEF_READ)
- return 0;
- }
- return 1;
- case EVENTTYPE_FILE:
- case EVENTTYPE_URL:
-// if (dat->hwndLog != NULL)
- return 1;
+ case EVENTTYPE_MESSAGE:
+ return 1;
+
+ case EVENTTYPE_STATUSCHANGE:
+ case EVENTTYPE_JABBER_CHATSTATES:
+ case EVENTTYPE_JABBER_PRESENCE:
+ if (!db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH))
+ return 0;
+ return 1;
+
+ case EVENTTYPE_FILE:
+ case EVENTTYPE_URL:
+ return 1;
}
- heFlags = HistoryEvents_GetFlags(dbei->eventType);
- if (heFlags != -1)
- return (heFlags & HISTORYEVENTS_FLAG_SHOW_IM_SRMM) == HISTORYEVENTS_FLAG_SHOW_IM_SRMM;
- return DbEventIsCustomForMsgWindow(dbei);
+ return DbEventIsCustomForMsgWindow(dbei);
}
EventData *getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent) {
@@ -601,16 +595,11 @@ static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *event, st int style, showColon = 0;
int isGroupBreak = TRUE;
int highlight = 0;
- int heFlags = -1;
bufferEnd = 0;
bufferAlloced = 1024;
buffer = (char *) mir_alloc(bufferAlloced);
buffer[0] = '\0';
- heFlags = HistoryEvents_GetFlags((WORD) event->eventType);
- if (heFlags != -1 && (heFlags & HISTORYEVENTS_FLAG_DEFAULT))
- heFlags = -1;
-
if ((gdat->flags & SMF_GROUPMESSAGES) && event->dwFlags == LOWORD(dat->lastEventType)
&& event->eventType == EVENTTYPE_MESSAGE && HIWORD(dat->lastEventType) == EVENTTYPE_MESSAGE
&& (isSameDate(event->time, dat->lastEventTime))
@@ -717,30 +706,26 @@ static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *event, st }
showColon = 1;
}
- if ((!(gdat->flags&SMF_HIDENAMES) && event->eventType == EVENTTYPE_MESSAGE && isGroupBreak) || event->eventType == EVENTTYPE_STATUSCHANGE || event->eventType == EVENTTYPE_JABBER_CHATSTATES || event->eventType == EVENTTYPE_JABBER_PRESENCE || (heFlags != -1 && (heFlags & HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE))) {
+ if ((!(gdat->flags&SMF_HIDENAMES) && event->eventType == EVENTTYPE_MESSAGE && isGroupBreak) || event->eventType == EVENTTYPE_STATUSCHANGE || event->eventType == EVENTTYPE_JABBER_CHATSTATES || event->eventType == EVENTTYPE_JABBER_PRESENCE) {
if (event->eventType == EVENTTYPE_MESSAGE) {
- if (showColon) {
+ if (showColon)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, " %s ", SetToStyle(event->dwFlags & IEEDF_SENT ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME));
- } else {
+ else
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(event->dwFlags & IEEDF_SENT ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME));
- }
- } else {
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(MSGFONTID_NOTICE));
}
+ else AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(MSGFONTID_NOTICE));
- if (event->dwFlags & IEEDF_UNICODE_NICK) {
+ if (event->dwFlags & IEEDF_UNICODE_NICK)
AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNickW);
- } else {
+ else
AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNick);
- }
showColon = 1;
if (event->eventType == EVENTTYPE_MESSAGE && gdat->flags & SMF_GROUPMESSAGES) {
- if (gdat->flags & SMF_MARKFOLLOWUPS) {
+ if (gdat->flags & SMF_MARKFOLLOWUPS)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\par");
- } else {
+ else
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line");
- }
showColon = 0;
}
}
@@ -752,98 +737,61 @@ static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *event, st showColon = 1;
}
if (showColon && event->eventType == EVENTTYPE_MESSAGE) {
- if (event->dwFlags & IEEDF_RTL) {
+ if (event->dwFlags & IEEDF_RTL)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\~%s: ", SetToStyle(event->dwFlags & IEEDF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON));
- } else {
+ else
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s: ", SetToStyle(event->dwFlags & IEEDF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON));
- }
}
switch (event->eventType) {
- case EVENTTYPE_MESSAGE:
- if (gdat->flags & SMF_MSGONNEWLINE && showColon) {
+ case EVENTTYPE_MESSAGE:
+ if (gdat->flags & SMF_MSGONNEWLINE && showColon)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line");
- }
+
style = event->dwFlags & IEEDF_SENT ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG;
AppendWithCustomLinks(event, style, &buffer, &bufferEnd, &bufferAlloced);
- /*
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(event->dwFlags & IEEDF_SENT ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG));
- if (event->dwFlags & IEEDF_UNICODE_TEXT) {
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszTextW);
- } else {
- AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText);
- }
- */
break;
- case EVENTTYPE_JABBER_CHATSTATES:
- case EVENTTYPE_JABBER_PRESENCE:
- case EVENTTYPE_STATUSCHANGE:
- case EVENTTYPE_URL:
- case EVENTTYPE_FILE:
- {
- style = MSGFONTID_NOTICE;
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(style));
- if (event->eventType == EVENTTYPE_FILE) {
- if (event->dwFlags & IEEDF_SENT) {
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("File sent"));
- } else {
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("File received"));
- }
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(":"));
- } else if (event->eventType == EVENTTYPE_URL) {
- if (event->dwFlags & IEEDF_SENT) {
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("URL sent"));
- } else {
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("URL received"));
- }
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(":"));
- }
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(" "));
- if (event->dwFlags & IEEDF_UNICODE_TEXT) {
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszTextW);
- } else {
- AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText);
- }
- if (event->pszText2W != NULL) {
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(" ("));
- if (event->dwFlags & IEEDF_UNICODE_TEXT2) {
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText2W);
- } else {
- AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText2);
- }
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(")"));
- }
- break;
+ case EVENTTYPE_JABBER_CHATSTATES:
+ case EVENTTYPE_JABBER_PRESENCE:
+ case EVENTTYPE_STATUSCHANGE:
+ case EVENTTYPE_URL:
+ case EVENTTYPE_FILE:
+ style = MSGFONTID_NOTICE;
+ AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(style));
+ if (event->eventType == EVENTTYPE_FILE) {
+ if (event->dwFlags & IEEDF_SENT)
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("File sent"));
+ else
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("File received"));
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(":"));
}
- default:
- {
- char *rtfMessage;
-
- if (heFlags == -1)
- break;
-
- if (heFlags & HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE)
- AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(" "));
-
- style = MSGFONTID_NOTICE;
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(style));
+ else if (event->eventType == EVENTTYPE_URL) {
+ if (event->dwFlags & IEEDF_SENT)
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("URL sent"));
+ else
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateT("URL received"));
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(":"));
+ }
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(" "));
- rtfMessage = HistoryEvents_GetRichText(streamData->hDbEvent, NULL);
- if (rtfMessage != NULL) {
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, rtfMessage);
- } else if (event->dwFlags & IEEDF_UNICODE_TEXT) {
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszTextW);
- } else {
- AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText);
- }
- HistoryEvents_ReleaseText(rtfMessage);
+ if (event->dwFlags & IEEDF_UNICODE_TEXT)
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszTextW);
+ else
+ AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText);
- break;
+ if (event->pszText2W != NULL) {
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(" ("));
+ if (event->dwFlags & IEEDF_UNICODE_TEXT2)
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText2W);
+ else
+ AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszText2);
+ AppendTToBuffer(&buffer, &bufferEnd, &bufferAlloced, _T(")"));
}
+ break;
}
- if (dat->isMixed) {
+ if (dat->isMixed)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\par");
- }
+
dat->lastEventTime = event->time;
dat->lastEventType = MAKELONG(event->dwFlags, event->eventType);
return buffer;
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 7d6b358cac..ca9fce9268 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -262,12 +262,12 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) }
if (lf) {
wsprintfA(str, "%s%dSize", prefix, i);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, module, str, fontList[i].defSize);
+ lf->lfHeight = (char) db_get_b(NULL, module, str, fontList[i].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
wsprintfA(str, "%s%dSty", prefix, i);
- style = DBGetContactSettingByte(NULL, module, str, fontList[i].defStyle);
+ style = db_get_b(NULL, module, str, fontList[i].defStyle);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = 0;
@@ -284,7 +284,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) DBFreeVariant(&dbv);
}
wsprintfA(str, "%s%dSet", prefix, i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, module, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName));
+ lf->lfCharSet = db_get_b(NULL, module, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName));
}
}
@@ -366,24 +366,24 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam int limitLength;
int bChecked;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_USETABS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS));
- CheckDlgButton(hwndDlg, IDC_ALWAYSSHOWTABS, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB));
- CheckDlgButton(hwndDlg, IDC_TABSATBOTTOM, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM));
- CheckDlgButton(hwndDlg, IDC_SWITCHTOACTIVE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE));
- CheckDlgButton(hwndDlg, IDC_TABCLOSEBUTTON, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON));
- CheckDlgButton(hwndDlg, IDC_LIMITNAMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES));
+ CheckDlgButton(hwndDlg, IDC_USETABS, db_get_b(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS));
+ CheckDlgButton(hwndDlg, IDC_ALWAYSSHOWTABS, !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB));
+ CheckDlgButton(hwndDlg, IDC_TABSATBOTTOM, db_get_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM));
+ CheckDlgButton(hwndDlg, IDC_SWITCHTOACTIVE, db_get_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE));
+ CheckDlgButton(hwndDlg, IDC_TABCLOSEBUTTON, db_get_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON));
+ CheckDlgButton(hwndDlg, IDC_LIMITNAMES, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES));
limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
(int)SetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, limitLength >= SRMSGSET_LIMITNAMESLEN_MIN ? limitLength : SRMSGDEFSET_LIMITNAMESLEN, FALSE);
- CheckDlgButton(hwndDlg, IDC_LIMITTABS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS));
+ CheckDlgButton(hwndDlg, IDC_LIMITTABS, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS));
limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
SetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, limitLength >= 1 ? limitLength : 1, FALSE);
- CheckDlgButton(hwndDlg, IDC_LIMITCHATSTABS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS));
+ CheckDlgButton(hwndDlg, IDC_LIMITCHATSTABS, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS));
limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
SetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, limitLength >= 1 ? limitLength : 1, FALSE);
- CheckDlgButton(hwndDlg, IDC_SEPARATECHATSCONTAINERS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS));
+ CheckDlgButton(hwndDlg, IDC_SEPARATECHATSCONTAINERS, db_get_b(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS));
bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked );
@@ -456,23 +456,23 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam case PSN_APPLY:
{
int limitLength;
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
(limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE)) >= SRMSGSET_LIMITNAMESLEN_MIN ? GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) : SRMSGSET_LIMITNAMESLEN_MIN;
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) : 1;
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1;
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
ApplyChanges(8);
return TRUE;
@@ -493,11 +493,11 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar char str[10];
int bChecked;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSTATUSBAR, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR));
- CheckDlgButton(hwndDlg, IDC_SHOWTITLEBAR, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR));
- CheckDlgButton(hwndDlg, IDC_SHOWTOOLBAR, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE));
- CheckDlgButton(hwndDlg, IDC_SHOWINFOBAR, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR));
- CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY));
+ CheckDlgButton(hwndDlg, IDC_SHOWSTATUSBAR, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR));
+ CheckDlgButton(hwndDlg, IDC_SHOWTITLEBAR, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR));
+ CheckDlgButton(hwndDlg, IDC_SHOWTOOLBAR, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE));
+ CheckDlgButton(hwndDlg, IDC_SHOWINFOBAR, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR));
+ CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, db_get_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY));
SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETRANGE, FALSE, MAKELONG(0,255));
SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA));
SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_SETRANGE, FALSE, MAKELONG(0,255));
@@ -528,8 +528,8 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked);
}
- CheckDlgButton(hwndDlg, IDC_STATUSWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
- CheckDlgButton(hwndDlg, IDC_SHOWPROGRESS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS));
+ CheckDlgButton(hwndDlg, IDC_STATUSWIN, db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
+ CheckDlgButton(hwndDlg, IDC_SHOWPROGRESS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS));
CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags&SMF_AVATAR);
return TRUE;
}
@@ -575,19 +575,19 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar {
UINT lines;
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0));
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
lines = GetDlgItemInt(hwndDlg, IDC_INPUTLINES, NULL, FALSE);
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
@@ -614,22 +614,22 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, sizeof(statusValues) / sizeof(statusValues[0]),
DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
- CheckDlgButton(hwndDlg, IDC_AUTOPOPUP, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP));
- CheckDlgButton(hwndDlg, IDC_STAYMINIMIZED, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED));
- CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN));
- CheckDlgButton(hwndDlg, IDC_SAVEDRAFTS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS));
+ CheckDlgButton(hwndDlg, IDC_AUTOPOPUP, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP));
+ CheckDlgButton(hwndDlg, IDC_STAYMINIMIZED, db_get_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED));
+ CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN));
+ CheckDlgButton(hwndDlg, IDC_SAVEDRAFTS, db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS));
- CheckDlgButton(hwndDlg, IDC_DELTEMP, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP));
+ CheckDlgButton(hwndDlg, IDC_DELTEMP, db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP));
msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
SetDlgItemInt(hwndDlg, IDC_SECONDS, msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout / 1000 : SRMSGDEFSET_MSGTIMEOUT / 1000, FALSE);
- CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
- CheckDlgButton(hwndDlg, IDC_CASCADE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE));
- CheckDlgButton(hwndDlg, IDC_SENDONENTER, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER));
- CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER));
- CheckDlgButton(hwndDlg, IDC_STATUSWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
+ CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
+ CheckDlgButton(hwndDlg, IDC_CASCADE, db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE));
+ CheckDlgButton(hwndDlg, IDC_SENDONENTER, db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER));
+ CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER));
+ CheckDlgButton(hwndDlg, IDC_STATUSWIN, db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
- CheckDlgButton(hwndDlg, IDC_HIDECONTAINERS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS));
+ CheckDlgButton(hwndDlg, IDC_HIDECONTAINERS, db_get_b(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS));
EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
@@ -693,21 +693,21 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
DWORD msgTimeout;
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT;
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
ApplyChanges(2);
@@ -753,7 +753,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_LOG));
- switch (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
+ switch (db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
case LOADHISTORY_UNREAD:
CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
break;
@@ -775,37 +775,37 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0));
SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME));
- CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS));
- CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES));
- CheckDlgButton(hwndDlg, IDC_SHOWTIMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME));
- CheckDlgButton(hwndDlg, IDC_SHOWSECONDS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS));
+ CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS));
+ CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES));
+ CheckDlgButton(hwndDlg, IDC_SHOWTIMES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME));
+ CheckDlgButton(hwndDlg, IDC_SHOWSECONDS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS));
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECONDS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- CheckDlgButton(hwndDlg, IDC_SHOWDATES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE));
- CheckDlgButton(hwndDlg, IDC_USELONGDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE));
- CheckDlgButton(hwndDlg, IDC_USERELATIVEDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE));
+ CheckDlgButton(hwndDlg, IDC_SHOWDATES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE));
+ CheckDlgButton(hwndDlg, IDC_USELONGDATE, db_get_b(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE));
+ CheckDlgButton(hwndDlg, IDC_USERELATIVEDATE, db_get_b(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE));
EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
if (!g_dat.ieviewInstalled) {
EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE);
}
- CheckDlgButton(hwndDlg, IDC_USEIEVIEW, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
+ CheckDlgButton(hwndDlg, IDC_USEIEVIEW, db_get_b(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
- CheckDlgButton(hwndDlg, IDC_GROUPMESSAGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES));
+ CheckDlgButton(hwndDlg, IDC_GROUPMESSAGES, db_get_b(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES));
EnableWindow(GetDlgItem(hwndDlg, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
- CheckDlgButton(hwndDlg, IDC_MARKFOLLOWUPS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS));
- CheckDlgButton(hwndDlg, IDC_MESSAGEONNEWLINE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE));
- CheckDlgButton(hwndDlg, IDC_DRAWLINES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES));
+ CheckDlgButton(hwndDlg, IDC_MARKFOLLOWUPS, db_get_b(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS));
+ CheckDlgButton(hwndDlg, IDC_MESSAGEONNEWLINE, db_get_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE));
+ CheckDlgButton(hwndDlg, IDC_DRAWLINES, db_get_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES));
EnableWindow(GetDlgItem(hwndDlg, IDC_LINECOLOUR), IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
- CheckDlgButton(hwndDlg, IDC_INDENTTEXT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT));
+ CheckDlgButton(hwndDlg, IDC_INDENTTEXT, db_get_b(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT));
EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSIZE), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSPIN), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE));
- CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH));
+ CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH));
SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR));
{
@@ -893,29 +893,29 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
else
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
+ db_set_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USELONGDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USEIEVIEW));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, (WORD) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USEIEVIEW));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
+ db_set_w(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, (WORD) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
FreeMsgLogIcons();
LoadMsgLogIcons();
@@ -933,7 +933,7 @@ static void ResetCList(HWND hwndDlg) {
int i;
- if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
+ if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0);
else
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) TRUE, 0);
@@ -950,18 +950,18 @@ static void ResetCList(HWND hwndDlg) static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
{
HANDLE hContact, hItem;
- BYTE defType = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW);
+ BYTE defType = db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW);
if (hItemNew && defType) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemNew, 1);
}
- if (hItemUnknown && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) {
+ if (hItemUnknown && db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
}
hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
- if (hItem && DBGetContactSettingByte(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) {
+ if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
} while ((hContact = db_find_next(hContact)));
@@ -972,16 +972,16 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) HANDLE hContact, hItem;
if (hItemNew) {
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemNew, 0) ? 1 : 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemNew, 0) ? 1 : 0));
}
if (hItemUnknown) {
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
}
hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem) {
- DBWriteContactSettingByte(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
+ db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
}
} while ((hContact = db_find_next(hContact)));
}
@@ -1005,12 +1005,12 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN) | (CLS_NOHIDEOFFLINE));
ResetCList(hwndDlg);
RebuildList(hwndDlg, hItemNew, hItemUnknown);
- CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING));
- CheckDlgButton(hwndDlg, IDC_TYPEWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN));
- CheckDlgButton(hwndDlg, IDC_TYPETRAY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN));
- CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST));
- CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST));
- CheckDlgButton(hwndDlg, IDC_TYPINGSWITCH, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH));
+ CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING));
+ CheckDlgButton(hwndDlg, IDC_TYPEWIN, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN));
+ CheckDlgButton(hwndDlg, IDC_TYPETRAY, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN));
+ CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST));
+ CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, !db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST));
+ CheckDlgButton(hwndDlg, IDC_TYPINGSWITCH, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH));
EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
@@ -1071,11 +1071,11 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam case PSN_APPLY:
{
SaveList(hwndDlg, hItemNew, hItemUnknown);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPINGSWITCH));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPINGSWITCH));
ReloadGlobals();
WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 88a8f458b3..fe1a050430 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -379,7 +379,7 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { if ( szProto ) {
// leave this menu item hidden for chats
- if ( !DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 ))
+ if ( !db_get_b( hContact, szProto, "ChatRoom", 0 ))
if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND )
clmi.flags &= ~CMIF_HIDDEN;
}
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 0edc1b0447..c8f32696a2 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -469,12 +469,12 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
HMENU hMenu;
HANDLE hSContact;
- int savePerContact = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
+ int savePerContact = db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
NewMessageWindowLParam *newData = (NewMessageWindowLParam *) lParam;
dat = (ParentWindowData *) mir_alloc(sizeof(ParentWindowData));
dat->hContact = newData->hContact;
dat->nFlash = 0;
- dat->nFlashMax = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
+ dat->nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
dat->childrenCount = 0;
dat->hwnd = hwndDlg;
dat->mouseLBDown = 0;
@@ -509,11 +509,11 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetContainerWindowStyle(dat);
hSContact = savePerContact ? dat->hContact : NULL;
- dat->bTopmost = DBGetContactSettingByte(hSContact, SRMMMOD, SRMSGSET_TOPMOST, SRMSGDEFSET_TOPMOST);
+ dat->bTopmost = db_get_b(hSContact, SRMMMOD, SRMSGSET_TOPMOST, SRMSGDEFSET_TOPMOST);
if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMMMOD, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE))
SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
- if (!savePerContact && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
+ if (!savePerContact && db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM) &dat->windowWasCascaded);
hMenu = GetSystemMenu( hwndDlg, FALSE );
@@ -859,7 +859,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
WindowList_Remove(g_dat.hParentWindowList, hwndDlg);
- int savePerContact = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
+ int savePerContact = db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
HANDLE hContact = (savePerContact) ? dat->hContact : NULL;
WINDOWPLACEMENT wp = { sizeof(wp) };
@@ -876,7 +876,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
wsprintfA(szSettingName,"%sheight",szNamePrefix);
DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
- DBWriteContactSettingByte(hContact, SRMMMOD, SRMSGSET_TOPMOST, (BYTE)dat->bTopmost);
+ db_set_b(hContact, SRMMMOD, SRMSGSET_TOPMOST, (BYTE)dat->bTopmost);
if (g_dat.lastParent == dat)
g_dat.lastParent = dat->prev;
diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index 3c828b4a43..b283bb22f8 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -156,7 +156,7 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) { char buff[256];
HWND hwnd;
sprintf(buff, "SRMMStatusIconFlags%d", (int)sid->dwId);
- DBWriteContactSettingByte(hContact, sid->szModule, buff, (BYTE)sid->flags);
+ db_set_b(hContact, sid->szModule, buff, (BYTE)sid->flags);
hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
if (hwnd == NULL) {
hwnd = SM_FindWindowByContact(hContact);
@@ -182,7 +182,7 @@ void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) { int x = r.left;
while(current) {
sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
- flags = DBGetContactSettingByte(hContact, current->sid.szModule, buff, current->sid.flags);
+ flags = db_get_b(hContact, current->sid.szModule, buff, current->sid.flags);
if (!(flags & MBF_HIDDEN)) {
if ((flags & MBF_DISABLED) && current->sid.hIconDisabled) hIcon = current->sid.hIconDisabled;
else hIcon = current->sid.hIcon;
@@ -205,7 +205,7 @@ void CheckStatusIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT r, int while(current) {
sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
- flags = DBGetContactSettingByte(hContact, current->sid.szModule, buff, current->sid.flags);
+ flags = db_get_b(hContact, current->sid.szModule, buff, current->sid.flags);
if (!(flags & MBF_HIDDEN)) iconNum--;
if (iconNum == 0) break;
current = current->next;
@@ -247,7 +247,7 @@ INT_PTR GetStatusIconsCount(HANDLE hContact) { struct StatusIconListNode *current = status_icon_list;
while(current) {
sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
- flags = DBGetContactSettingByte(hContact, current->sid.szModule, buff, current->sid.flags);
+ flags = db_get_b(hContact, current->sid.szModule, buff, current->sid.flags);
if (!(flags & MBF_HIDDEN)) {
count ++;
}
diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index ab646524f8..be9094e797 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -96,7 +96,6 @@ #include <m_msg_buttonsbar.h>
#include <m_flash.h>
#include <m_mathmodule.h>
-#include <m_historyevents.h>
#include <m_smileyadd.h>
#define TSAPI __stdcall
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 1e243e18f8..dddc88f579 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -856,17 +856,11 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro int tabSRMM_ShowPopup(WPARAM wParam, LPARAM lParam, WORD eventType, int windowOpen, struct TContainerData *pContainer, HWND hwndChild, const char *szProto, struct TWindowData *dat)
{
- int heFlags;
-
- if (nen_options.iDisable) // no popups at all. Period
+ if (nen_options.iDisable) // no popups at all. Period
return 0;
PU_CleanUp();
- heFlags = HistoryEvents_GetFlags(eventType);
- if (heFlags != -1 && !(heFlags & HISTORYEVENTS_FLAG_DEFAULT)) // Filter history events popups
- return 0;
-
if (nen_options.bDisableNonMessage && eventType != EVENTTYPE_MESSAGE)
return 0;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 172e758b0a..62fecfa428 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1713,12 +1713,6 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam) BOOL fIsStatusChangeEvent = IsStatusEvent(dbei.eventType);
BOOL fIsNotifyEvent = (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE);
- if (!fIsStatusChangeEvent) {
- int heFlags = HistoryEvents_GetFlags(dbei.eventType);
- if (heFlags != -1 && !(heFlags & HISTORYEVENTS_FLAG_DEFAULT) && !(heFlags & HISTORYEVENTS_FLAG_FLASH_MSG_WINDOW))
- fIsStatusChangeEvent = TRUE;
- }
-
if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ))
return;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index fabeb63f2a..4f6ea16c47 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -548,18 +548,12 @@ int TSAPI DbEventIsShown(struct TWindowData *dat, DBEVENTINFO * dbei) switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
return 1;
+
case EVENTTYPE_FILE:
return(dat->dwFlagsEx & MWF_SHOW_FILEEVENTS);
}
- if (IsStatusEvent(dbei->eventType))
- return 1;
-
- int heFlags = HistoryEvents_GetFlags(dbei->eventType);
- if (heFlags != -1)
- return (heFlags & HISTORYEVENTS_FLAG_SHOW_IM_SRMM) == HISTORYEVENTS_FLAG_SHOW_IM_SRMM;
-
- return 0;
+ return IsStatusEvent(dbei->eventType);
}
static int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
@@ -572,9 +566,9 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont {
char *buffer, c;
TCHAR ci, cc;
- TCHAR *szFinalTimestamp;
- int bufferAlloced, bufferEnd;
- size_t iTemplateLen, i = 0;
+ TCHAR *szFinalTimestamp;
+ int bufferAlloced, bufferEnd;
+ size_t iTemplateLen, i = 0;
DBEVENTINFO dbei = { 0 };
int isSent = 0;
int iFontIDOffset = 0;
@@ -588,7 +582,6 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont DWORD dwFormattingParams = MAKELONG(PluginConfig.m_FormatWholeWordsOnly, 0);
BOOL fIsStatusChangeEvent = FALSE;
TCHAR *msg, *formatted = NULL;
- int heFlags = -1;
char *rtfMessage = NULL;
bufferEnd = 0;
@@ -617,13 +610,6 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & (DBEF_SENT | DBEF_READ)))
dat->cache->updateStats(TSessionStats::SET_LAST_RCV, lstrlenA((char *) dbei.pBlob));
- if (dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != EVENTTYPE_FILE && !IsStatusEvent(dbei.eventType))
- heFlags = HistoryEvents_GetFlags(dbei.eventType);
- if (heFlags & HISTORYEVENTS_FLAG_DEFAULT)
- heFlags = -1;
-
- if (heFlags != -1)
- rtfMessage = HistoryEvents_GetRichText(hDbEvent, &dbei);
if (rtfMessage == NULL) {
msg = DbGetEventTextT(&dbei, dat->codePage);
if (!msg) {
@@ -636,7 +622,7 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont mir_free(msg);
}
- fIsStatusChangeEvent = (heFlags != -1 || IsStatusEvent(dbei.eventType));
+ fIsStatusChangeEvent = IsStatusEvent(dbei.eventType);
if (dat->isAutoRTL & 2) { // means: last \\par was deleted to avoid new line at end of log
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\par");
@@ -973,10 +959,7 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont case 'l': // soft line break
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line");
break;
- case 'N': { // nickname
- if (heFlags != -1 && !(heFlags & HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE))
- break;
-
+ case 'N': // nickname
if (!skipFont)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYNAME + iFontIDOffset : MSGFONTID_YOURNAME + iFontIDOffset));
if (isSent)
@@ -984,7 +967,6 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont else
AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, szYourName, MAKELONG(isSent, dat->isHistory));
break;
- }
case 'U': // UIN
if (!skipFont)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYNAME + iFontIDOffset : MSGFONTID_YOURNAME + iFontIDOffset));
@@ -997,7 +979,7 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(MSGFONTID_ERROR));
AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, (wchar_t *)dbei.szModule, MAKELONG(isSent, dat->isHistory));
break;
- case 'M': { // message
+ case 'M': // message
if (fIsStatusChangeEvent)
dbei.eventType = EVENTTYPE_STATUSCHANGE;
switch (dbei.eventType) {
@@ -1051,7 +1033,6 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont break;
}
break;
- }
case '*': // bold
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, isBold ? "\\b0 " : "\\b ");
isBold = !isBold;
@@ -1169,7 +1150,6 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont if (streamData->dbei == 0)
free(dbei.pBlob);
- HistoryEvents_ReleaseText(rtfMessage);
dat->iLastEventType = MAKELONG((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)), dbei.eventType);
dat->lastEventTime = dbei.timestamp;
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index eca9aea2ff..e1af8a6f83 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "oauth.dev.h"
#include "m_folders.h"
-#include "m_historyevents.h"
#include <algorithm>
#include <cstdio>
@@ -382,31 +381,12 @@ int TwitterProto::OnModulesLoaded(WPARAM,LPARAM) gcr.iMaxText = 159;
CallService(MS_GC_REGISTER,0,reinterpret_cast<LPARAM>(&gcr));
- if (ServiceExists(MS_HISTORYEVENTS_REGISTER))
- {
- HISTORY_EVENT_HANDLER heh = {0};
- heh.cbSize = sizeof(heh);
- heh.module = m_szModuleName;
- heh.name = "tweet";
- heh.description = "Tweet";
- heh.eventType = TWITTER_DB_EVENT_TYPE_TWEET;
- heh.defaultIconName = "Twitter_tweet";
- heh.flags = HISTORYEVENTS_FLAG_SHOW_IM_SRMM
- | HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE
-// Not sure: | HISTORYEVENTS_FLAG_FLASH_MSG_WINDOW
- | HISTORYEVENTS_REGISTERED_IN_ICOLIB;
- CallService(MS_HISTORYEVENTS_REGISTER, (WPARAM) &heh, 0);
- }
- else
- {
- DBEVENTTYPEDESCR evt = {sizeof(evt)};
- evt.eventType = TWITTER_DB_EVENT_TYPE_TWEET;
- evt.module = m_szModuleName;
- evt.descr = "Tweet";
- evt.flags = DETF_HISTORY | DETF_MSGWINDOW;
- CallService(MS_DB_EVENT_REGISTERTYPE,0,reinterpret_cast<LPARAM>(&evt));
- }
-
+ DBEVENTTYPEDESCR evt = {sizeof(evt)};
+ evt.eventType = TWITTER_DB_EVENT_TYPE_TWEET;
+ evt.module = m_szModuleName;
+ evt.descr = "Tweet";
+ evt.flags = DETF_HISTORY | DETF_MSGWINDOW;
+ CallService(MS_DB_EVENT_REGISTERTYPE,0,reinterpret_cast<LPARAM>(&evt));
return 0;
}
|