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.Password = "EnterYourPasswordHere"
        xmppClient.ResolveSrvRecords = False
        xmppClient.Hostname = ""

        xmppClient.Show = Matrix.Xmpp.Show.Chat

        xmppClient.AutoRoster = True
        xmppClient.AutoReplyToPing = True
        xmppClient.AutoPresence = True

        Catch ex As System.Net.WebException
        Catch ex As Exception
        End Try


    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

        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
    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

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see