Disable AudioComponent do get everything to build nicely.
[chatter.git] / AccountModel.cs
blob1c24ba11c3528d79614626a1d7c19cd0f1c91faf
1 using System;
2 using System.Collections.Generic;
3 using System.Xml.Serialization;
5 namespace Chatter
7 public delegate void AccountModelDelegate (AccountModel model);
9 public class AccountModel
11 // Serializable stuff
12 string protocol;
13 string server;
14 string account;
15 bool require_encryption;
16 uint port;
17 bool auto_connect;
18 string password;
20 // Locals
21 ConnectionModel conn;
23 public AccountModel () { }
25 public AccountModel (string protocol)
27 this.protocol = protocol;
29 // Defaults
30 server = "";
31 account = "user@" + protocol;
32 require_encryption = false;
33 port = 0;
34 auto_connect = false;
35 password = "";
38 [XmlAttribute("Protocol")]
39 public string Protocol
41 get { return protocol; }
42 set { protocol = value; FireChanged (); }
45 [XmlElement("Server")]
46 public string Server
48 get { return server; }
49 set { server = value; FireChanged (); }
52 [XmlElement("Account")]
53 public string AccountStr
55 get { return account; }
56 set { account = value; FireChanged (); }
59 [XmlElement("RequireEncryption")]
60 public bool RequireEncryption
62 get { return require_encryption; }
63 set { require_encryption = value; FireChanged (); }
66 [XmlElement("AutoConnect")]
67 public bool AutoConnect
69 get { return auto_connect; }
70 set { auto_connect = value; FireChanged (); }
73 /*[XmlIgnore]
74 public string Password
76 get
78 return Global.PluginManager.IPassword.GetPassword ("chatter-account-" + protocol + "-" + account);
80 set
82 Global.PluginManager.IPassword.SetPassword ("chatter-account-" + protocol + "-" + account, value);
84 }*/
86 [XmlElement("Password")]
87 public string Password
89 get
91 return password;
93 set
95 password = value; FireChanged();
100 [XmlElement("Port")]
101 public uint Port
103 get { return port; }
104 set { port = value; FireChanged (); }
107 [XmlIgnore]
108 public IDictionary<string, object> Parameters
112 IDictionary<string, object> list = new Dictionary<string, object> ();
113 if (Server != "")
114 list.Add (new KeyValuePair<string, object> ("server", Server));
115 if (AccountStr != "")
116 list.Add (new KeyValuePair<string, object> ("account", AccountStr));
117 if (Password != "")
118 list.Add (new KeyValuePair<string, object> ("password", Password));
119 if (Port != 0)
120 list.Add (new KeyValuePair<string, object> ("port", Port));
122 list.Add (new KeyValuePair<string, object> ("ignore-ssl-errors", true));
123 list.Add (new KeyValuePair<string, object> ("old-ssl", (bool) true));
124 return list;
128 void FireChanged ()
130 if (Changed != null) Changed (this);
133 public event AccountModelDelegate Changed;