public ChatModel()
        {
            Roster = new List<string>();
            Messages = new List<string>();
            _rosterManager = new RosterManager {Stream = _jabberClient};
            _clientConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            _config = (ClientConfig)_clientConfig.Sections["clientconfig"];

            ApplyDefaultJabberConfiguration(_jabberClient);

            _jabberClient.OnError += jabberClient_OnError;
            _jabberClient.OnAuthenticate += jabberClient_OnAuthenticate;
            _jabberClient.OnAuthError += jabberClient_OnAuthError;
            _jabberClient.OnMessage += jabberClient_OnMessage;
            _jabberClient.OnPresence += JabberClientOnOnPresence;

            _jabberClient.Connect();
        }
        public ConfigurationWindow(JabberClient jClient, ClientConfig config)
        {
            InitializeComponent();
            var chatConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "gibbon.config");
            if(File.Exists(chatConfigPath))
            {
                ReadChatConfig(chatConfigPath);
            }
            else
            {
                ReadAppConfig(config);
            }

            jabberClient = jClient;

            userNameTextbox.Text = _chatConfig.Username;
            userPasswordBox.Text = _chatConfig.Password;
            serverTextbox.Text = _chatConfig.Server;
            serverNameTextbox.Text = _chatConfig.ServerName;

            jabberClient.OnAuthenticate += new bedrock.ObjectHandler(jabberClient_OnAuthenticate);
            jabberClient.OnAuthError += new jabber.protocol.ProtocolHandler(jabberClient_OnAuthError);
            jabberClient.OnError += new bedrock.ExceptionHandler(jabberClient_OnError);
        }
 private void ReadAppConfig(ClientConfig jabberConfig)
 {
     _chatConfig.Username = jabberConfig.Username;
     _chatConfig.Password = jabberConfig.Password;
     _chatConfig.Server = jabberConfig.Server;
     _chatConfig.ServerName = jabberConfig.ServerName;
 }