本文整理汇总了C#中agsXMPP.XmppClientConnection类的典型用法代码示例。如果您正苦于以下问题:C# XmppClientConnection类的具体用法?C# XmppClientConnection怎么用?C# XmppClientConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmppClientConnection类属于agsXMPP命名空间,在下文中一共展示了XmppClientConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Client
public Client()
{
Xmpp = new XmppClientConnection("skylabsonline.com");
Xmpp.OnRegistered += XmppOnOnRegistered;
Xmpp.OnRegisterError += XmppOnOnRegisterError;
Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
Xmpp.OnLogin += XmppOnOnLogin;
Xmpp.OnAuthError += XmppOnOnAuthError;
Xmpp.OnRosterItem += XmppOnOnRosterItem;
Xmpp.OnRosterEnd += XmppOnOnRosterEnd;
Xmpp.OnRosterStart += XmppOnOnRosterStart;
Xmpp.OnMessage += XmppOnOnMessage;
Xmpp.OnPresence += XmppOnOnPresence;
Xmpp.OnAgentItem += XmppOnOnAgentItem;
Xmpp.OnIq += XmppOnOnIq;
Xmpp.OnReadXml += XmppOnOnReadXml;
Notifications = new List<Notification>();
Friends = new List<NewUser>();
//GroupChats = new List<NewUser>();
myPresence = new Presence();
Chatting = new Chat(this,Xmpp);
CurrentHostedGamePort = -1;
_games = new List<HostedGameData>();
agsXMPP.Factory.ElementFactory.AddElementType("gameitem", "octgn:gameitem", typeof(HostedGameData));
}
示例2: 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);
}
示例3: Init
public override void Init(XmppClientConnection con)
{
base.XmppClientConnection = con;
DoClientAuth();
}
示例4: XMPPClient
public XMPPClient()
{
_connection = new XmppClientConnection(XMPPServer);
_connection.OnLogin += ConnectionOnLogin;
_connection.OnMessage += OnMessage;
ConnectToXmppServer();
}
示例5: 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!";
}
示例6: 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();
}
示例7: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
XmppConnection = new XmppClientConnection();
XmppConnection.AutoResolveConnectServer = true;
}
示例8: frmMain
public frmMain()
{
InitializeComponent();
// initialize Combo Status
InitStatusCombo();
// initilaize XmppConnection and setup all event handlers
XmppCon = new XmppClientConnection();
XmppCon.OnReadXml += new XmlHandler(XmppCon_OnReadXml);
XmppCon.OnWriteXml += new XmlHandler(XmppCon_OnWriteXml);
XmppCon.OnRosterStart += new ObjectHandler(XmppCon_OnRosterStart);
XmppCon.OnRosterEnd += new ObjectHandler(XmppCon_OnRosterEnd);
XmppCon.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem);
XmppCon.OnAgentStart += new ObjectHandler(XmppCon_OnAgentStart);
XmppCon.OnAgentEnd += new ObjectHandler(XmppCon_OnAgentEnd);
XmppCon.OnAgentItem += new agsXMPP.XmppClientConnection.AgentHandler(XmppCon_OnAgentItem);
XmppCon.OnLogin += new ObjectHandler(XmppCon_OnLogin);
XmppCon.OnClose += new ObjectHandler(XmppCon_OnClose);
XmppCon.OnError += new ErrorHandler(XmppCon_OnError);
XmppCon.OnPresence += new PresenceHandler(XmppCon_OnPresence);
XmppCon.OnMessage += new MessageHandler(XmppCon_OnMessage);
XmppCon.OnIq += new IqHandler(XmppCon_OnIq);
XmppCon.ClientSocket.OnReceive += new agsXMPP.net.ClientSocket.OnSocketDataHandler(ClientSocket_OnReceive);
XmppCon.ClientSocket.OnSend += new agsXMPP.net.ClientSocket.OnSocketDataHandler(ClientSocket_OnSend);
}
示例9: frmLogin
public frmLogin(XmppClientConnection con)
{
InitializeComponent();
this.DialogResult = DialogResult.Cancel;
_xmppCon = con;
}
示例10: 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);
}
}
}
示例11: Chat
public Chat(Client c, XmppClientConnection xmpp)
{
_client = c;
Rooms = new ThreadSafeList<NewChatRoom>();
_xmpp = xmpp;
_xmpp.OnMessage += XmppOnOnMessage;
}
示例12: Form1
public Form1(XmppClientConnection con)
{
InitializeComponent();
connection = con;
Jid jid_ = new Jid(tb_login.Text, tb_ip.Text, connection.Resource);
jid = jid_.ToString();
}
示例13: FileTransfer
public FileTransfer(XmppClientConnection xmppCon, IContact recipient, string filename)
: base(recipient, filename)
{
_xmppConnection = xmppCon;
_fileLength = new FileInfo(filename).Length;
}
示例14: DiscoHelper
public DiscoHelper(XmppClientConnection con)
{
xmppCon = con;
con.OnIq += new IqHandler(con_OnIq);
m_Features.Add(agsXMPP.Uri.DISCO_INFO);
}
示例15: frmFileTransfer
public frmFileTransfer(XmppClientConnection XmppCon, IQ iq)
{
InitializeComponent();
cmdSend.Enabled = false;
this.Text = "Receive File from " + iq.From.ToString();
siIq = iq;
si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI;
// get SID for file transfer
m_Sid = si.Id;
m_From = iq.From;
file = si.File;
if (file != null)
{
m_lFileLength = file.Size;
this.lblDescription.Text = file.Description;
this.lblFileName.Text = file.Name;
this.lblFileSize.Text = HRSize(m_lFileLength);
this.txtDescription.Visible = false;
}
m_XmppCon = XmppCon;
this.progress.Maximum = 100;
//this.Text += iq.From.ToString();
//this.tbFileSize.Text = FileTransferUtils.ConvertToByteString(m_lFileLength);
XmppCon.OnIq += new IqHandler(XmppCon_OnIq);
}