Skip to content

Commit

Permalink
#27: add test code for SharpXMPP
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Dec 8, 2016
1 parent 44f3b0a commit 681afaf
Show file tree
Hide file tree
Showing 3 changed files with 7,078 additions and 0 deletions.
42 changes: 42 additions & 0 deletions xmpptest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Xml.Linq;
using SharpXMPP;
using SharpXMPP.XMPP;
using SharpXMPP.XMPP.Client.MUC.Bookmarks.Elements;

namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var c = new XmppClient(new JID("[email protected]"), "xxxxxxx");
c.SignedIn += (_, __) => {
Console.WriteLine("Connected");
var room = new BookmarkedConference();
room.SetAttributeValue("jid", "[email protected]");

var element = new XElement("storage:bookmarks", "nick");
element.Value = "hortolet";
room.Add(element);

c.BookmarkManager.Join(room);
};

c.Message += (s, e) => {
Console.Write("<-"); Console.WriteLine(e);
};

c.Element += (s, e) => {
Console.Write(e.IsInput ? "<-" : "->"); Console.WriteLine(e.Stanza);
};

Console.WriteLine("Connecting...");
c.Connect();



Console.ReadLine();
}
}
}
20 changes: 20 additions & 0 deletions xmpptest/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"SharpXMPP.Shared": "0.0.1-pre01"
},
"imports": "dnxcore50"
}
}
}
Loading

0 comments on commit 681afaf

Please sign in to comment.