1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/////////////////////////////////////////////////////////////////////////////////////////
// Miranda NG: the free IM client for Microsoft* Windows*
//
// Copyright (C) 2012-24 Miranda NG team,
// Copyright (c) 2000-09 Miranda ICQ/IM project,
// all portions of this codebase are copyrighted to the people
// listed in contributors.txt.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// you should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// part of tabSRMM messaging plugin for Miranda.
//
// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
//
// Simple editor for the message log templates
#include "stdafx.h"
/*
* hardcoded default set of templates for both LTR and RTL.
* cannot be changed and may be used at any time to "revert" to a working layout
*/
char* TemplateNames[TMPL_MAX] =
{
LPGEN("Message In"),
LPGEN("Message Out"),
LPGEN("Group In (Start)"),
LPGEN("Group Out (Start)"),
LPGEN("Group In (Inner)"),
LPGEN("Group Out (Inner)"),
LPGEN("Status change"),
LPGEN("Error message")
};
wchar_t* TemplateNamesW[TMPL_MAX] =
{
LPGENW("Message In"),
LPGENW("Message Out"),
LPGENW("Group In (Start)"),
LPGENW("Group Out (Start)"),
LPGENW("Group In (Inner)"),
LPGENW("Group Out (Inner)"),
LPGENW("Status change"),
LPGENW("Error message")
};
TTemplateSet LTR_Default =
{
TRUE,
L"%I %N %?&r%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M",
L"%I %N %?&r%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M",
L"%I %N %?&r%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M",
L"%I %N %?&r%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M",
L"%S %T%|%M",
L"%S %T%|%M",
L"%I %S %&r, %&T, %N %M%! ",
L"%I%S %r, %T, %e%l%M",
"Default LTR"
};
TTemplateSet RTL_Default =
{
TRUE,
L"%I %N %r%n%S %T%|%M",
L"%I %N %r%n%S %T%|%M",
L"%I %N %r%n%S %T%|%M",
L"%I %N %r%n%S %T%|%M",
L"%S %T%|%M",
L"%S %T%|%M",
L"%I%S %r, %T, %N %M%! ",
L"%I%S %r, %T, %e%l%M",
"Default RTL"
};
TTemplateSet LTR_Active, RTL_Active;
/*
* loads template set overrides from hContact into the given set of already existing
* templates
*/
static void LoadTemplatesFrom(TTemplateSet *tSet, MCONTACT hContact, int rtl)
{
for (int i = 0; i < TMPL_MAX; i++) {
DBVARIANT dbv = { 0 };
if (db_get_ws(hContact, rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[i], &dbv))
continue;
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR)
wcsncpy_s(tSet->szTemplates[i], dbv.pwszVal, _TRUNCATE);
db_free(&dbv);
}
}
void LoadDefaultTemplates()
{
LTR_Active = LTR_Default;
RTL_Active = RTL_Default;
if (db_get_b(0, RTLTEMPLATES_MODULE, "setup", 0) < 2) {
for (int i = 0; i < TMPL_MAX; i++)
db_set_ws(0, RTLTEMPLATES_MODULE, TemplateNames[i], RTL_Default.szTemplates[i]);
db_set_b(0, RTLTEMPLATES_MODULE, "setup", 2);
}
if (db_get_b(0, TEMPLATES_MODULE, "setup", 0) < 2) {
for (int i = 0; i < TMPL_MAX; i++)
db_set_ws(0, TEMPLATES_MODULE, TemplateNames[i], LTR_Default.szTemplates[i]);
db_set_b(0, TEMPLATES_MODULE, "setup", 2);
}
LoadTemplatesFrom(<R_Active, 0, 0);
LoadTemplatesFrom(&RTL_Active, 0, 1);
}
|