Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow XMPP Server to be different from JID domain #41

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9d5477a
Added support for specifying the XMPP server to connect to when it is…
stevenlivz Oct 27, 2016
a625095
Added some support for custom namespaces as sibling to the body.
stevenlivz Apr 21, 2017
734f432
Added support for stream management, stream resumption and stream res…
stevenlivz May 6, 2017
0c0dccf
* XmppCore.cs: Addeed in support for XEP-0198. Alpha code just now!
stevenlivz May 9, 2017
fef2bd5
Allow access to key Stream Management functionality from the Client.
stevenlivz May 9, 2017
5d9ba22
Updated namespace to differentiate from original projects which have …
stevenlivz May 9, 2017
077959d
Updated sample code.
stevenlivz May 9, 2017
b2936f1
Added a new constructor to IM.Message which allows to create a message
stevenlivz May 9, 2017
f8f264f
Added RetrieveRoster property to allow lightweight connections.
stevenlivz May 9, 2017
17adefd
Set JID for IqRequest via Im5tu
stevenlivz May 9, 2017
832dd11
Fixed spelling of Autenticate via Rychard PR
stevenlivz May 9, 2017
02cc1d8
Merged XEP-0033: Extended Stanza Addressing support via jbrownsp
stevenlivz May 9, 2017
cb7173a
A demo of multi user addressing.
stevenlivz May 9, 2017
2064625
Syn'd commit by jpenny1993
stevenlivz May 9, 2017
c3009c8
Allow optional loading of extensions in XmppClient constructor.
stevenlivz May 11, 2017
d7dc0ea
Make it possible to retrieve the room which spawned GroupPresenceEven…
Dykam Oct 9, 2017
a2b9f38
Upgraded to .NET Core 2
stevenlivz Feb 8, 2018
1a2a2f1
Upgraded to .NET Core 2
stevenlivz Feb 8, 2018
b2e0ae8
Removed dependency on ARSoft for DNS resolution that was rarely used …
stevenlivz Feb 8, 2018
0a5156b
Merge pull request #2 from Dykam/grouppresence
stevenlivz Feb 8, 2018
caace91
Updated order of build target framework or it does not complie.
stevenlivz Apr 30, 2018
248a81a
Removed .Net Standard reference - just using Core.
stevenlivz May 1, 2018
e129621
Updated to use .Net Standard 2.0 to enable compatability with Xamarin…
stevenlivz Oct 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
340 changes: 169 additions & 171 deletions Client/Examples.xml
Original file line number Diff line number Diff line change
@@ -1,171 +1,169 @@
<Sharp>
<Xmpp>
<Client>
<XmppClient name="GetFeatures">
<example>
This example shows how to use the GetFeatures method to print out a
list of features supported by the XMPP client of a chat contact.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";
Jid juliet = "juliet@capulet.com/balcony";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

Console.WriteLine("Juliet's XMPP client supports: ");
foreach (var feat in cl.GetFeatures(juliet))
Console.WriteLine(" - " + feat);
}
</code>
</example>
</XmppClient>
<XmppClient name="SendMessage-1">
<example>
This example demonstrates how to use the SendMessage method in order
to send a chat-message to a contact.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";
Jid juliet = "juliet@capulet.com/balcony";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

while(true) {
Console.Write("Type a message or type 'quit' to exit: ");
string s = Console.ReadLine();
if(s == "quit")
return;
// Send the message to Juliet.
cl.SendMessage(juliet, s);
}
}
</code>
</example>
</XmppClient>
<XmppClient name="SendMessage-2">
<example>
This example demonstrates how to use the SendMessage method in order
to send a multi-language chat-message to a contact.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";
Jid juliet = "juliet@capulet.com/balcony";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

cl.SendMessage(juliet, new Dictionary&lt;string, string&gt;() {
{ "en", "Hi, how are you?" },
{ "dk", "Hej, hvordan har du det?" },
{ "de", "Hallo, wie geht es dir?" },
{ "jp", "お元気ですか?" }
});
}
</code>
</example>
</XmppClient>
<XmppClient name="GetRoster">
<example>
This example demonstrates how to use the GetRoster method in order
to retrieve a list of all of the user's contacts.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

Console.WriteLine("Contacts on " + cl.Jid.Node + "'s contact-list:");
foreach (var item in cl.GetRoster())
Console.WriteLine(" - " + item.Jid);
}
</code>
</example>
</XmppClient>
<XmppClient name="SetTune">
<example>
This example demonstrates how to use the SetTune method in order
to publish tune information to other contacts.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

// Let your contacts know what you are currently listening to.
cl.SetTune(new TuneInformation("Every Breath You Take", "The Police"));

Console.WriteLine("Type 'quit' to exit.");
while(Console.ReadLine() != "quit");
}
</code>
</example>
</XmppClient>
<XmppClient name="SetActivity">
<example>
This example demonstrates how to use the SetActivity method in order
to publish the user's current activity.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

// Let your contacts know what you are currently doing.
cl.SetActivity(GeneralActivity.Eating, SpecificActivity.HavingBreakfast);

Console.WriteLine("Type 'quit' to exit.");
while(Console.ReadLine() != "quit");
}
</code>
</example>
</XmppClient>
<XmppClient name="SubscriptionRequest">
<example>
This example demonstrates how to set up the SubscriptionRequest delegate in
order to process incoming subscription requests.
<code language="c#">
static void Main(string[] args) {
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.SubscriptionRequest = OnSubscriptionRequest;
cl.Connect();

// Put the thread to sleep and wait for subscription requests.
Thread.Sleep(Timeout.Infinite);
}
}

/// &lt;summary&gt;
/// A callback method that is invoked whenever a subscription request from
/// another XMPP user is received.
/// &lt;/summary&gt;
/// &lt;param name="from"&gt;The JID of the XMPP user who wishes to subscribe to our
/// presence.&lt;/param&gt;
/// &lt;returns>true to approve the request; Otherwise false.&lt;/returns&gt;
static bool OnSubscriptionRequest(Jid from) {
Console.WriteLine(from + " wants to subscribe to your presence.");
Console.Write("Type Y to approve the request, or any other key to refuse it: ");

// Return true to approve the request, or false to refuse it.
return Console.ReadLine().ToLowerInvariant() == "y";
}
</code>
</example>
</XmppClient>
</Client>
</Xmpp>
</Sharp>
<XMPPEngineer>
<Client>
<XmppClient name="GetFeatures">
<example>
This example shows how to use the GetFeatures method to print out a
list of features supported by the XMPP client of a chat contact.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";
Jid juliet = "juliet@capulet.com/balcony";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

Console.WriteLine("Juliet's XMPP client supports: ");
foreach (var feat in cl.GetFeatures(juliet))
Console.WriteLine(" - " + feat);
}
</code>
</example>
</XmppClient>
<XmppClient name="SendMessage-1">
<example>
This example demonstrates how to use the SendMessage method in order
to send a chat-message to a contact.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";
Jid juliet = "juliet@capulet.com/balcony";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

while(true) {
Console.Write("Type a message or type 'quit' to exit: ");
string s = Console.ReadLine();
if(s == "quit")
return;
// Send the message to Juliet.
cl.SendMessage(juliet, s);
}
}
</code>
</example>
</XmppClient>
<XmppClient name="SendMessage-2">
<example>
This example demonstrates how to use the SendMessage method in order
to send a multi-language chat-message to a contact.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";
Jid juliet = "juliet@capulet.com/balcony";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

cl.SendMessage(juliet, new Dictionary&lt;string, string&gt;() {
{ "en", "Hi, how are you?" },
{ "dk", "Hej, hvordan har du det?" },
{ "de", "Hallo, wie geht es dir?" },
{ "jp", "お元気ですか?" }
});
}
</code>
</example>
</XmppClient>
<XmppClient name="GetRoster">
<example>
This example demonstrates how to use the GetRoster method in order
to retrieve a list of all of the user's contacts.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

Console.WriteLine("Contacts on " + cl.Jid.Node + "'s contact-list:");
foreach (var item in cl.GetRoster())
Console.WriteLine(" - " + item.Jid);
}
</code>
</example>
</XmppClient>
<XmppClient name="SetTune">
<example>
This example demonstrates how to use the SetTune method in order
to publish tune information to other contacts.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

// Let your contacts know what you are currently listening to.
cl.SetTune(new TuneInformation("Every Breath You Take", "The Police"));

Console.WriteLine("Type 'quit' to exit.");
while(Console.ReadLine() != "quit");
}
</code>
</example>
</XmppClient>
<XmppClient name="SetActivity">
<example>
This example demonstrates how to use the SetActivity method in order
to publish the user's current activity.
<code language="c#">
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.Connect();

// Let your contacts know what you are currently doing.
cl.SetActivity(GeneralActivity.Eating, SpecificActivity.HavingBreakfast);

Console.WriteLine("Type 'quit' to exit.");
while(Console.ReadLine() != "quit");
}
</code>
</example>
</XmppClient>
<XmppClient name="SubscriptionRequest">
<example>
This example demonstrates how to set up the SubscriptionRequest delegate in
order to process incoming subscription requests.
<code language="c#">
static void Main(string[] args) {
string hostname = "jabber.se",
username = "myUsername",
password = "myPassword";

using (var cl = new XmppClient(hostname, username, password)) {
cl.SubscriptionRequest = OnSubscriptionRequest;
cl.Connect();

// Put the thread to sleep and wait for subscription requests.
Thread.Sleep(Timeout.Infinite);
}
}

/// &lt;summary&gt;
/// A callback method that is invoked whenever a subscription request from
/// another XMPP user is received.
/// &lt;/summary&gt;
/// &lt;param name="from"&gt;The JID of the XMPP user who wishes to subscribe to our
/// presence.&lt;/param&gt;
/// &lt;returns>true to approve the request; Otherwise false.&lt;/returns&gt;
static bool OnSubscriptionRequest(Jid from) {
Console.WriteLine(from + " wants to subscribe to your presence.");
Console.Write("Type Y to approve the request, or any other key to refuse it: ");

// Return true to approve the request, or false to refuse it.
return Console.ReadLine().ToLowerInvariant() == "y";
}
</code>
</example>
</XmppClient>
</Client>
</XMPPEngineer>
4 changes: 2 additions & 2 deletions Client/FileTransferSettings.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Sharp.Xmpp.Extensions;
using XMPPEngineer.Extensions;
using System;
using System.Collections.Generic;
using System.Net;

namespace Sharp.Xmpp.Client
namespace XMPPEngineer.Client
{
/// <summary>
/// Contains settings for configuring various file-transfer options.
Expand Down
Loading