summaryrefslogtreecommitdiff
path: root/plugins/IEView/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/IEView/src')
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.cpp6
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.h2
-rw-r--r--plugins/IEView/src/Options.cpp500
-rw-r--r--plugins/IEView/src/Options.h56
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.cpp8
-rw-r--r--plugins/IEView/src/TabSRMMHTMLBuilder.cpp23
-rw-r--r--plugins/IEView/src/Template.cpp18
-rw-r--r--plugins/IEView/src/Template.h12
-rw-r--r--plugins/IEView/src/TemplateHTMLBuilder.cpp31
-rw-r--r--plugins/IEView/src/version.h2
10 files changed, 335 insertions, 323 deletions
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp
index 66f17dad13..28d412e6a6 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.cpp
+++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp
@@ -134,7 +134,7 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA *lf, COL
}
}
-const char *HistoryHTMLBuilder::getTemplateFilename(ProtocolSettings *protoSettings)
+const wchar_t* HistoryHTMLBuilder::getTemplateFilename(ProtocolSettings *protoSettings)
{
return protoSettings->getHistoryTemplateFilename();
}
@@ -161,8 +161,8 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event)
CMStringA str;
if (protoSettings->getHistoryMode() == Options::MODE_CSS) {
- const char *externalCSS = protoSettings->getHistoryCssFilename();
- str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
+ auto *externalCSS = protoSettings->getHistoryCssFilename();
+ str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%S\"/></head><body class=\"body\">\n", externalCSS);
}
else {
str.Append("<html><head>");
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.h b/plugins/IEView/src/HistoryHTMLBuilder.h
index 83b3f0e4b7..59c624dc49 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.h
+++ b/plugins/IEView/src/HistoryHTMLBuilder.h
@@ -32,7 +32,7 @@ protected:
char *timestampToString(time_t check);
bool isDbEventShown(const DB::EventInfo &dbei);
void appendEventNonTemplate(IEView *, IEVIEWEVENT *event);
- const char *getTemplateFilename(ProtocolSettings *);
+ const wchar_t *getTemplateFilename(ProtocolSettings *);
int getFlags(ProtocolSettings *);
public:
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp
index 7938b5ed42..3bd6fad8cc 100644
--- a/plugins/IEView/src/Options.cpp
+++ b/plugins/IEView/src/Options.cpp
@@ -41,97 +41,106 @@ static LPARAM GetItemParam(HWND hwndTreeView, HTREEITEM hItem)
return tvi.lParam;
}
+static wchar_t* GetFilePathW(HWND hwndDlg, int iCtrlId, wchar_t *pDest)
+{
+ wchar_t tmp[MAX_PATH];
+ GetDlgItemTextW(hwndDlg, iCtrlId, tmp, _countof(tmp));
+ PathToAbsoluteW(tmp, pDest);
+ return pDest;
+}
+
+static void ShowFilePathW(HWND hwndDlg, int iCtrlId, const wchar_t *src)
+{
+ wchar_t tmp[MAX_PATH];
+ PathToRelativeW(src, tmp);
+ SetDlgItemTextW(hwndDlg, iCtrlId, tmp);
+}
+
static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != nullptr) {
- int i = Options::MODE_COMPATIBLE;
- if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
- i = Options::MODE_TEMPLATE;
- else if (IsDlgButtonChecked(hwndDlg, IDC_MODE_CSS))
- i = Options::MODE_CSS;
-
- proto->setSRMMMode(i);
- i = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_ENABLED : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_SCROLL : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES) ? Options::LOG_SHOW_NICKNAMES : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME) ? Options::LOG_SHOW_TIME : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE) ? Options::LOG_SHOW_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS) ? Options::LOG_SHOW_SECONDS : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE) ? Options::LOG_LONG_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
- proto->setSRMMFlags(i);
-
- char path[MAX_PATH];
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, _countof(path));
- proto->setSRMMBackgroundFilename(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, _countof(path));
- proto->setSRMMCssFilename(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, _countof(path));
- proto->setSRMMTemplateFilename(path);
- }
+ if (proto == nullptr)
+ return;
+
+ int i = Options::MODE_COMPATIBLE;
+ if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
+ i = Options::MODE_TEMPLATE;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_MODE_CSS))
+ i = Options::MODE_CSS;
+
+ proto->setSRMMMode(i);
+ i = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_ENABLED : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_SCROLL : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES) ? Options::LOG_SHOW_NICKNAMES : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME) ? Options::LOG_SHOW_TIME : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE) ? Options::LOG_SHOW_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS) ? Options::LOG_SHOW_SECONDS : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE) ? Options::LOG_LONG_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
+ proto->setSRMMFlags(i);
+
+ wchar_t path[MAX_PATH];
+ proto->setSRMMBackgroundFilename(GetFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path));
+ proto->setSRMMCssFilename(GetFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, path));
+ proto->setSRMMTemplateFilename(GetFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, path));
}
static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != nullptr) {
- int i = Options::MODE_COMPATIBLE;
- if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
- i = Options::MODE_TEMPLATE;
- else if (IsDlgButtonChecked(hwndDlg, IDC_MODE_CSS))
- i = Options::MODE_CSS;
-
- proto->setChatMode(i);
- i = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_ENABLED : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_SCROLL : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES) ? Options::LOG_SHOW_NICKNAMES : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME) ? Options::LOG_SHOW_TIME : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE) ? Options::LOG_SHOW_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS) ? Options::LOG_SHOW_SECONDS : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE) ? Options::LOG_LONG_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
- proto->setChatFlags(i);
-
- char path[MAX_PATH];
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, _countof(path));
- proto->setChatBackgroundFilename(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, _countof(path));
- proto->setChatCssFilename(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, _countof(path));
- proto->setChatTemplateFilename(path);
- }
+ if (proto == nullptr)
+ return;
+
+ int i = Options::MODE_COMPATIBLE;
+ if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
+ i = Options::MODE_TEMPLATE;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_MODE_CSS))
+ i = Options::MODE_CSS;
+
+ proto->setChatMode(i);
+ i = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_ENABLED : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_SCROLL : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES) ? Options::LOG_SHOW_NICKNAMES : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME) ? Options::LOG_SHOW_TIME : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE) ? Options::LOG_SHOW_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS) ? Options::LOG_SHOW_SECONDS : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE) ? Options::LOG_LONG_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
+ proto->setChatFlags(i);
+
+ wchar_t path[MAX_PATH];
+ proto->setChatBackgroundFilename(GetFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path));
+ proto->setChatCssFilename(GetFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, path));
+ proto->setChatTemplateFilename(GetFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, path));
}
static void SaveHistoryProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != nullptr) {
- int i = Options::MODE_COMPATIBLE;
- if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
- i = Options::MODE_TEMPLATE;
- else if (IsDlgButtonChecked(hwndDlg, IDC_MODE_CSS))
- i = Options::MODE_CSS;
-
- proto->setHistoryMode(i);
- i = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_ENABLED : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_SCROLL : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES) ? Options::LOG_SHOW_NICKNAMES : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME) ? Options::LOG_SHOW_TIME : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE) ? Options::LOG_SHOW_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS) ? Options::LOG_SHOW_SECONDS : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE) ? Options::LOG_LONG_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
- i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
- proto->setHistoryFlags(i);
-
- char path[MAX_PATH];
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, _countof(path));
- proto->setHistoryBackgroundFilename(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, _countof(path));
- proto->setHistoryCssFilename(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, _countof(path));
- proto->setHistoryTemplateFilename(path);
- }
+ if (proto == nullptr)
+ return;
+
+ int i = Options::MODE_COMPATIBLE;
+ if (IsDlgButtonChecked(hwndDlg, IDC_MODE_TEMPLATE))
+ i = Options::MODE_TEMPLATE;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_MODE_CSS))
+ i = Options::MODE_CSS;
+
+ proto->setHistoryMode(i);
+ i = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_ENABLED : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE) ? Options::LOG_IMAGE_SCROLL : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES) ? Options::LOG_SHOW_NICKNAMES : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME) ? Options::LOG_SHOW_TIME : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE) ? Options::LOG_SHOW_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS) ? Options::LOG_SHOW_SECONDS : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE) ? Options::LOG_LONG_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
+ i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
+ proto->setHistoryFlags(i);
+
+ wchar_t path[MAX_PATH];
+ proto->setHistoryBackgroundFilename(GetFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path));
+ proto->setHistoryCssFilename(GetFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, path));
+ proto->setHistoryTemplateFilename(GetFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, path));
}
static void UpdateControlsState(HWND hwndDlg)
@@ -172,7 +181,7 @@ static void SetIcon(HWND hwnd, uint32_t id, int index, bool condition)
DestroyIcon(hIcon);
}
-static void UpdateTemplateIcons(HWND hwnd, const char *path)
+static void UpdateTemplateIcons(HWND hwnd, const wchar_t *path)
{
TemplateMap *tmap = TemplateMap::loadTemplates(path, path, true);
if (tmap != nullptr) {
@@ -188,86 +197,89 @@ static void UpdateTemplateIcons(HWND hwnd, const char *path)
static void UpdateSRMMProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != nullptr) {
- HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
- TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isSRMMEnable());
- CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getSRMMMode() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MODE_CSS, proto->getSRMMMode() == Options::MODE_CSS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MODE_COMPATIBLE, proto->getSRMMMode() == Options::MODE_COMPATIBLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, proto->getSRMMFlags() & Options::LOG_IMAGE_ENABLED ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, proto->getSRMMFlags() & Options::LOG_IMAGE_SCROLL ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, proto->getSRMMFlags() & Options::LOG_SHOW_NICKNAMES ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, proto->getSRMMFlags() & Options::LOG_SHOW_TIME ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, proto->getSRMMFlags() & Options::LOG_SHOW_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, proto->getSRMMFlags() & Options::LOG_SHOW_SECONDS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getSRMMFlags() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getSRMMFlags() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getSRMMFlags() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
-
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getSRMMBackgroundFilename());
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getSRMMCssFilename());
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getSRMMTemplateFilename());
-
- UpdateTemplateIcons(hwndDlg, proto->getSRMMTemplateFilename());
- srmmCurrentProtoItem = proto;
- UpdateControlsState(hwndDlg);
- }
+ if (proto == nullptr)
+ return;
+
+ HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
+ TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isSRMMEnable());
+ CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getSRMMMode() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MODE_CSS, proto->getSRMMMode() == Options::MODE_CSS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MODE_COMPATIBLE, proto->getSRMMMode() == Options::MODE_COMPATIBLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, proto->getSRMMFlags() & Options::LOG_IMAGE_ENABLED ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, proto->getSRMMFlags() & Options::LOG_IMAGE_SCROLL ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, proto->getSRMMFlags() & Options::LOG_SHOW_NICKNAMES ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, proto->getSRMMFlags() & Options::LOG_SHOW_TIME ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, proto->getSRMMFlags() & Options::LOG_SHOW_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, proto->getSRMMFlags() & Options::LOG_SHOW_SECONDS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getSRMMFlags() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getSRMMFlags() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getSRMMFlags() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
+
+ ShowFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getSRMMBackgroundFilename());
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getSRMMCssFilename());
+ ShowFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getSRMMTemplateFilename());
+
+ UpdateTemplateIcons(hwndDlg, proto->getSRMMTemplateFilename());
+ srmmCurrentProtoItem = proto;
+ UpdateControlsState(hwndDlg);
}
static void UpdateChatProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != nullptr) {
- HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
- TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isChatEnable());
- CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getChatMode() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MODE_CSS, proto->getChatMode() == Options::MODE_CSS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MODE_COMPATIBLE, proto->getChatMode() == Options::MODE_COMPATIBLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, proto->getChatFlags() & Options::LOG_IMAGE_ENABLED ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, proto->getChatFlags() & Options::LOG_IMAGE_SCROLL ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, proto->getChatFlags() & Options::LOG_SHOW_NICKNAMES ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, proto->getChatFlags() & Options::LOG_SHOW_TIME ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, proto->getChatFlags() & Options::LOG_SHOW_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, proto->getChatFlags() & Options::LOG_SHOW_SECONDS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getChatFlags() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getChatFlags() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getChatFlags() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
-
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getChatBackgroundFilename());
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getChatCssFilename());
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getChatTemplateFilename());
-
- UpdateTemplateIcons(hwndDlg, proto->getChatTemplateFilename());
- chatCurrentProtoItem = proto;
- UpdateControlsState(hwndDlg);
- }
+ if (proto == nullptr)
+ return;
+
+ HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
+ TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isChatEnable());
+ CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getChatMode() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MODE_CSS, proto->getChatMode() == Options::MODE_CSS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MODE_COMPATIBLE, proto->getChatMode() == Options::MODE_COMPATIBLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, proto->getChatFlags() & Options::LOG_IMAGE_ENABLED ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, proto->getChatFlags() & Options::LOG_IMAGE_SCROLL ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, proto->getChatFlags() & Options::LOG_SHOW_NICKNAMES ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, proto->getChatFlags() & Options::LOG_SHOW_TIME ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, proto->getChatFlags() & Options::LOG_SHOW_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, proto->getChatFlags() & Options::LOG_SHOW_SECONDS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getChatFlags() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getChatFlags() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getChatFlags() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
+
+ ShowFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getChatBackgroundFilename());
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getChatCssFilename());
+ ShowFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getChatTemplateFilename());
+
+ UpdateTemplateIcons(hwndDlg, proto->getChatTemplateFilename());
+ chatCurrentProtoItem = proto;
+ UpdateControlsState(hwndDlg);
}
static void UpdateHistoryProtoInfo(HWND hwndDlg, ProtocolSettings *proto)
{
- if (proto != nullptr) {
- HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
- TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isHistoryEnable());
- CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getHistoryMode() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MODE_CSS, proto->getHistoryMode() == Options::MODE_CSS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MODE_COMPATIBLE, proto->getHistoryMode() == Options::MODE_COMPATIBLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, proto->getHistoryFlags() & Options::LOG_IMAGE_ENABLED ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, proto->getHistoryFlags() & Options::LOG_IMAGE_SCROLL ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, proto->getHistoryFlags() & Options::LOG_SHOW_NICKNAMES ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, proto->getHistoryFlags() & Options::LOG_SHOW_TIME ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, proto->getHistoryFlags() & Options::LOG_SHOW_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, proto->getHistoryFlags() & Options::LOG_SHOW_SECONDS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getHistoryFlags() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getHistoryFlags() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getHistoryFlags() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
-
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getHistoryBackgroundFilename());
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getHistoryCssFilename());
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getHistoryTemplateFilename());
-
- UpdateTemplateIcons(hwndDlg, proto->getHistoryTemplateFilename());
- historyCurrentProtoItem = proto;
- UpdateControlsState(hwndDlg);
- }
+ if (proto == nullptr)
+ return;
+
+ HWND hProtoList = GetDlgItem(hwndDlg, IDC_PROTOLIST);
+ TreeView_SetCheckState(hProtoList, TreeView_GetSelection(hProtoList), proto->isHistoryEnable());
+ CheckDlgButton(hwndDlg, IDC_MODE_TEMPLATE, proto->getHistoryMode() == Options::MODE_TEMPLATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MODE_CSS, proto->getHistoryMode() == Options::MODE_CSS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MODE_COMPATIBLE, proto->getHistoryMode() == Options::MODE_COMPATIBLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, proto->getHistoryFlags() & Options::LOG_IMAGE_ENABLED ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, proto->getHistoryFlags() & Options::LOG_IMAGE_SCROLL ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, proto->getHistoryFlags() & Options::LOG_SHOW_NICKNAMES ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, proto->getHistoryFlags() & Options::LOG_SHOW_TIME ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, proto->getHistoryFlags() & Options::LOG_SHOW_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, proto->getHistoryFlags() & Options::LOG_SHOW_SECONDS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, proto->getHistoryFlags() & Options::LOG_LONG_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, proto->getHistoryFlags() & Options::LOG_RELATIVE_DATE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, proto->getHistoryFlags() & Options::LOG_GROUP_MESSAGES ? BST_CHECKED : BST_UNCHECKED);
+
+ ShowFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, proto->getHistoryBackgroundFilename());
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, proto->getHistoryCssFilename());
+ ShowFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, proto->getHistoryTemplateFilename());
+
+ UpdateTemplateIcons(hwndDlg, proto->getHistoryTemplateFilename());
+ historyCurrentProtoItem = proto;
+ UpdateControlsState(hwndDlg);
}
static void RefreshProtoIcons()
@@ -346,11 +358,11 @@ static void RefreshProtoList(HWND hwndDlg, int mode, bool protoTemplates)
TreeView_SelectItem(hProtoList, hItem);
}
-static bool BrowseFile(HWND hwndDlg, char *filter, char *defExt, char *path, int maxLen)
+static bool BrowseFile(HWND hwndDlg, wchar_t *filter, wchar_t *defExt, wchar_t *path, int maxLen)
{
- GetWindowTextA(hwndDlg, path, maxLen);
+ GetWindowTextW(hwndDlg, path, maxLen);
- OPENFILENAMEA ofn = {};
+ OPENFILENAME ofn = {};
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = filter;
@@ -359,8 +371,8 @@ static bool BrowseFile(HWND hwndDlg, char *filter, char *defExt, char *path, int
ofn.nMaxFile = maxLen;
ofn.nMaxFileTitle = maxLen;
ofn.lpstrDefExt = defExt;
- if (GetOpenFileNameA(&ofn)) {
- SetWindowTextA(hwndDlg, path);
+ if (GetOpenFileNameW(&ofn)) {
+ SetWindowTextW(hwndDlg, path);
return true;
}
return false;
@@ -494,7 +506,7 @@ static INT_PTR CALLBACK IEViewGeneralOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL bChecked;
- char path[MAX_PATH], filter[MAX_PATH];
+ wchar_t path[MAX_PATH], filter[MAX_PATH];
switch (msg) {
case WM_INITDIALOG:
@@ -535,31 +547,32 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
MarkChanges(2, hwndDlg);
break;
case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, "%s (*.ivt)%c*.ivt%c%s (*.*)%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.ivt)%c*.ivt%c%s (*.*)%c*.*%c%c", TranslateT("Template"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"ivt", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, path);
UpdateTemplateIcons(hwndDlg, path);
MarkChanges(2, hwndDlg);
}
break;
case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, "%s (*.jpg,*.jpeg,*.gif,*.png,*.bmp)%c*.jpg;*.jpeg;*.gif;*.png;*.bmp%c%s (*.*)%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.jpg,*.jpeg,*.gif,*.png,*.bmp)%c*.jpg;*.jpeg;*.gif;*.png;*.bmp%c%s (*.*)%c*.*%c%c",
+ TranslateT("All Images"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"jpg", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
MarkChanges(2, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", TranslateT("Style Sheet"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"css", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(2, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
+ mir_snwprintf(filter, L"%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"css", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
MarkChanges(2, hwndDlg);
}
break;
@@ -636,7 +649,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL bChecked = FALSE;
- char path[MAX_PATH], filter[MAX_PATH];
+ wchar_t path[MAX_PATH], filter[MAX_PATH];
switch (msg) {
case WM_INITDIALOG:
MarkInitialized(4);
@@ -676,31 +689,31 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
MarkChanges(4, hwndDlg);
break;
case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, "%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", TranslateT("Template"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"ivt", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, path);
UpdateTemplateIcons(hwndDlg, path);
MarkChanges(4, hwndDlg);
}
break;
case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, "%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", TranslateT("All Images"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"jpg", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
MarkChanges(4, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.css)%c*.ivt%c%s%c*.*%c%c", TranslateT("Style Sheet"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"css", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(4, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
+ mir_snwprintf(filter, L"%s (*.css)%c*.ivt%c%s%c*.*%c%c", TranslateT("Style Sheet"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"css", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
MarkChanges(4, hwndDlg);
}
break;
@@ -773,7 +786,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL bChecked;
- char path[MAX_PATH], filter[MAX_PATH];
+ wchar_t path[MAX_PATH], filter[MAX_PATH];
switch (msg) {
case WM_INITDIALOG:
MarkInitialized(8);
@@ -813,31 +826,31 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA
MarkChanges(8, hwndDlg);
break;
case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, "%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", TranslateT("Template"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"ivt", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_TEMPLATES_FILENAME, path);
UpdateTemplateIcons(hwndDlg, path);
MarkChanges(8, hwndDlg);
}
break;
case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, "%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", TranslateT("All Images"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"jpg", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
MarkChanges(8, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
+ mir_snwprintf(filter, L"%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"css", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(8, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
+ mir_snwprintf(filter, L"%s (*.css)%c*.ivt%c%s%c*.*%c%c", TranslateT("Style Sheet"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, L"css", path, _countof(path))) {
+ ShowFilePathW(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
MarkChanges(8, hwndDlg);
}
break;
@@ -980,24 +993,24 @@ void ProtocolSettings::readFromDb()
setSRMMFlags(g_plugin.getDword(dbsName, 16128));
DBVARIANT dbv;
- char tmpPath[MAX_PATH];
+ wchar_t tmpPath[MAX_PATH];
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_BACKGROUND);
- if (!g_plugin.getString(dbsName, &dbv)) {
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setSRMMBackgroundFilename(tmpPath);
db_free(&dbv);
}
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_CSS);
- if (!g_plugin.getString(dbsName, &dbv)) {
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setSRMMCssFilename(tmpPath);
db_free(&dbv);
}
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_TEMPLATE);
- if (!g_plugin.getString(dbsName, &dbv)) {
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setSRMMTemplateFilename(tmpPath);
db_free(&dbv);
}
@@ -1013,26 +1026,26 @@ void ProtocolSettings::readFromDb()
setChatFlags(g_plugin.getDword(dbsName, 16128));
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_BACKGROUND);
- if (!g_plugin.getString(dbsName, &dbv)) {
- if (strncmp(tmpPath, "http://", 7))
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ if (wcsncmp(tmpPath, L"http://", 7))
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setChatBackgroundFilename(tmpPath);
db_free(&dbv);
}
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_CSS);
- if (!g_plugin.getString(dbsName, &dbv)) {
- if (strncmp(tmpPath, "http://", 7))
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ if (wcsncmp(tmpPath, L"http://", 7))
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setChatCssFilename(tmpPath);
db_free(&dbv);
}
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_TEMPLATE);
- if (!g_plugin.getString(dbsName, &dbv)) {
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setChatTemplateFilename(tmpPath);
db_free(&dbv);
}
@@ -1048,26 +1061,26 @@ void ProtocolSettings::readFromDb()
setHistoryFlags(g_plugin.getDword(dbsName, 16128));
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_BACKGROUND);
- if (!g_plugin.getString(dbsName, &dbv)) {
- if (strncmp(tmpPath, "http://", 7))
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ if (wcsncmp(tmpPath, L"http://", 7))
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setHistoryBackgroundFilename(tmpPath);
db_free(&dbv);
}
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_CSS);
- if (!g_plugin.getString(dbsName, &dbv)) {
- if (strncmp(tmpPath, "http://", 7))
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ if (wcsncmp(tmpPath, L"http://", 7))
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setHistoryCssFilename(tmpPath);
db_free(&dbv);
}
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_TEMPLATE);
- if (!g_plugin.getString(dbsName, &dbv)) {
- PathToAbsolute(dbv.pszVal, tmpPath);
+ if (!g_plugin.getWString(dbsName, &dbv)) {
+ PathToAbsoluteW(dbv.pwszVal, tmpPath);
setHistoryTemplateFilename(tmpPath);
db_free(&dbv);
}
@@ -1075,19 +1088,19 @@ void ProtocolSettings::readFromDb()
/////////////////////////////////////////////////////////////////////////////////////////
-void ProtocolSettings::setSRMMTemplateFilename(const char *filename)
+void ProtocolSettings::setSRMMTemplateFilename(const wchar_t *filename)
{
srmmTemplateFilename = filename;
TemplateMap::loadTemplates(getSRMMTemplateFilename(), getSRMMTemplateFilename(), false);
}
-void ProtocolSettings::setChatTemplateFilename(const char *filename)
+void ProtocolSettings::setChatTemplateFilename(const wchar_t *filename)
{
chatTemplateFilename = filename;
TemplateMap::loadTemplates(getChatTemplateFilename(), getChatTemplateFilename(), false);
}
-void ProtocolSettings::setHistoryTemplateFilename(const char *filename)
+void ProtocolSettings::setHistoryTemplateFilename(const wchar_t *filename)
{
historyTemplateFilename = filename;
TemplateMap::loadTemplates(getHistoryTemplateFilename(), getHistoryTemplateFilename(), false);
@@ -1161,7 +1174,8 @@ void Options::saveProtocolSettings()
szProto = "_default_";
/* SRMM settings */
- char dbsName[256], tmpPath[MAX_PATH];
+ char dbsName[256];
+ wchar_t tmpPath[MAX_PATH];
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_ENABLE);
g_plugin.setByte(dbsName, it->isSRMMEnable());
@@ -1172,16 +1186,16 @@ void Options::saveProtocolSettings()
g_plugin.setDword(dbsName, it->getSRMMFlags());
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_BACKGROUND);
- PathToRelative(it->getSRMMBackgroundFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getSRMMBackgroundFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_CSS);
- PathToRelative(it->getSRMMCssFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getSRMMCssFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
mir_snprintf(dbsName, "%s.%s", szProto, DBS_SRMM_TEMPLATE);
- PathToRelative(it->getSRMMTemplateFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getSRMMTemplateFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
/* Group Chat settings */
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_ENABLE);
@@ -1194,16 +1208,16 @@ void Options::saveProtocolSettings()
g_plugin.setDword(dbsName, it->getChatFlags());
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_BACKGROUND);
- PathToRelative(it->getChatBackgroundFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getChatBackgroundFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_CSS);
- PathToRelative(it->getChatCssFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getChatCssFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
mir_snprintf(dbsName, "%s.%s", szProto, DBS_CHAT_TEMPLATE);
- PathToRelative(it->getChatTemplateFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getChatTemplateFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
/* History settings */
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_ENABLE);
@@ -1216,16 +1230,16 @@ void Options::saveProtocolSettings()
g_plugin.setDword(dbsName, it->getHistoryFlags());
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_BACKGROUND);
- PathToRelative(it->getHistoryBackgroundFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getHistoryBackgroundFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_CSS);
- PathToRelative(it->getHistoryCssFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getHistoryCssFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
mir_snprintf(dbsName, "%s.%s", szProto, DBS_HISTORY_TEMPLATE);
- PathToRelative(it->getHistoryTemplateFilename(), tmpPath);
- g_plugin.setString(dbsName, tmpPath);
+ PathToRelativeW(it->getHistoryTemplateFilename(), tmpPath);
+ g_plugin.setWString(dbsName, tmpPath);
}
reload();
diff --git a/plugins/IEView/src/Options.h b/plugins/IEView/src/Options.h
index c0a565043c..23c9edaf31 100644
--- a/plugins/IEView/src/Options.h
+++ b/plugins/IEView/src/Options.h
@@ -54,24 +54,24 @@ class ProtocolSettings
bool srmmEnable;
int srmmMode;
int srmmFlags;
- CMStringA srmmBackgroundFilename;
- CMStringA srmmCssFilename;
- CMStringA srmmTemplateFilename;
+ CMStringW srmmBackgroundFilename;
+ CMStringW srmmCssFilename;
+ CMStringW srmmTemplateFilename;
bool chatEnable;
int chatMode;
int chatFlags;
- CMStringA chatBackgroundFilename;
- CMStringA chatCssFilename;
- CMStringA chatTemplateFilename;
+ CMStringW chatBackgroundFilename;
+ CMStringW chatCssFilename;
+ CMStringW chatTemplateFilename;
bool historyEnable;
int historyMode;
int historyFlags;
- CMStringA historyBackgroundFilename;
- CMStringA historyCssFilename;
- CMStringA historyCssFilenameRtl;
- CMStringA historyTemplateFilename;
+ CMStringW historyBackgroundFilename;
+ CMStringW historyCssFilename;
+ CMStringW historyCssFilenameRtl;
+ CMStringW historyTemplateFilename;
public:
ProtocolSettings(const char *protocolName);
@@ -90,14 +90,14 @@ public:
__forceinline void setSRMMFlags(int flags) { this->srmmFlags = flags; }
__forceinline int getSRMMFlags() { return srmmFlags; }
- __forceinline void setSRMMBackgroundFilename(const char *filename) { srmmBackgroundFilename = filename; }
- __forceinline const char* getSRMMBackgroundFilename() { return srmmBackgroundFilename; }
+ __forceinline void setSRMMBackgroundFilename(const wchar_t *filename) { srmmBackgroundFilename = filename; }
+ __forceinline const wchar_t* getSRMMBackgroundFilename() { return srmmBackgroundFilename; }
- __forceinline void setSRMMCssFilename(const char *filename) { srmmCssFilename = filename; }
- __forceinline const char* getSRMMCssFilename() { return srmmCssFilename; }
+ __forceinline void setSRMMCssFilename(const wchar_t *filename) { srmmCssFilename = filename; }
+ __forceinline const wchar_t* getSRMMCssFilename() { return srmmCssFilename; }
- void setSRMMTemplateFilename(const char *filename);
- __forceinline const char* getSRMMTemplateFilename() { return srmmTemplateFilename; }
+ void setSRMMTemplateFilename(const wchar_t *filename);
+ __forceinline const wchar_t* getSRMMTemplateFilename() { return srmmTemplateFilename; }
__forceinline void setChatEnable(bool enable) { this->chatEnable = enable; }
__forceinline bool isChatEnable() { return chatEnable; }
@@ -108,14 +108,14 @@ public:
__forceinline void setChatFlags(int flags) { this->chatFlags = flags; }
__forceinline int getChatFlags() { return chatFlags; }
- __forceinline void setChatBackgroundFilename(const char *filename) { chatBackgroundFilename = filename; }
- __forceinline const char* getChatBackgroundFilename() { return chatBackgroundFilename; }
+ __forceinline void setChatBackgroundFilename(const wchar_t *filename) { chatBackgroundFilename = filename; }
+ __forceinline const wchar_t* getChatBackgroundFilename() { return chatBackgroundFilename; }
- __forceinline void setChatCssFilename(const char *filename) { chatCssFilename = filename; }
- __forceinline const char* getChatCssFilename() { return chatCssFilename; }
+ __forceinline void setChatCssFilename(const wchar_t *filename) { chatCssFilename = filename; }
+ __forceinline const wchar_t* getChatCssFilename() { return chatCssFilename; }
- void setChatTemplateFilename(const char *filename);
- __forceinline const char* getChatTemplateFilename() { return chatTemplateFilename; }
+ void setChatTemplateFilename(const wchar_t *filename);
+ __forceinline const wchar_t* getChatTemplateFilename() { return chatTemplateFilename; }
__forceinline void setHistoryEnable(bool enable) { this->historyEnable = enable; }
__forceinline bool isHistoryEnable() { return historyEnable; }
@@ -126,14 +126,14 @@ public:
__forceinline void setHistoryFlags(int flags) { this->historyFlags = flags; }
__forceinline int getHistoryFlags() { return historyFlags; }
- __forceinline void setHistoryBackgroundFilename(const char *filename) { historyBackgroundFilename = filename; }
- __forceinline const char* getHistoryBackgroundFilename() { return historyBackgroundFilename; }
+ __forceinline void setHistoryBackgroundFilename(const wchar_t *filename) { historyBackgroundFilename = filename; }
+ __forceinline const wchar_t* getHistoryBackgroundFilename() { return historyBackgroundFilename; }
- __forceinline void setHistoryCssFilename(const char *filename) { historyCssFilename = filename; }
- __forceinline const char* getHistoryCssFilename() { return historyCssFilename; }
+ __forceinline void setHistoryCssFilename(const wchar_t *filename) { historyCssFilename = filename; }
+ __forceinline const wchar_t* getHistoryCssFilename() { return historyCssFilename; }
- void setHistoryTemplateFilename(const char *filename);
- __forceinline const char* getHistoryTemplateFilename() { return historyTemplateFilename; }
+ void setHistoryTemplateFilename(const wchar_t *filename);
+ __forceinline const wchar_t* getHistoryTemplateFilename() { return historyTemplateFilename; }
};
namespace Options
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index 76e8487fc1..d0fc1d3d3e 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -182,11 +182,11 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event)
CMStringA str;
if (protoSettings->getSRMMMode() == Options::MODE_CSS) {
- const char *externalCSS = protoSettings->getSRMMCssFilename();
- if (strncmp(externalCSS, "http://", 7))
- str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"file://%s\"/></head><body class=\"body\">\n", externalCSS);
+ auto *externalCSS = protoSettings->getSRMMCssFilename();
+ if (wcsncmp(externalCSS, L"http://", 7))
+ str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"file://%S\"/></head><body class=\"body\">\n", externalCSS);
else
- str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
+ str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%S\"/></head><body class=\"body\">\n", externalCSS);
}
else {
HDC hdc = GetDC(nullptr);
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
index a731831527..72b8d0a27a 100644
--- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
+++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
@@ -151,22 +151,17 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour)
char* TabSRMMHTMLBuilder::timestampToString(uint32_t dwFlags, time_t check, int isGroupBreak)
{
static char szResult[512];
- char str[80];
const char *szFormat;
-
- struct tm tm_now, tm_today;
- time_t now = time(0);
- time_t today;
-
if (!isGroupBreak || !(dwFlags & MWF_LOG_SHOWDATES)) {
szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "s" : "t";
szResult[0] = '\0';
}
else {
- tm_now = *localtime(&now);
- tm_today = tm_now;
+ time_t now = time(0);
+ struct tm tm_now = *localtime(&now);
+ struct tm tm_today = tm_now;
tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
- today = mktime(&tm_today);
+ time_t today = mktime(&tm_today);
if (dwFlags & MWF_LOG_USERELATIVEDATES && check >= today) {
szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "s" : "t";
@@ -186,6 +181,8 @@ char* TabSRMMHTMLBuilder::timestampToString(uint32_t dwFlags, time_t check, int
szResult[0] = '\0';
}
}
+
+ char str[80];
TimeZone_ToString(check, szFormat, str, _countof(str));
mir_strncat(szResult, str, _countof(szResult) - mir_strlen(szResult));
mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
@@ -208,11 +205,11 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event)
CMStringA str;
if (protoSettings->getSRMMMode() == Options::MODE_CSS) {
- const char *externalCSS = protoSettings->getSRMMCssFilename();
- if (strncmp(externalCSS, "http://", 7))
- str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"file://%s\"/></head><body class=\"body\">\n", externalCSS);
+ auto *externalCSS = protoSettings->getSRMMCssFilename();
+ if (wcsncmp(externalCSS, L"http://", 7))
+ str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"file://%S\"/></head><body class=\"body\">\n", externalCSS);
else
- str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
+ str.AppendFormat("<html><head><link rel=\"stylesheet\" href=\"%S\"/></head><body class=\"body\">\n", externalCSS);
}
else {
HDC hdc = GetDC(nullptr);
diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp
index 5571182887..5934dcdb8f 100644
--- a/plugins/IEView/src/Template.cpp
+++ b/plugins/IEView/src/Template.cpp
@@ -226,7 +226,7 @@ TemplateMap::~TemplateMap()
clear();
}
-TemplateMap* TemplateMap::add(const char *id, const char *filename)
+TemplateMap* TemplateMap::add(const char *id, const wchar_t *filename)
{
TemplateMap *map;
for (map = m_mapList; map != nullptr; map = map->m_next) {
@@ -313,21 +313,21 @@ static TokenDef templateNames[] = {
TokenDef("<!--hMessageOutGroupEndRTL-->")
};
-TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, bool onlyInfo)
+TemplateMap* TemplateMap::loadTemplateFile(const wchar_t *id, const wchar_t *filename, bool onlyInfo)
{
char lastTemplate[1024], tmp2[1024];
- if (filename == nullptr || mir_strlen(filename) == 0)
+ if (filename == nullptr || mir_wstrlen(filename) == 0)
return nullptr;
- FILE *fh = fopen(filename, "rt");
+ FILE *fh = _wfopen(filename, L"rt");
if (fh == nullptr)
return nullptr;
TemplateMap *tmap;
if (!onlyInfo)
- tmap = TemplateMap::add(id, filename);
+ tmap = TemplateMap::add(_T2A(id), filename);
else
- tmap = new TemplateMap(id);
+ tmap = new TemplateMap(_T2A(id));
char store[4096];
bool wasTemplate = false;
@@ -407,13 +407,13 @@ TemplateMap* TemplateMap::getTemplateMap(const char *proto)
return nullptr;
}
-void TemplateMap::setFilename(const char *filename)
+void TemplateMap::setFilename(const wchar_t *filename)
{
- replaceStr(m_filename, filename);
+ replaceStrW(m_filename, filename);
Utils::convertPath(m_filename);
}
-TemplateMap* TemplateMap::loadTemplates(const char *id, const char *filename, bool onlyInfo)
+TemplateMap* TemplateMap::loadTemplates(const wchar_t *id, const wchar_t *filename, bool onlyInfo)
{
return loadTemplateFile(id, filename, onlyInfo);
}
diff --git a/plugins/IEView/src/Template.h b/plugins/IEView/src/Template.h
index 64ac8ab561..f264c00c4c 100644
--- a/plugins/IEView/src/Template.h
+++ b/plugins/IEView/src/Template.h
@@ -98,7 +98,7 @@ class TemplateMap
{
static TemplateMap *m_mapList;
char *m_name;
- char *m_filename;
+ wchar_t *m_filename;
bool m_grouping;
bool m_rtl;
Template *m_entries;
@@ -106,21 +106,21 @@ class TemplateMap
TemplateMap(const char *name);
void addTemplate(const char *name, const char *text);
- void setFilename(const char *filename);
+ void setFilename(const wchar_t *filename);
void clear();
- static TemplateMap* add(const char *id, const char *filename);
- static TemplateMap* loadTemplateFile(const char *proto, const char *filename, bool onlyInfo);
+ static TemplateMap* add(const char *id, const wchar_t *filename);
+ static TemplateMap* loadTemplateFile(const wchar_t *proto, const wchar_t *filename, bool onlyInfo);
public:
~TemplateMap();
static Template* getTemplate(const char *id, const char *name);
static TemplateMap* getTemplateMap(const char *id);
- static TemplateMap* loadTemplates(const char *id, const char *filename, bool onlyInfo);
+ static TemplateMap* loadTemplates(const wchar_t *id, const wchar_t *filename, bool onlyInfo);
static void dropTemplates();
Template* getTemplate(const char *text);
- __forceinline const char* getFilename() { return m_filename; }
+ __forceinline const wchar_t* getFilename() { return m_filename; }
__forceinline bool isGrouping() const { return m_grouping; }
__forceinline bool isRTL() const { return m_rtl; }
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp
index c35ed05512..eada37b35c 100644
--- a/plugins/IEView/src/TemplateHTMLBuilder.cpp
+++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp
@@ -68,7 +68,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto)
TemplateMap *TemplateHTMLBuilder::getTemplateMap(ProtocolSettings * protoSettings)
{
- return TemplateMap::getTemplateMap(protoSettings->getSRMMTemplateFilename());
+ return TemplateMap::getTemplateMap(_T2A(protoSettings->getSRMMTemplateFilename()));
}
int TemplateHTMLBuilder::getFlags(ProtocolSettings * protoSettings)
@@ -129,7 +129,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr
char tempBase[1024] = { 0 };
strncpy_s(tempBase, "file://", _TRUNCATE);
- mir_strncat(tempBase, tmpm->getFilename(), _countof(tempBase) - mir_strlen(tempBase));
+ mir_strncat(tempBase, _T2A(tmpm->getFilename()), _countof(tempBase) - mir_strlen(tempBase));
char *pathrun = tempBase + mir_strlen(tempBase);
while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > tempBase))
pathrun--;
@@ -147,12 +147,13 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr
szNameIn = mir_strdup("&nbsp;");
}
mir_snprintf(tempStr, "%snoavatar.png", tempBase);
- wchar_t szNoAvatarPath[MAX_PATH];
- wcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
- wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
- if (szNoAvatarPathTmp != nullptr)
- *szNoAvatarPathTmp = 0;
- mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
+
+ CMStringW szNoAvatarPath(protoSettings->getSRMMTemplateFilename());
+ int idx = szNoAvatarPath.Find('\\');
+ if (idx != -1)
+ szNoAvatarPath.Delete(0, idx);
+ szNoAvatarPath.Append(L"\\noavatar.png");
+
if (_waccess(szNoAvatarPath, 0) == -1)
mir_snprintf(tempStr, "%snoavatar.jpg", tempBase);
else
@@ -292,7 +293,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event,
TemplateMap *tmpm = getTemplateMap(protoSettings);
if (tmpm != nullptr) {
strncpy_s(tempBase, "file://", _TRUNCATE);
- mir_strcat(tempBase, tmpm->getFilename());
+ mir_strcat(tempBase, _T2A(tmpm->getFilename()));
char* pathrun = nullptr;
if (pathrun = strrchr(tempBase, '\\'))
@@ -316,12 +317,12 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event,
szNameIn = mir_strdup("&nbsp;");
}
- wchar_t szNoAvatarPath[MAX_PATH];
- wcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
- wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
- if (szNoAvatarPathTmp != nullptr)
- *szNoAvatarPathTmp = 0;
- mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
+ CMStringW szNoAvatarPath(protoSettings->getSRMMTemplateFilename());
+ int idx = szNoAvatarPath.Find('\\');
+ if (idx != -1)
+ szNoAvatarPath.Delete(0, idx);
+ szNoAvatarPath.Append(L"\\noavatar.png");
+
if (_waccess(szNoAvatarPath, 0) == -1)
mir_snprintf(tempStr, "%snoavatar.jpg", tempBase);
else
diff --git a/plugins/IEView/src/version.h b/plugins/IEView/src/version.h
index ee9b167d9c..0aeb80146f 100644
--- a/plugins/IEView/src/version.h
+++ b/plugins/IEView/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 1
#define __MINOR_VERSION 6
#define __RELEASE_NUM 0
-#define __BUILD_NUM 5
+#define __BUILD_NUM 6
#include <stdver.h>