Moved some data from Client to ClientLogic where it belongs.
git-svn-id: http://voip.null.ro/svn/yate@2220 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
154b331ea5
commit
404d28f0e1
|
@ -140,11 +140,9 @@ Configuration Client::s_contacts; // Contacts
|
|||
Configuration Client::s_providers; // Provider settings
|
||||
Configuration Client::s_history; // Call log
|
||||
Configuration Client::s_calltoHistory; // Dialed destinations history
|
||||
ObjList Client::s_accOptions;
|
||||
int Client::s_changing = 0;
|
||||
Regexp Client::s_notSelected = "^-\\(.*\\)-$"; // Holds a not selected/set value match
|
||||
ObjList Client::s_logics;
|
||||
String Client::s_protocols[Client::OtherProtocol] = {"sip","jabber","h323","iax"};
|
||||
String Client::s_skinPath; // Skin path
|
||||
String Client::s_soundPath; // Sounds path
|
||||
String Client::s_ringInName = "defaultringin"; // Ring name for incoming channels
|
||||
|
@ -167,15 +165,6 @@ ObjList ClientSound::s_sounds; // ClientSound's list
|
|||
Mutex ClientSound::s_soundsMutex(true); // ClientSound's list lock mutex
|
||||
static ClientLogic s_defaultLogic; // The default logic
|
||||
|
||||
// Parameters that are applied from provider template
|
||||
const char* Client::s_provParams[] = {
|
||||
"server",
|
||||
"domain",
|
||||
"outbound",
|
||||
"port",
|
||||
0
|
||||
};
|
||||
|
||||
// Client relays
|
||||
static MsgRelay s_relays[] = {
|
||||
{"call.cdr", Client::CallCdr, 90},
|
||||
|
@ -729,14 +718,6 @@ Client::Client(const char *name)
|
|||
for (int i = 0; s_relays[i].name; i++)
|
||||
installRelay(s_relays[i].name,s_relays[i].id,s_relays[i].prio);
|
||||
|
||||
// Build account options list
|
||||
if (!s_accOptions.skipNull()) {
|
||||
s_accOptions.append(new String("allowplainauth"));
|
||||
s_accOptions.append(new String("noautorestart"));
|
||||
s_accOptions.append(new String("oldstyleauth"));
|
||||
s_accOptions.append(new String("tlsrequired"));
|
||||
}
|
||||
|
||||
// Set paths
|
||||
s_skinPath = Engine::config().getValue("client","skinbase");
|
||||
if (!s_skinPath)
|
||||
|
|
|
@ -49,6 +49,17 @@ static String s_notSelected = "-none-";
|
|||
// Maximum number of call log entries
|
||||
static unsigned int s_maxCallHistory = 20;
|
||||
|
||||
ObjList ClientLogic::s_accOptions;
|
||||
String ClientLogic::s_protocols[ClientLogic::OtherProtocol] = {"sip","jabber","h323","iax"};
|
||||
// Parameters that are applied from provider template
|
||||
const char* ClientLogic::s_provParams[] = {
|
||||
"server",
|
||||
"domain",
|
||||
"outbound",
|
||||
"port",
|
||||
0
|
||||
};
|
||||
|
||||
// strings used for completing account parameters
|
||||
static String s_accParams[] = {
|
||||
"username", "password", "server", "domain",
|
||||
|
@ -103,7 +114,7 @@ static void updateProtocolSpec(NamedList& p, const String& proto, const String&
|
|||
setAccParam(p,prefix,"address","");
|
||||
// Options
|
||||
prefix << "_opt_";
|
||||
for (ObjList* o = Client::s_accOptions.skipNull(); o; o = o->skipNext()) {
|
||||
for (ObjList* o = ClientLogic::s_accOptions.skipNull(); o; o = o->skipNext()) {
|
||||
String* opt = static_cast<String*>(o->get());
|
||||
bool checked = (0 != obj->find(*opt));
|
||||
p.setParam("check:" + prefix + *opt,String::boolText(checked));
|
||||
|
@ -647,7 +658,7 @@ bool ClientLogic::select(Window* wnd, const String& name, const String& item,
|
|||
if (!sect)
|
||||
return false;
|
||||
NamedList p("");
|
||||
for (const char** par = Client::s_provParams; *par; par++)
|
||||
for (const char** par = s_provParams; *par; par++)
|
||||
p.addParam(String("acc_") + *par,sect->getValue(*par));
|
||||
NamedString* proto = sect->getParam("protocol");
|
||||
if (proto) {
|
||||
|
@ -868,8 +879,8 @@ bool ClientLogic::editAccount(bool newAcc, NamedList* params, Window* wnd)
|
|||
// Protocol combo and specific widget (page) data
|
||||
selectProtocolSpec(*params,proto,m_accShowAdvanced);
|
||||
NamedString* tmp = params->getParam("acc_options");
|
||||
for (int i = 0; i < Client::OtherProtocol; i++)
|
||||
updateProtocolSpec(*params,Client::s_protocols[i],tmp ? *tmp : String::empty());
|
||||
for (int i = 0; i < OtherProtocol; i++)
|
||||
updateProtocolSpec(*params,s_protocols[i],tmp ? *tmp : String::empty());
|
||||
params->setParam("context",acc);
|
||||
params->setParam("acc_account",acc);
|
||||
params->setParam("modal",String::boolText(true));
|
||||
|
@ -946,7 +957,7 @@ bool ClientLogic::acceptAccount(NamedList* params, Window* wnd)
|
|||
// Options
|
||||
prefix << "opt_";
|
||||
String options;
|
||||
for (ObjList* o = Client::s_accOptions.skipNull(); o; o = o->skipNext()) {
|
||||
for (ObjList* o = s_accOptions.skipNull(); o; o = o->skipNext()) {
|
||||
String* opt = static_cast<String*>(o->get());
|
||||
bool checked = false;
|
||||
Client::self()->getCheck(prefix + *opt,checked,wnd);
|
||||
|
@ -2002,6 +2013,14 @@ bool ClientLogic::defaultMsgHandler(Message& msg, int id, bool& stopLogic)
|
|||
// Client created and initialized all windows
|
||||
void ClientLogic::initializedWindows()
|
||||
{
|
||||
// Build account options list
|
||||
if (!s_accOptions.skipNull()) {
|
||||
s_accOptions.append(new String("allowplainauth"));
|
||||
s_accOptions.append(new String("noautorestart"));
|
||||
s_accOptions.append(new String("oldstyleauth"));
|
||||
s_accOptions.append(new String("tlsrequired"));
|
||||
}
|
||||
|
||||
if (!Client::self())
|
||||
return;
|
||||
|
||||
|
@ -2010,11 +2029,11 @@ void ClientLogic::initializedWindows()
|
|||
String acc_proto = "acc_protocol";
|
||||
if (!Client::self()->hasOption(proto,s_notSelected))
|
||||
Client::self()->addOption(proto,s_notSelected,true);
|
||||
for (int i = 0; i < Client::OtherProtocol; i++) {
|
||||
if (!Client::self()->hasOption(proto,Client::s_protocols[i]))
|
||||
Client::self()->addOption(proto,Client::s_protocols[i],false);
|
||||
if (!Client::self()->hasOption(acc_proto,Client::s_protocols[i]))
|
||||
Client::self()->addOption(acc_proto,Client::s_protocols[i],false);
|
||||
for (int i = 0; i < OtherProtocol; i++) {
|
||||
if (!Client::self()->hasOption(proto,s_protocols[i]))
|
||||
Client::self()->addOption(proto,s_protocols[i],false);
|
||||
if (!Client::self()->hasOption(acc_proto,s_protocols[i]))
|
||||
Client::self()->addOption(acc_proto,s_protocols[i],false);
|
||||
}
|
||||
// Add account/providers 'not selected' item
|
||||
String tmp = "account";
|
||||
|
|
51
yatecbase.h
51
yatecbase.h
|
@ -660,17 +660,6 @@ public:
|
|||
OptCount = 8
|
||||
};
|
||||
|
||||
/**
|
||||
* Known voip protocols
|
||||
*/
|
||||
enum Protocol {
|
||||
SIP = 0,
|
||||
JABBER = 1,
|
||||
H323 = 2,
|
||||
IAX = 3,
|
||||
OtherProtocol = 4
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param name The client's name
|
||||
|
@ -1242,22 +1231,6 @@ public:
|
|||
static inline void setLogicsTick()
|
||||
{ s_idleLogicsTick = true; }
|
||||
|
||||
/**
|
||||
* Get the protocol from a string
|
||||
*/
|
||||
static inline Protocol getProtocol(const String& proto) {
|
||||
for (int i = 0; i < OtherProtocol; i++)
|
||||
if (proto == s_protocols[i])
|
||||
return (Protocol)i;
|
||||
return OtherProtocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the protocol name from an integer value
|
||||
*/
|
||||
static inline const String& getProtocol(int proto)
|
||||
{ return proto < OtherProtocol ? s_protocols[proto] : String::empty(); }
|
||||
|
||||
static Configuration s_settings; // Client settings
|
||||
static Configuration s_actions; // Logic preferrences
|
||||
static Configuration s_accounts; // Accounts
|
||||
|
@ -1267,12 +1240,6 @@ public:
|
|||
static Configuration s_calltoHistory; // Dialed destinations history
|
||||
// Holds a not selected/set value match
|
||||
static Regexp s_notSelected;
|
||||
// Parameters that are applied from provider template
|
||||
static const char* s_provParams[];
|
||||
// Account options string list
|
||||
static ObjList s_accOptions;
|
||||
// The list of protocols supported by the client
|
||||
static String s_protocols[OtherProtocol];
|
||||
// Paths
|
||||
static String s_skinPath;
|
||||
static String s_soundPath;
|
||||
|
@ -1669,6 +1636,17 @@ class YATE_API ClientLogic : public GenObject
|
|||
{
|
||||
friend class Client;
|
||||
public:
|
||||
/**
|
||||
* Known voip protocols
|
||||
*/
|
||||
enum Protocol {
|
||||
SIP = 0,
|
||||
JABBER = 1,
|
||||
H323 = 2,
|
||||
IAX = 3,
|
||||
OtherProtocol = 4
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor. Append itself to the client's list
|
||||
*/
|
||||
|
@ -2119,6 +2097,13 @@ public:
|
|||
*/
|
||||
void clearDurationUpdate();
|
||||
|
||||
// Account options string list
|
||||
static ObjList s_accOptions;
|
||||
// Parameters that are applied from provider template
|
||||
static const char* s_provParams[];
|
||||
// The list of protocols supported by the client
|
||||
static String s_protocols[OtherProtocol];
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method called by the client when idle.
|
||||
|
|
Loading…
Reference in New Issue