-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAxVdrTools.cpp
150 lines (127 loc) · 7.04 KB
/
AxVdrTools.cpp
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//=============================================================================
/*
* See the file README in the main directory for a description of
* this software, copyright information, and how to reach the author.
*
* Author: alex
* Date: 15.11.2003
*
* Last modfied:
* $Author: alex $
* $Date: 2013-03-20 20:33:18 +0100 (Mi, 20 Mär 2013) $
* $Revision: 1.16 $
*/
//=============================================================================
//=============================================================================
// includes
//=============================================================================
//----- multiple defs of swap() workaround ------------------------------------
#include "AxPluginGlobals.h"
//----- qt --------------------------------------------------------------------
//----- CORBA -----------------------------------------------------------------
//----- ICE -------------------------------------------------------------------
//----- C++ -------------------------------------------------------------------
//----- C ---------------------------------------------------------------------
//----- vdr -------------------------------------------------------------------
#include <vdr/tools.h>
#include <vdr/i18n.h>
#include <vdr/menuitems.h>
//----- AxLib -----------------------------------------------------------------
#include <Ax/Tools/Trace.h>
// #include <Ax/Tools/TraceOn.h>
#include <Ax/Mail/MailBox.h>
#include <Ax/Mail/MailBoxSetup.h>
//----- local plugin ----------------------------------------------------------
#include "AxVdrTools.h"
#include "AxMailWrapper.h"
//----- locals ----------------------------------------------------------------
//=============================================================================
// using namespaces
//=============================================================================
using namespace std;
using namespace Ax;
//=============================================================================
// class AxVdrTools
//=============================================================================
//-------------------------------------------------------------------------
// Access modes
//-------------------------------------------------------------------------
const char *AxVdrTools::AccountTypeNames [Mail::AT_COUNT ];
const char *AxVdrTools::AccessModeNames [Mail::AM_COUNT ];
const char *AxVdrTools::CClientOptSecNames [Mail::CC_SEC_COUNT ];
const char *AxVdrTools::CClientOptRSHNames [Mail::CC_RSH_COUNT ];
const char *AxVdrTools::CClientOptSSLNames [Mail::CC_SSL_COUNT ];
const char *AxVdrTools::CClientOptTLSNames [Mail::CC_TLS_COUNT ];
const char *AxVdrTools::CClientOptCertNames[Mail::CC_CERT_COUNT ];
const char *AxVdrTools::CClientOptDbgNames [Mail::CC_DBG_COUNT ];
const char *AxVdrTools::WrapModeStrings [AxMailWrapper::WM_COUNT];
//-------------------------------------------------------------------------
// Sort order
//-------------------------------------------------------------------------
const char *AxVdrTools::SortOrderStrings[AxVdrTools::SO_COUNT];
//-------------------------------------------------------------------------
// AxVdrTools::initialize()
//-------------------------------------------------------------------------
void AxVdrTools::initialize()
{
//----- account types -------------------------------------------------------
AccountTypeNames [Mail::AT_USER ] = tr("User defined");
AccountTypeNames [Mail::AT_IMAP ] = tr("IMAP" );
AccountTypeNames [Mail::AT_POP3 ] = tr("POP3" );
AccountTypeNames [Mail::AT_NNTP ] = tr("NNTP" );
AccountTypeNames [Mail::AT_INBOX ] = tr("INBOX" );
//----- access modes --------------------------------------------------------
AccessModeNames [Mail::AM_NONE ] = tr("Unrestricted");
AccessModeNames [Mail::AM_SETUP ] = tr("Setup" );
AccessModeNames [Mail::AM_SETUP_READ ] = tr("Setup & view");
//----- option for c-client: no option, /secure -----------------------------
CClientOptSecNames [Mail::CC_SEC_NONE ] = tr("---" );
CClientOptSecNames [Mail::CC_SEC_YES ] = tr("yes (opt: /secure)" );
//----- option for c-client: no option, /norsh ------------------------------
CClientOptRSHNames [Mail::CC_RSH_NONE ] = tr("---" );
CClientOptRSHNames [Mail::CC_RSH_NO ] = tr("no (opt: /norsh)" );
//----- option for c-client: no option, /ssl --------------------------------
CClientOptSSLNames [Mail::CC_SSL_NONE ] = tr("---" );
CClientOptSSLNames [Mail::CC_SSL_YES ] = tr("yes (opt: /ssl)" );
//----- option for c-client: no option, /tls or /notls ----------------------
CClientOptTLSNames [Mail::CC_TLS_NONE ] = tr("---" );
CClientOptTLSNames [Mail::CC_TLS_YES ] = tr("yes (opt: /tls)" );
CClientOptTLSNames [Mail::CC_TLS_NO ] = tr("no (opt: /notls)" );
//----- option for c-client: no option, /validate-cert or /novalidate-cer ---
CClientOptCertNames[Mail::CC_CERT_NONE ] = tr("---" );
CClientOptCertNames[Mail::CC_CERT_VALIDATE ] = tr("yes (opt: /validate-cert)" );
CClientOptCertNames[Mail::CC_CERT_NOVALIDATE ] = tr("no (opt: /novalidate-cert)" );
//----- option for c-client: no option, /debug ------------------------------
CClientOptDbgNames [Mail::CC_DBG_NONE ] = tr("---" );
CClientOptDbgNames [Mail::CC_DBG_YES ] = tr("yes (opt: /debug)");
//----- sort oder ----------------------------------------------------------
SortOrderStrings [AxVdrTools::SO_ASC ] = tr("ascending" );
SortOrderStrings [AxVdrTools::SO_DESC ] = tr("descending");
//----- word wrap mode ------------------------------------------------------
WrapModeStrings [AxMailWrapper::WM_NONE ] = tr("1: wrap by VDR");
WrapModeStrings [AxMailWrapper::WM_QUOTE ] = tr("2: continue quotes");
WrapModeStrings [AxMailWrapper::WM_FLOWED ] = tr("3: honor format flowed");
WrapModeStrings [AxMailWrapper::WM_SMALL ] = tr("4: combine lines");
} // AxVdrTools::initialize()
//-------------------------------------------------------------------------
// AxVdrTools::getVdrCharSet()
//-------------------------------------------------------------------------
std::string AxVdrTools::getVdrCharSet()
{
#if VDRVERSNUM < 10503
std::string aCharSet = std::string(I18nCharSets()[Setup.OSDLanguage]);
wsdebug(("- AxVdrTools::getVdrCharSet() Using Vdr < 10503 -> using '%s'", aCharSet.c_str()));
#else
std::string aCharSet("UTF-8");
if (cCharSetConv::SystemCharacterTable())
{
aCharSet = std::string(cCharSetConv::SystemCharacterTable());
wsdebug(("- AxVdrTools::getVdrCharSet() Vdr-System-CharSet: '%s'", aCharSet.c_str()));
}
else
{
wsdebug(("- AxVdrTools::getVdrCharSet() Vdr-System-CharSet not set, using '%s'", aCharSet.c_str()));
} // if
#endif
return aCharSet;
} // AxVdrTools::getVdrCharSet()