本文整理汇总了C#中jabber.JID类的典型用法代码示例。如果您正苦于以下问题:C# JID类的具体用法?C# JID怎么用?C# JID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JID类属于jabber命名空间,在下文中一共展示了JID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmppService
/// <summary>Initiate a Xmpp client handle.</summary>
public XmppService(string username, string password, int port)
{
_write_lock = new object();
_jc = new JabberClient();
JID jid = new JID(username);
_jc.User = jid.User;
_jc.Server = jid.Server;
_jc.Password = password;
_jc.Port = port;
_jc.AutoReconnect = 30F;
_jc.AutoStartTLS = true;
_jc.KeepAlive = 30F;
_jc.AutoPresence = false;
_jc.AutoRoster = false;
_jc.LocalCertificate = null;
var rng = new RNGCryptoServiceProvider();
byte[] id = new byte[4];
rng.GetBytes(id);
_jc.Resource = RESOURCE_NS + BitConverter.ToString(id).Replace("-", "");
_jc.OnInvalidCertificate += HandleInvalidCert;
_jc.OnAuthenticate += HandleAuthenticate;
_jc.OnAuthError += HandleAuthError;
_jc.OnError += HandleError;
_jc.OnIQ += HandleIQ;
_jc.OnPresence += HandlePresence;
_jc.OnMessage += HandleMessage;
_online = new Dictionary<string, JID>();
_demux = new Dictionary<Type, QueryCallback>();
}
示例2: Test_Parse_7
[Test] public void Test_Parse_7()
{
JID j = new JID("[email protected]/bar/baz");
Assert.AreEqual("boo", j.User);
Assert.AreEqual("foo", j.Server);
Assert.AreEqual("bar/baz", j.Resource);
}
示例3: Test_Parse_3
[Test] public void Test_Parse_3()
{
JID j = new JID("[email protected]");
Assert.AreEqual("boo", j.User);
Assert.AreEqual("foo", j.Server);
Assert.AreEqual(null, j.Resource);
}
示例4: UserLocation
public UserLocation(JID jid, string locationName, string latitude, string longitude, string source)
{
m_Jid = jid;
m_LocationName = locationName;
m_Latitude = latitude;
m_Longitude = longitude;
m_Source = source;
}
示例5: ReceivedAvatarMetadata
private void ReceivedAvatarMetadata(JID from, string node, XmlNode items)
{
if (items.ChildNodes.Count == 0)
return;
Console.WriteLine("Received Avatar Data");
Console.WriteLine(items.ToString());
}
示例6: Setup
public void Setup()
{
mocks = new MockRepository();
stream = mocks.DynamicMock<XmppStream>();
tracker = mocks.DynamicMock<IIQTracker>();
doc = new XmlDocument();
jid = new JID("test.example.com");
}
示例7: SendMessage
public void SendMessage(JID toJid, string body, MessageType type)
{
Message m = new Message (XmppGlobal.InternalClient.Document);
m.To = toJid;
m.Body = body;
m.Type = type;
XmppGlobal.InternalClient.Write (m);
}
示例8: ChatContentMessage
public ChatContentMessage(Account account, JID source, string sourceDisplayName, JID destination, DateTime date, bool isAutoReply)
: base(account, source, sourceDisplayName, destination, date)
{
if (source == null)
throw new ArgumentNullException("source");
if (destination == null)
throw new ArgumentNullException("destination");
m_IsAutoReply = isAutoReply;
}
示例9: ChatHandler
public ChatHandler(Account account, bool isMucUser, JID jid)
: base(account)
{
m_Jid = jid;
m_IsMucUser = isMucUser;
base.Account.ConnectionStateChanged += HandleConnectionStateChanged;
base.Ready = (base.Account.ConnectionState == AccountConnectionState.Connected);
base.AppendStatus(String.Format("Conversation with {0}.", jid.ToString()));
}
示例10: Test_Create
[Test] public void Test_Create()
{
JID j = new JID("foo", "jabber.com", "there");
Assert.AreEqual("[email protected]/there", j.ToString());
j = new JID(null, "jabber.com", null);
Assert.AreEqual("jabber.com", j.ToString());
j = new JID("foo", "jabber.com", null);
Assert.AreEqual("[email protected]", j.ToString());
j = new JID(null, "jabber.com", "there");
Assert.AreEqual("jabber.com/there", j.ToString());
}
示例11: XmppService
public XmppService(string jid, string password, string host)
{
_jc = new JabberClient();
_jc.Resource = XMPP_RESOURCE;
_jc.AutoStartTLS = false;
_jc.SSL = false;
JID j = new JID(jid);
_jc.User = j.User;
_jc.Server = j.Server;
_jc.Password = password;
_jc.NetworkHost = host;
}
示例12: AbstractChatContent
public AbstractChatContent(Account account, JID source, string sourceDisplayName, JID destination, DateTime date)
{
if (account == null)
throw new ArgumentNullException("account");
if (date == null)
throw new ArgumentNullException("date");
m_Account = account;
m_Source = source;
m_SourceDisplayName = sourceDisplayName;
m_Destination = destination;
m_Date = date;
}
示例13: AuctionMessageTranslator
public AuctionMessageTranslator(JID inSniperJId, IAuctionEventListener inListener)
{
mSniperId = inSniperJId;
mParser.RegisterAction("CLOSE", (ev) => {
inListener.AuctionClosed();
});
mParser.RegisterAction("PRICE", (ev) => {
inListener.CurrentPrice(
ev.IntegerValueOf("CurrentPrice"),
ev.IntegerValueOf("Increment"),
ev.PriceSourceFrom(mSniperId)
);
});
}
示例14: ProfileWindow
public ProfileWindow(Account account, JID jid)
: base()
{
SetupUi();
webView.SetHtml("<p>Loading...</p>");
account.RequestVCard(jid, delegate (object sender, IQ iq, object data) {
if (iq.Type == IQType.result)
Populate((VCard)iq.FirstChild);
else
Populate(null);
}, null);
Gui.CenterWidgetOnScreen(this);
}
示例15: Test_AtAt
public void Test_AtAt()
{
try
{
JID j = new JID("[email protected]@foo");
string u = j.User;
Assert.IsTrue(false);
}
catch (JIDFormatException)
{
Assert.IsTrue(true);
}
catch (Exception)
{
Assert.IsTrue(false);
}
}