本文整理汇总了C#中jabber.JID类的典型用法代码示例。如果您正苦于以下问题:C# JID类的具体用法?C# JID怎么用?C# JID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JID类属于jabber命名空间,在下文中一共展示了JID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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>();
}
开发者ID:hseom,项目名称:brunet,代码行数:34,代码来源:XmppService.cs
示例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);
}
开发者ID:krbysn,项目名称:jabber-net,代码行数:7,代码来源:JIDTest.cs
示例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);
}
开发者ID:krbysn,项目名称:jabber-net,代码行数:7,代码来源:JIDTest.cs
示例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;
}
开发者ID:jrudolph,项目名称:synapse,代码行数:8,代码来源:GeoService.cs
示例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());
}
开发者ID:jrudolph,项目名称:synapse,代码行数:8,代码来源:UserAvatars.cs
示例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");
}
开发者ID:krbysn,项目名称:jabber-net,代码行数:9,代码来源:PubSubManagerTest.cs
示例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);
}
开发者ID:noismaster,项目名称:xmppapplication,代码行数:10,代码来源:Messaging.cs
示例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;
}
开发者ID:jrudolph,项目名称:synapse,代码行数:11,代码来源:ChatContentMessage.cs
示例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()));
}
开发者ID:jrudolph,项目名称:synapse,代码行数:11,代码来源:ChatHandler.cs
示例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());
}
开发者ID:krbysn,项目名称:jabber-net,代码行数:11,代码来源:JIDTest.cs
示例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;
}
开发者ID:jgroszko,项目名称:AuctionSniper,代码行数:13,代码来源:XmppService.cs
示例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;
}
开发者ID:jrudolph,项目名称:synapse,代码行数:14,代码来源:AbstractChatContent.cs
示例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)
);
});
}
开发者ID:transcript-goos,项目名称:ritalin,代码行数:15,代码来源:AuctionMessageTranslator.cs
示例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);
}
开发者ID:jrudolph,项目名称:synapse,代码行数:16,代码来源:ProfileWindow.cs
示例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);
}
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:17,代码来源:JIDTest.cs
示例16: Test_BadCompare
public void Test_BadCompare()
{
try
{
JID j = new JID("[email protected]/bar");
j.CompareTo("[email protected]/bar");
Assert.IsTrue(false);
}
catch (ArgumentException)
{
Assert.IsTrue(true);
}
catch (Exception)
{
Assert.IsTrue(false);
}
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:17,代码来源:JIDTest.cs
示例17: TestAdd
public void TestAdd()
{
PresenceManager pp = new PresenceManager();
Presence pres = new Presence(doc);
JID f = new JID("foo", "bar", "baz");
pres.From = f;
pp.AddPresence(pres);
Assert.AreEqual("[email protected]/baz", pp[f].From.ToString());
f.Resource = null;
Assert.AreEqual("[email protected]/baz", pp[f].From.ToString());
pres = new Presence(doc);
pres.Status = "wandering";
pres.From = new JID("foo", "bar", "baz");
pp.AddPresence(pres);
Assert.AreEqual("wandering", pp[f].Status);
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:17,代码来源:PresenceManagerTest.cs
示例18: Conference
internal Conference(JabberSession session, JID conferenceJid)
{
if (conferenceJid == null)
throw new ArgumentNullException("conferenceJid");
JabberSession = session;
JabberSession.ConnectionDropped += OnConnectionDropped;
ConferenceJid = conferenceJid;
Members = new ConferenceMemberCollection(session);
Messages = new ConferenceMessageCollection(session);
//if we are currently authenticated - then lets join to the channel imidiatly
if (JabberSession.IsAuthenticated)
Authenticated(this, new AuthenticationEventArgs());
JabberSession.Authenticated += Authenticated;
}
开发者ID:eNoise,项目名称:cyclops-chat,代码行数:18,代码来源:Conference.cs
示例19: Chat
public Chat(JID inToJId, JabberClient inConnection)
{
this.Connection = inConnection;
this.Connection.OnMessage += (s, m) => {
if (this.Translator != null) {
this.Translator.ProcessMessage(this, m);
}
};
this.Connection.OnError += (s, ex) => {
if (this.Translator != null) {
}
};
this.ToJId = inToJId;
this.FromId = new JID(
this.Connection.User, this.Connection.NetworkHost, this.Connection.Resource
);
}
开发者ID:transcript-goos,项目名称:ritalin,代码行数:19,代码来源:Chat.cs
示例20: Test_Compare_Equal
public void Test_Compare_Equal()
{
JID j = new JID("[email protected]/baz");
Assert.AreEqual(0, j.CompareTo(j));
Assert.AreEqual(0, j.CompareTo(new JID("[email protected]/baz")));
j = new JID("[email protected]");
Assert.AreEqual(0, j.CompareTo(j));
Assert.AreEqual(0, j.CompareTo(new JID("[email protected]")));
Assert.IsTrue(j == new JID("[email protected]"));
Assert.IsTrue(j == new JID("[email protected]"));
Assert.IsTrue(j == new JID("[email protected]"));
Assert.IsTrue(j == new JID("[email protected]"));
Assert.AreEqual(new JID("[email protected]").GetHashCode(), j.GetHashCode());
j = new JID("bar");
Assert.AreEqual(0, j.CompareTo(j));
Assert.AreEqual(0, j.CompareTo(new JID("bar")));
j = new JID("foo/bar");
Assert.AreEqual(0, j.CompareTo(j));
Assert.AreEqual(0, j.CompareTo(new JID("foo/bar")));
Assert.AreEqual(true, j >= new JID("foo/bar"));
Assert.AreEqual(true, j <= new JID("foo/bar"));
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:22,代码来源:JIDTest.cs
注:本文中的jabber.JID类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论