当前位置: 首页>>代码示例>>C#>>正文


C# XmppClientConnection.Open方法代码示例

本文整理汇总了C#中agsXMPP.XmppClientConnection.Open方法的典型用法代码示例。如果您正苦于以下问题:C# XmppClientConnection.Open方法的具体用法?C# XmppClientConnection.Open怎么用?C# XmppClientConnection.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在agsXMPP.XmppClientConnection的用法示例。


在下文中一共展示了XmppClientConnection.Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public override Task Run()
        {
            _xmppConnection = new XmppClientConnection
            {
                Server = _host,
                ConnectServer = _connectHost,
                AutoResolveConnectServer = true,
                Username = _username,
                Password = _password,
            };

            _xmppConnection.OnLogin += OnLogin;
            _xmppConnection.OnError += OnError;
            _xmppConnection.OnMessage += OnMessage;
            _xmppConnection.OnPresence += XmppConnectionOnOnPresence;
            _xmppConnection.OnRosterItem += OnClientRosterItem;

            

            CancelPreviousLogin();

            _loginTcs = new TaskCompletionSource<bool>();

            _xmppConnection.Open();

            //return _loginTcs == null ? Task.FromResult(false) :  _loginTcs.Task;
            return Task.FromResult(false);
        }
开发者ID:jamessantiago,项目名称:mmbot,代码行数:28,代码来源:XmppAdapter.cs

示例2: Conectar

        public void Conectar(string user, string password)
        {
            XmppClientConnection xmpp = new XmppClientConnection("pvp.net");
            xmpp.UseSSL = true;
            xmpp.Port = 5223;
            xmpp.Resource = "xiff";
            xmpp.AutoResolveConnectServer = false;
            xmpp.ConnectServer = "chat.euw1.lol.riotgames.com";
            //Presence p = new Presence(ShowType.chat, "Online");
            //p.Type = PresenceType.available;
            //xmpp.Send(p);
            xmpp.OnRosterItem += new XmppClientConnection.RosterHandler( xmpp_OnRosterItem);
            xmpp.OnPresence += new PresenceHandler(xmpp_OnPresence);
            xmpp.Open(user, "AIR_" + password);

            //xmpp.OnLogin += delegate (object o) { MessageBox.Show("Logged in as " + xmpp.Username); };
            System.Threading.Thread.Sleep(2000);
            foreach (string nome in Contactos_Todos)
                    {

                Offline_Friends.Items.Add(nome);
                       
                    }
            foreach (string nome in Contactos)
            {

                Online_Friends.Items.Add(nome);

            }
            button.Background = Brushes.Green;
            button.IsEnabled = false;
            button.Content = "CONECTED!";
            
        }
开发者ID:TheWebs,项目名称:LeagueOfLegends_Chat,代码行数:34,代码来源:MainWindow.xaml.cs

示例3: RemakeXmpp

        public static void RemakeXmpp()
        {
            if (Xmpp != null)
            {
                Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
                Xmpp.Close();
                Xmpp = null;
            }
            Xmpp = new XmppClientConnection(ServerPath);

            Xmpp.RegisterAccount = false;
            Xmpp.AutoAgents = true;
            Xmpp.AutoPresence = true;
            Xmpp.AutoRoster = true;
            Xmpp.Username = XmppUsername;
            Xmpp.Password = XmppPassword;
            Xmpp.Priority = 1;
            Xmpp.OnMessage += XmppOnOnMessage;
            Xmpp.OnError += XmppOnOnError;
            Xmpp.OnAuthError += new XmppElementHandler(Xmpp_OnAuthError);
            Xmpp.OnStreamError += XmppOnOnStreamError;
            Xmpp.KeepAlive = true;
            Xmpp.KeepAliveInterval = 60;
            Xmpp.OnAgentStart += XmppOnOnAgentStart;
            Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
            Xmpp.Open();
        }
开发者ID:TriAdX,项目名称:OCTGN,代码行数:27,代码来源:GameBot.cs

示例4: Login

        public void Login(string username, string password)
        {
            if (!LoggedIn)
            {
                try
                {
                    _xmppClient = new XmppClientConnection("chat.facebook.com", 5222);
                    _xmppClient.OnXmppConnectionStateChanged += (sender, state) =>
                    {
                        if (OnConnectionStateChanged != null) OnConnectionStateChanged(state.ToString());
                    };
                    _xmppClient.UseStartTLS = true;
                    _xmppClient.OnPresence += UpdateContactList;
                    _xmppClient.OnLogin += OnLogin;
                    _xmppClient.OnAuthError += (sender, element) =>
                    {
                        if (OnAuthError != null) OnAuthError(element.ToString());
                    };

                   _xmppClient.Open(username, password);
                }
                catch
                {
                    if (OnLoginResult != null)
                        OnLoginResult(false);
                }
            }
        }
开发者ID:sebastianbrand,项目名称:FacebookXMPP,代码行数:28,代码来源:FacebookChatClient.cs

示例5: Start

        public void Start()
        {
            AppDomain.CurrentDomain.AssemblyResolve += (o, args) =>
            {
                var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                return loadedAssemblies.FirstOrDefault(asm => asm.FullName == args.Name);
            };

            string pluginsDirectory = Environment.CurrentDirectory + "\\plugins\\";
            if (!Directory.Exists(pluginsDirectory))
            {
                Directory.CreateDirectory(pluginsDirectory);
            }

            _catalog = new DirectoryCatalog(Environment.CurrentDirectory + "\\plugins\\");
            _catalog.Changed += new EventHandler<ComposablePartCatalogChangeEventArgs>(_catalog_Changed);
            LoadPlugins();

            _client = new XmppClientConnection(ConfigurationManager.AppSettings["Server"]);

            //_client.ConnectServer = "talk.google.com"; //necessary if connecting to Google Talk
            _client.AutoResolveConnectServer = false;

            _client.OnLogin += new ObjectHandler(xmpp_OnLogin);
            _client.OnMessage += new MessageHandler(xmpp_OnMessage);
            _client.OnError += new ErrorHandler(_client_OnError);

            Console.WriteLine("Connecting...");
            _client.Resource = ConfigurationManager.AppSettings["Resource"];
            _client.Open(ConfigurationManager.AppSettings["User"], ConfigurationManager.AppSettings["Password"]);
            Console.WriteLine("Connected.");

            _client.OnRosterStart += new ObjectHandler(_client_OnRosterStart);
            _client.OnRosterItem += new XmppClientConnection.RosterHandler(_client_OnRosterItem);
        }
开发者ID:hartez,项目名称:XmppBot-for-HipChat,代码行数:35,代码来源:XmppBot.cs

示例6: RiotChat

        public RiotChat(string user, string pass)
        {
            xmpp = new XmppClientConnection();
            roster = new List<Presence>();

            xmpp.Username = user;
            xmpp.Password = "AIR_" + pass;

            xmpp.Server = "pvp.net";
            xmpp.ConnectServer = "chat.na1.lol.riotgames.com";
            xmpp.Port = 5223;
            xmpp.AutoResolveConnectServer = false;
            xmpp.UseCompression = false;
            xmpp.UseStartTLS = false;
            xmpp.UseSSL = true;

            xmpp.OnAuthError += new XmppElementHandler(xmpp_OnEleError);
            xmpp.OnError += new ErrorHandler(xmpp_OnError);
            xmpp.OnStreamError += new XmppElementHandler(xmpp_OnEleError);
            xmpp.OnSocketError += new ErrorHandler(xmpp_OnError);

            xmpp.OnLogin += new ObjectHandler(xmpp_OnLogin);
            xmpp.OnPresence += new PresenceHandler(xmpp_OnPresence);
            xmpp.OnReadXml += new XmlHandler(xmpp_OnReadXML);
            xmpp.OnWriteXml += new XmlHandler(xmpp_OnWriteXML);
            xmpp.OnMessage += new MessageHandler(xmpp_OnMessage);

            xmpp.Open();
        }
开发者ID:DarkActive,项目名称:LoLQuery,代码行数:29,代码来源:RiotChat.cs

示例7: JabberListener

        public JabberListener()
        {
            Jid jidSender = new Jid(Properties.Settings.Default.JabberName);
            xmpp = new XmppClientConnection(jidSender.Server);
            xmpp.Open(jidSender.User, Properties.Settings.Default.JabberPWd);

            xmpp.OnLogin += new ObjectHandler(xmpp_OnLogin);
        }
开发者ID:R3MUSDevPack,项目名称:ReconnectedServerStuff,代码行数:8,代码来源:JabberListener.cs

示例8: StartRun

 protected override void StartRun()
 {
     _client = new XmppClientConnection(Settings.Instance.JabberServer);
     _client.Open(Settings.Instance.JabberUser, Settings.Instance.JabberPassword);
     _client.OnLogin += delegate { UpdateState(0); };
     _client.OnError += (sender, ex) => Log.Fatal("StartRun()", ex);
     _client.OnAuthError += (sender, e) => Log.Fatal("StartRun() " + e);
 }
开发者ID:sstraus,项目名称:xdcc-grabscher,代码行数:8,代码来源:Plugin.cs

示例9: XmppSendTest

 public void XmppSendTest()
 {
     var xmpp = new XmppClientConnection(domain);
     xmpp.ConnectServer = connectserver;
     xmpp.Open(username, password);
     xmpp.OnError += new ErrorHandler(delegate { logerror(); });
     xmpp.OnLogin += delegate(object o) { xmpp.Send(new Message(new Jid(recipient), MessageType.chat, "james")); };
     while (!xmpp.Authenticated)
         System.Threading.Thread.Sleep(500);
     System.Threading.Thread.Sleep(1000);
     xmpp.Send(new Message(new Jid(recipient), MessageType.chat, "james"));
     xmpp.Close();
 }
开发者ID:jamessantiago,项目名称:agsXmppNlogTarget,代码行数:13,代码来源:UnitTest1.cs

示例10: Main

 static void Main(string[] args)
 {
     Console.ReadLine();
     XmppClientConnection xmppCon = new XmppClientConnection();
     xmppCon.Username = "[email protected]";
     xmppCon.Password = "aaaa";
     xmppCon.Server = "talk.google.com";
     xmppCon.Port = 443;
     xmppCon.UseStartTLS = true;
     xmppCon.AutoResolveConnectServer = true;
     xmppCon.Open();
     Console.WriteLine("Bye");
 }
开发者ID:wraithkings,项目名称:wmtalk,代码行数:13,代码来源:Program.cs

示例11: AuthenticateAsync

        public async Task<Session.IInfo> AuthenticateAsync(string connectServer, string authenticationToken)
        {
            XmppClientConnection connection = new XmppClientConnection();

            connection.Server = Guest.Server;
            connection.Username = Guest.User;
            connection.Password = GuestPassword;

            connection.AutoResolveConnectServer = false;
            connection.ForceStartTls = false;
            connection.ConnectServer = connectServer; // values.HarmonyHubAddress;
            connection.AutoAgents = false;
            connection.AutoPresence = false;
            connection.AutoRoster = false;
            connection.OnSaslStart += OnSaslStart;
            connection.OnSaslEnd += OnSaslEnd;
            connection.OnXmppConnectionStateChanged += (s, e) => Instrumentation.Xmpp.ConnectionStateChanged(e);
            connection.OnReadXml += (s, e) => Instrumentation.Xmpp.Receive(e);
            connection.OnWriteXml += (s, e) => Instrumentation.Xmpp.Transmit(e);
            connection.OnError += (s, e) => Instrumentation.Xmpp.Error(e);
            connection.OnSocketError += (s, e) => Instrumentation.Xmpp.SocketError(e);

            Task connected = Observable.FromEvent<agsXMPP.ObjectHandler, Unit>(handler => s => handler(Unit.Default), handler => connection.OnLogin += handler, handler => connection.OnLogin -= handler)
                                       .Timeout(TimeSpan.FromSeconds(30))
                                       .Take(1)
                                       .ToTask();

            connection.Open();

            await connected;

            Task<Session.IInfo> session =
                Observable.FromEvent<agsXMPP.protocol.client.IqHandler, agsXMPP.protocol.client.IQEventArgs>(handler => (s, e) => handler(e), handler => connection.OnIq += handler, handler => connection.OnIq -= handler)
                      .Do(args => Instrumentation.Xmpp.IqReceived(args.IQ.From, args.IQ.To, args.IQ.Id, args.IQ.Error, args.IQ.Type, args.IQ.Value))
                      .Do(args => args.Handled = true)
                      .Select(args => args.IQ)
                      .SessionResponses()
                      .Timeout(TimeSpan.FromSeconds(10))
                      .Take(1)
                      .ToTask();

            connection.Send(Builder.ConstructSessionInfoRequest(authenticationToken));

            Session.IInfo sessionInfo = await session;

            connection.Close();

            return sessionInfo;
        }
开发者ID:Zananok,项目名称:Harmonize,代码行数:49,代码来源:Provider.cs

示例12: MainForm_Load

 private void MainForm_Load(object sender, EventArgs e)
 {
     xmppCon = new XmppClientConnection();
     xmppCon.OnLogin += new ObjectHandler(xmppCon_OnLogin);
     xmppCon.OnAuthError += new XmppElementHandler(xmppCon_OnAuthError);
     xmppCon.OnError += new ErrorHandler(xmppCon_OnError);
     xmppCon.Username = "[email protected]";
     xmppCon.Password = "751109";
     xmppCon.Server = "talk.google.com";
     xmppCon.Port = 443;
     //xmppCon.UseStartTLS = true;
     xmppCon.KeepAlive = true;
     xmppCon.AutoResolveConnectServer = true;
     xmppCon.Open();
 }
开发者ID:wraithkings,项目名称:wmtalk,代码行数:15,代码来源:MainForm.cs

示例13: Start

        public void Start()
        {
            _client = new XmppClientConnection(_robot.Settings.Get("HipChatServer"))
            {
                AutoResolveConnectServer = false
            };

            _client.OnLogin += OnLogin;
            _client.OnMessage += OnMessage;
            _client.OnRosterStart += OnRosterStart;
            _client.OnRosterItem += OnRosterItem;

            _robot.Logger.WriteLine("Connecting...");
            _client.Resource = _robot.Settings.Get("HipChatResource");
            _client.Open(_robot.Settings.Get("HipChatUser"), _robot.Settings.Get("HipChatPassword"));
            _robot.Logger.WriteLine("Connected.");
        }
开发者ID:pinopino,项目名称:Nubot,代码行数:17,代码来源:Hipchat.cs

示例14: Main

        static void Main(string[] args)
        {           
            const string JID_SENDER     = "[email protected]";
            const string PASSWORD       = "secret";   // password of the JIS_SENDER account

            const string JID_RECEIVER   = "[email protected]";

            Jid jidSender = new Jid(JID_SENDER);
            XmppClientConnection xmpp = new  XmppClientConnection(jidSender.Server);
            xmpp.Open(jidSender.User, PASSWORD);            
            xmpp.OnLogin += delegate(object o) { xmpp.Send(new Message(new Jid(JID_RECEIVER), MessageType.chat, "Hello, how are you?")); };

            Console.WriteLine("Wait until you get the message and press a key to continue");
            Console.ReadLine();
            
            xmpp.Close();
        }
开发者ID:don59,项目名称:agsXmpp,代码行数:17,代码来源:Program.cs

示例15: LOTROGateway

 public LOTROGateway(string cserver, string server, string username, string password, string expectedUser, string confirmMsg, bool tls)
 {
     connection = new XmppClientConnection(server);
     connection.ConnectServer = cserver;
     connection.UseStartTLS = tls;
     connection.OnMessage += new XmppClientConnection.MessageHandler(connection_OnMessage);
     connection.OnLogin += new ObjectHandler(connection_OnLogin);
     connection.OnError += new ErrorHandler(connection_OnError);
     connection.OnClose += new ObjectHandler(connection_OnClose);
     connection.OnPresence += new XmppClientConnection.PresenceHandler(connection_OnPresence);
     connection.OnSocketError += new ErrorHandler(connection_OnSocketError);
     this.username = username;
     this.password = password;
     connection.KeepAlive = true;
     connection.Open(username, password);
     this.expectedUser = expectedUser;
     this.confirmMsg = confirmMsg;
 }
开发者ID:Tilps,项目名称:Stash,代码行数:18,代码来源:LOTROGateway.cs


注:本文中的agsXMPP.XmppClientConnection.Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。