1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
Imports Matrix Imports Matrix.Xmpp Imports Matrix.Xmpp.Client Imports Matrix.Xmpp.Roster ''type this in the package-manager Install-Package MatriX Module Module1 'Install-Package MatriX WithEvents xmppClient As New XmppClient() Sub Main() xmppClient.Compression = False xmppClient.Hostname = Nothing xmppClient.ResolveSrvRecords = True xmppClient.StartTls = True xmppClient.Status = "Online" xmppClient.Show = Show.None xmppClient.Transport = Matrix.Net.Transport.Socket xmppClient.SetUsername("EID") xmppClient.SetXmppDomain("Domain.Com") xmppClient.Password = "EnterYourPasswordHere" xmppClient.ResolveSrvRecords = False xmppClient.Hostname = "MyCupsServer.info.sys" xmppClient.Show = Matrix.Xmpp.Show.Chat xmppClient.AutoRoster = True xmppClient.AutoReplyToPing = True xmppClient.AutoPresence = True Try xmppClient.Open() Catch ex As System.Net.WebException Console.WriteLine(ex.Message) Catch ex As Exception Console.WriteLine(ex.Message) End Try Console.ReadKey() xmppClient.Close() End Sub Private Sub xmppClient_OnLogin(sender As Object, e As EventArgs) Handles xmppClient.OnLogin Console.WriteLine("xmppClient_OnLogin: " & e.State) End Sub Private Sub xmppClient_OnMessage(sender As Object, e As MessageEventArgs) Handles xmppClient.OnMessage Console.WriteLine(e.Message) If (e.Message.Body <> Nothing) Then Console.ForegroundColor = ConsoleColor.Red Console.WriteLine("{0}: {1}", e.Message.From.User, e.Message.Body) Console.ForegroundColor = ConsoleColor.Green Console.Write("{0}: ", e.Message.To.User) End If End Sub Private Sub xmppClient_OnPresence(sender As Object, e As PresenceEventArgs) Handles xmppClient.OnPresence Console.WriteLine(e.Presence) End Sub Private Sub xmppClient_OnRosterItem(sender As Object, e As RosterEventArgs) Handles xmppClient.OnRosterItem Console.WriteLine(e.RosterItem.ToString & " - " & e.Version) End Sub End Module |