summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2013-01-19 10:41:08 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2013-01-19 10:41:08 +0000
commit26dd9032eec48f0ee9b80baeaecc5d7d0a520e79 (patch)
tree33cb43b26c52fea8620808f34da7b9c82b7f9348 /plugins
parent056715f5ecf44358d9a565a440a1af5a77bb802f (diff)
- Boltun: revert to rev.[3155]
git-svn-id: http://svn.miranda-ng.org/main/trunk@3162 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Boltun/res/Boltun.rc4
-rw-r--r--plugins/Boltun/src/actionQueue.cpp9
-rw-r--r--plugins/Boltun/src/boltun.cpp45
-rw-r--r--plugins/Boltun/src/boltun.h25
-rw-r--r--plugins/Boltun/src/config.cpp10
5 files changed, 47 insertions, 46 deletions
diff --git a/plugins/Boltun/res/Boltun.rc b/plugins/Boltun/res/Boltun.rc
index 0d71ebdeec..16158b3375 100644
--- a/plugins/Boltun/res/Boltun.rc
+++ b/plugins/Boltun/res/Boltun.rc
@@ -71,7 +71,7 @@ END
IDD_MAIN DIALOGEX 0, 0, 307, 231
STYLE DS_SETFONT | WS_CHILD | WS_BORDER
EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
+FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "Boltun",IDC_PLUGINRM,5,2,297,222
CONTROL "Boltun Autochat everybody",IDC_EVERYBODY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,20,230,10
@@ -99,7 +99,7 @@ END
IDD_ENGINE DIALOGEX 0, 0, 307, 231
STYLE DS_SETFONT | WS_CHILD | WS_BORDER
EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
+FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "Engine",IDC_PLUGINRM,5,48,297,174
EDITTEXT IDC_MINDFILE,12,19,210,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp
index 4da1b56178..d0ba9adae8 100644
--- a/plugins/Boltun/src/actionQueue.cpp
+++ b/plugins/Boltun/src/actionQueue.cpp
@@ -87,9 +87,9 @@ void UpdateTimer()
static bool NotifyTyping(HANDLE hContact)
{
- int res = db_get_b(hContact, "SRMsg", "SupportTyping", 2);
+ int res = DBGetContactSettingByte(hContact, "SRMsg", "SupportTyping", 2);
if (res == 2)
- res = db_get_b(NULL, "SRMsg", "DefaultTyping", 1);
+ res = DBGetContactSettingByte(NULL, "SRMsg", "DefaultTyping", 1);
return res != 0;
}
@@ -238,10 +238,11 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f
void AnswerToContact(HANDLE hContact, const TCHAR* messageToAnswer)
{
- if (Config.TalkWarnContacts && db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE) == FALSE)
+ if (Config.TalkWarnContacts && DBGetContactSettingByte(hContact, BOLTUN_KEY,
+ DB_CONTACT_WARNED, FALSE) == FALSE)
{
DoAnswer(hContact, new TalkBot::MessageInfo((const TCHAR*)Config.WarnText), true);
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, TRUE);
+ DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, TRUE);
}
else
DoAnswer(hContact, bot->Reply(hContact, messageToAnswer, false));
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index 2248b79d16..42149db57a 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -213,7 +213,7 @@ static bool LoadMind(const TCHAR* filename, int &line)
static bool BoltunAutoChat(HANDLE hContact)
{
- if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT
+ if (DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT
, FALSE) == TRUE)
return false;
@@ -232,11 +232,11 @@ static bool BoltunAutoChat(HANDLE hContact)
return true;
}
- if ((db_get_b(hContact,"CList","NotOnList",0) == 1) &&
+ if ((DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1) &&
Config.TalkWithNotInList)
return true;
- if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT,
+ if (DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT,
FALSE) == TRUE)
return true;
@@ -366,7 +366,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
if(bTranslated)
Config.WarnText = c;
else
- Config.WarnText = DEFAULT_WARN_TEXT;
+ Config.WarnText = TranslateTS(DEFAULT_WARN_TEXT);
}
return TRUE;
}
@@ -424,8 +424,8 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = GetParent(hwndDlg);
- TCHAR* mind = MIND_FILE_DESC;
- TCHAR* anyfile = ALL_FILES_DESC;
+ TCHAR* mind = TranslateTS(MIND_FILE_DESC);
+ TCHAR* anyfile = TranslateTS(ALL_FILES_DESC);
size_t l = _tcslen(MIND_DIALOG_FILTER)
+ _tcslen(mind) + _tcslen(anyfile);
TCHAR *filt = new TCHAR[l];
@@ -470,8 +470,8 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (!bTranslated)
{
TCHAR* message = new TCHAR[5000];
- wsprintf(message, FAILED_TO_LOAD_BASE, line, c);
- MessageBox(NULL, message, BOLTUN_ERROR, MB_ICONERROR|MB_TASKMODAL|MB_OK);
+ wsprintf(message, TranslateTS(FAILED_TO_LOAD_BASE), line, c);
+ MessageBox(NULL, message, TranslateTS(BOLTUN_ERROR), MB_ICONERROR|MB_TASKMODAL|MB_OK);
delete[] message;
}
break;
@@ -522,7 +522,7 @@ static int MessageOptInit(WPARAM wParam, LPARAM lParam)
odp.position = 910000000;
odp.hInstance = hInst;
odp.pszGroup = BOLTUN_GROUP;
- odp.pszTitle = BOLTUN_NAME_OPT;
+ odp.pszTitle = BOLTUN_NAME;
odp.pfnDlgProc = MainDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN);
odp.pszTab = TAB_GENERAL;
@@ -538,8 +538,8 @@ static int ContactClick(WPARAM wParam, LPARAM lParam, BOOL clickNotToChat)
{
HANDLE hContact = (HANDLE)wParam;
- BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
- BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
+ BOOL boltunautochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
+ BOOL boltunnottochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
if (clickNotToChat)
{
@@ -558,12 +558,12 @@ static int ContactClick(WPARAM wParam, LPARAM lParam, BOOL clickNotToChat)
}
else
{
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE);
+ DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE);
}
}
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, (BYTE)boltunautochat);
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, (BYTE)boltunnottochat);
+ DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, (BYTE)boltunautochat);
+ DBWriteContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, (BYTE)boltunnottochat);
return 0;
}
@@ -590,7 +590,7 @@ static int MessagePrebuild(WPARAM wParam, LPARAM lParam)
CLISTMENUITEM clmi = { sizeof(clmi) };
HANDLE hContact = (HANDLE)wParam;
- if (!blInit || (db_get_b(hContact,"CList","NotOnList",0) == 1))
+ if (!blInit || (DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1))
{
clmi.flags = CMIM_FLAGS | CMIF_GRAYED;
@@ -599,8 +599,8 @@ static int MessagePrebuild(WPARAM wParam, LPARAM lParam)
}
else
{
- BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
- BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
+ BOOL boltunautochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
+ BOOL boltunnottochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
clmi.flags = CMIM_FLAGS | CMIM_ICON | (boltunautochat ? CMIF_CHECKED : 0);
clmi.hIcon = LoadIcon( GetModuleHandle(NULL), MAKEINTRESOURCE((boltunautochat ? IDI_TICK : IDI_NOTICK)));
@@ -671,10 +671,11 @@ extern "C" int __declspec(dllexport) Load(void)
if (!blInit)
{
TCHAR path[2000];
- wsprintf(path, FAILED_TO_LOAD_BASE, line, (const TCHAR*)Config.MindFileName);
- MessageBox(NULL, path, BOLTUN_ERROR, MB_ICONERROR|MB_TASKMODAL|MB_OK);
+ wsprintf(path, TranslateTS(FAILED_TO_LOAD_BASE), line, (const TCHAR*)Config.MindFileName);
+ MessageBox(NULL, path, TranslateTS(BOLTUN_ERROR), MB_ICONERROR|MB_TASKMODAL|MB_OK);
}
-
+ /*record for Uninstall plugin*/
+ DBWriteContactSettingString(NULL, "Uninstall", BOLTUN_NAME, BOLTUN_KEY);
return 0;
}
@@ -692,8 +693,8 @@ extern "C" int __declspec(dllexport) Unload(void)
//So in case of saving error we will remain silent
#if 0
TCHAR path[MAX_PATH];
- wsprintf(path, FAILED_TO_SAVE_BASE, (const TCHAR*)Config.MindFileName);
- TCHAR* err = BOLTUN_ERROR;
+ wsprintf(path, TranslateTS(FAILED_TO_SAVE_BASE), (const TCHAR*)Config.MindFileName);
+ TCHAR* err = TranslateTS(BOLTUN_ERROR);
MessageBox(NULL, path, err, MB_ICONERROR|MB_TASKMODAL|MB_OK);*/
#endif
}
diff --git a/plugins/Boltun/src/boltun.h b/plugins/Boltun/src/boltun.h
index 6dec88f73a..dc0cdcdb22 100644
--- a/plugins/Boltun/src/boltun.h
+++ b/plugins/Boltun/src/boltun.h
@@ -38,7 +38,7 @@
#define DB_CONTACT_WARNED "Warned"
//Plugin group in settings
-#define BOLTUN_GROUP LPGEN("Message sessions")
+#define BOLTUN_GROUP "Message sessions"
//Filename depends on UNICODE
#define DEFAULT_MIND_FILE _T("boltun.mindw")
@@ -49,25 +49,24 @@
//Plugin name
#define BOLTUN_NAME "Boltun"
-#define BOLTUN_NAME_OPT LPGEN("Boltun")
-#define MIND_FILE_DESC TranslateT("Mind Files")
-#define ALL_FILES_DESC TranslateT("All Files")
+#define MIND_FILE_DESC _T("Mind Files")
+#define ALL_FILES_DESC _T("All Files")
//UI strings
-#define BOLTUN_AUTO_CHAT LPGEN("Boltun/Auto Chat")
-#define BOLTUN_NOT_TO_CHAT LPGEN("Boltun/Not to Chat")
-#define BOLTUN_START_CHATTING LPGEN("Boltun/Start Chatting")
+#define BOLTUN_AUTO_CHAT "Boltun/Auto Chat"
+#define BOLTUN_NOT_TO_CHAT "Boltun/Not to Chat"
+#define BOLTUN_START_CHATTING "Boltun/Start Chatting"
-#define DEFAULT_WARN_TEXT TranslateT("Hello. I'm Boltun! I'll talk to you, while my owner is away. Please write without mistakes!")
+#define DEFAULT_WARN_TEXT _T("Hello. I'm Boltun! I'll talk to you, while my owner is away. Please write without mistakes!")
// Error messages
-#define BOLTUN_ERROR TranslateT("Boltun Error")
-#define FAILED_TO_LOAD_BASE TranslateT("Failed to load base of remarks. Error at line %d of %s. (Or few lines before).")
-#define FAILED_TO_SAVE_BASE TranslateT("Failed to save base of remarks to %s")
+#define BOLTUN_ERROR _T("Boltun Error")
+#define FAILED_TO_LOAD_BASE _T("Failed to load base of remarks. Error at line %d of %s. (Or few lines before).")
+#define FAILED_TO_SAVE_BASE _T("Failed to save base of remarks to %s")
//Settings tab names
-#define TAB_GENERAL LPGEN("General Settings")
-#define TAB_ENGINE LPGEN("Engine Settings")
+#define TAB_GENERAL "General Settings"
+#define TAB_ENGINE "Engine Settings"
#endif /*_BOLTUN_H*/
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp
index 2ecce4326e..4a88bf2df3 100644
--- a/plugins/Boltun/src/config.cpp
+++ b/plugins/Boltun/src/config.cpp
@@ -49,7 +49,7 @@ inline TCHAR* GetString(char* key, const TCHAR* def)
{
DBVARIANT dbv;
TCHAR* val;
- if (!db_get_s(NULL, BOLTUN_KEY, key, &dbv))
+ if (!DBGetContactSettingTString(NULL, BOLTUN_KEY, key, &dbv))
{
size_t len = wcslen(dbv.ptszVal) + 1;
val = new TCHAR[len];
@@ -70,7 +70,7 @@ inline const TCHAR* SetString(char* key, const TCHAR* value)
size_t len = _tcslen(value) + 1;
TCHAR* val = new TCHAR[len];
_tcscpy_s(val, len, value);
- db_set_ws(NULL, BOLTUN_KEY, key, val);
+ DBWriteContactSettingTString(NULL, BOLTUN_KEY, key, val);
return val;
}
@@ -78,14 +78,14 @@ inline const TCHAR* SetString(char* key, const TCHAR* value)
const bool BoltunConfig::Get##x() { \
return DBGetContactSettingDword(NULL, BOLTUN_KEY, str, def) != 0; } \
const bool BoltunConfig::Set##x(const bool value) { \
- db_set_dw(NULL, BOLTUN_KEY, str, value); \
+ DBWriteContactSettingDword(NULL, BOLTUN_KEY, str, value); \
return value; }
#define BUILDINTETTERS(x, str, def) \
const int BoltunConfig::Get##x() { \
return DBGetContactSettingDword(NULL, BOLTUN_KEY, str, def); } \
const int BoltunConfig::Set##x(const int value) { \
- db_set_dw(NULL, BOLTUN_KEY, str, value); \
+ DBWriteContactSettingDword(NULL, BOLTUN_KEY, str, value); \
return value; }
#define BUILDSTRETTERS(x, str, def) \
@@ -106,7 +106,7 @@ BUILDINTETTERS(AnswerPauseTime, DB_WAIT_TIME, 2);
BUILDINTETTERS(AnswerThinkTime, DB_THINK_TIME, 4);
BUILDETTERS(PauseDepends, DB_PAUSE_DEPENDS, TRUE);
BUILDETTERS(PauseRandom, DB_PAUSE_RANDOM, TRUE);
-BUILDSTRETTERS(WarnText, DB_WARN_TEXT, DEFAULT_WARN_TEXT);
+BUILDSTRETTERS(WarnText, DB_WARN_TEXT, TranslateTS(DEFAULT_WARN_TEXT));
BUILDSTRETTERS(MindFileName, DB_MIND_FILE_NAME, DEFAULT_MIND_FILE);
BUILDETTERS(EngineStaySilent, DB_ENGINE_SILENT, FALSE);
BUILDETTERS(EngineMakeLowerCase, DB_ENGINE_LOWERCASE, FALSE);