Esempio n. 1
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "T:XmppChatRoom" /> class.
 /// </summary>
 /// <param name = "session">The session.</param>
 /// <param name = "conferenceService">The conference service.</param>
 /// <param name = "chatRoomId">The chat room id.</param>
 internal XmppChatRoom(XmppSession session, XmppService conferenceService, XmppJid chatRoomId)
     : base(session, chatRoomId)
 {
     this.conferenceService = conferenceService;
     seekEnterChatRoomEvent = new AutoResetEvent(false);
     createChatRoomEvent    = new AutoResetEvent(false);
 }
Esempio n. 2
0
        public FakeAuctionServer(string itemId)
        {
            _itemId = itemId;

            _xmpp = new XmppService(
                string.Format(ITEM_ID_AS_LOGIN, ItemId),
                AUCTION_PASSWORD,
                XMPP_HOSTNAME);

            _xmpp.AddMessageHandler(_listener);
        }
Esempio n. 3
0
        /// <summary>
        /// Login using the password of the passwordBox.
        /// </summary>
        /// <param name="parameter">The passwordBox of the view.</param>
        private void Login(object parameter)
        {
            var passbox  = parameter as System.Windows.Controls.PasswordBox;
            var password = passbox.Password;

            try
            {
                XmppService.Initialize(Username, password);
                OnAuthentication();
            }
            catch (Exception exception)
            {
                //TODO : implement error message
                MessageBox.Show(exception.Message);
            }
        }
Esempio n. 4
0
        /// <summary>Prepares a BasicNode.</summary>
        /// <param name="node_config">A node config object.</param>
        public BasicNode(NodeConfig node_config)
        {
            _node_config      = node_config;
            _running          = true;
            _shutdown         = Shutdown.GetShutdown();
            _shutdown.OnExit += OnExit;

            _type_to_pem = new Dictionary <string, PathELManager>();
            _rand        = new Random();

            if (_node_config.XmppServices.Enabled)
            {
                XmppService = new XmppService(_node_config.XmppServices.Username,
                                              _node_config.XmppServices.Password,// _node_config.XmppServices.Server,
                                              _node_config.XmppServices.Port);
                XmppService.Connect();
            }
        }
Esempio n. 5
0
        /// <summary>
        ///   Creates the chat room.
        /// </summary>
        /// <param name = "chatRoomName">Name of the chat room.</param>
        /// <returns></returns>
        public XmppChatRoom EnterChatRoom(string chatRoomName)
        {
            CheckSessionState();

            XmppService  service    = ServiceDiscovery.GetService(XmppServiceCategory.Conference);
            XmppChatRoom chatRoom   = null;
            var          chatRoomId = new XmppJid
                                      (
                chatRoomName,
                service.Identifier,
                UserId.UserName
                                      );

            if (service != null)
            {
                chatRoom = new XmppChatRoom(this, service, chatRoomId);
                chatRoom.Enter();
            }

            return(chatRoom);
        }
Esempio n. 6
0
        public MainWindowViewModel()
        {
            if (Environment.GetCommandLineArgs().Length < 2)
            {
                throw new Exception("Must specify an auction id!");
            }

            AuctionIds = Environment.GetCommandLineArgs()[1].Split(new char[] { ',' });

            string jid = ConfigurationManager.AppSettings[CONFIG_JID];

            _xmpp = new XmppService(jid,
                                    ConfigurationManager.AppSettings[CONFIG_PASSWORD],
                                    ConfigurationManager.AppSettings[CONFIG_HOST]);

            _xmpp.Connect();

            foreach (string itemId in AuctionIds)
            {
                JoinAuction(itemId);
            }
        }
Esempio n. 7
0
        public JabberNetwork(string uid, string password,
                             string host, string port)
        {
            _addresses    = ImmutableDictionary <string, string> .Empty;
            _fingerprints = ImmutableDictionary <string, string> .Empty;
            _doc          = new XmlDocument();
            _port         = Int32.Parse(port);
            _host         = host;
            _data         = String.Empty;
            _message      = "Offline";
            _uid          = uid;
            _password     = password;
            _auto_connect = false;
            _timer        = new Timer(TimerHandler, null, PUB_PERIOD, PUB_PERIOD);

            _xmpp = new XmppService(uid, password, _port);
            _xmpp.Register(typeof(SvpnMsg), HandleSvpnMsg);
            _xmpp.OnStreamInit   += SvpnFactory.HandleStreamInit;
            _xmpp.OnAuthenticate += HandleAuthenticate;
            _xmpp.OnAuthError    += HandleAuthError;
            _xmpp.OnPresence     += HandlePresence;
            _xmpp.OnError        += HandleError;
        }