本文整理汇总了C#中Jid.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Jid.ToString方法的具体用法?C# Jid.ToString怎么用?C# Jid.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jid
的用法示例。
在下文中一共展示了Jid.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove
/// <summary>
/// Pending request can be removed.
/// This is useful when a ressource for the callback is destroyed and
/// we are not interested anymore at the result.
/// </summary>
/// <param name="id">ID of the Iq we are not interested anymore</param>
public void Remove(Jid jid)
{
lock (m_grabbing)
{
if (m_grabbing.ContainsKey(jid.ToString()))
m_grabbing.Remove(jid.ToString());
}
}
示例2: frmSubscribe
public frmSubscribe(XmppClientConnection con, Jid jid)
{
this.InitializeComponent();
this._connection = con;
this._from = jid;
this.lblFrom.Text = jid.ToString();
}
示例3: Form1
public Form1(XmppClientConnection con)
{
InitializeComponent();
connection = con;
Jid jid_ = new Jid(tb_login.Text, tb_ip.Text, connection.Resource);
jid = jid_.ToString();
}
示例4: Add
/// <summary>
/// Adds the specified jid.
/// </summary>
/// <param name="jid">The jid.</param>
/// <param name="comparer">The comparer.</param>
/// <param name="cb">The callback.</param>
/// <param name="cbArg">The callback Arguments.</param>
public void Add(Jid jid, IComparer comparer, PresenceCB cb, object cbArg)
{
lock (m_grabbing)
{
if (m_grabbing.ContainsKey(jid.ToString()))
return;
}
TrackerData td = new TrackerData();
td.cb = cb;
td.data = cbArg;
td.comparer = comparer;
lock (m_grabbing)
{
m_grabbing.Add(jid.ToString(), td);
}
}
示例5: GetVCard
public override Vcard GetVCard(Jid jid, string id = "")
{
ASCContext.SetCurrentTenant(jid.Server);
jid = new Jid(jid.Bare.ToLowerInvariant());
var ui = ASCContext.UserManager.GetUserByUserName(jid.User);
if (ui != null)
{
var vcard = (Vcard)cache.Get(jid.ToString());
if (vcard != null)
{
return vcard;
}
vcard = new Vcard();
vcard.Name = new Name(ui.LastName, ui.FirstName, null);
vcard.Fullname = UserFormatter.GetUserName(ui);
vcard.Nickname = ui.UserName;
vcard.Description = ui.Notes;
if (ui.BirthDate != null) vcard.Birthday = ui.BirthDate.Value;
vcard.JabberId = jid;
if (ui.Sex.HasValue)
{
vcard.Gender = ui.Sex.Value ? Gender.MALE : Gender.FEMALE;
}
var index = ui.Contacts.FindIndex(c => string.Compare(c, "phone", true) == 0) + 1;
if (0 < index && index < ui.Contacts.Count)
{
vcard.AddTelephoneNumber(new Telephone(TelephoneLocation.WORK, TelephoneType.NUMBER, ui.Contacts[index]));
}
vcard.AddEmailAddress(new Email(EmailType.INTERNET, ui.Email, true));
var tenant = ASCContext.GetCurrentTenant();
var departments = string.Join(", ", CoreContext.UserManager.GetUserGroups(ui.ID).Select(d => HttpUtility.HtmlEncode(d.Name)).ToArray());
if (tenant != null) vcard.Organization = new Organization(tenant.Name, departments);
vcard.Title = ui.Title;
if (id == null || id.IndexOf("tmtalk", StringComparison.OrdinalIgnoreCase) < 0)
{
var image = PreparePhoto(ASCContext.UserManager.GetUserPhoto(ui.ID, Guid.Empty));
if (image != null)
{
vcard.Photo = new Photo(image, ImageFormat.Png);
image.Dispose();
}
}
cache.Insert(jid.ToString(), vcard, CACHE_TIMEOUT);
return vcard;
}
else
{
return base.GetVCard(jid);
}
}
示例6: frmFileTransfer
/// <summary>
/// this constructor is used for outgoing file transfers
/// </summary>
/// <param name="XmppCon"></param>
/// <param name="to"></param>
public frmFileTransfer(XmppClientConnection XmppCon, Jid to)
{
InitializeComponent();
this.Text = "Send File to " + to.ToString();
m_To = to;
m_XmppCon = XmppCon;
// disable commadn buttons we don't need for sending a file
cmdAccept.Enabled = false;
cmdRefuse.Enabled = false;
ChooseFileToSend();
}
示例7: BlockByJid
/// <summary>
/// Block stanzas by Jid
/// </summary>
/// <param name="jidToBlock"></param>
/// <param name="order"></param>
/// <param name="stanza">stanzas you want to block</param>
/// <returns></returns>
public Item BlockByJid(Jid jidToBlock, int order, Stanza stanza)
{
return new Item(Action.deny, order, Type.jid, jidToBlock.ToString(), stanza);
}
示例8: LeaveRoom
/// <summary>
/// Leave a conference room
/// </summary>
/// <param name="room"></param>
/// <param name="nickname"></param>
public void LeaveRoom(Jid room, string nickname)
{
Jid to = new Jid(room.ToString());
to.Resource = nickname;
Presence pres = new Presence();
pres.To = to;
pres.Type = PresenceType.unavailable;
m_connection.Send(pres);
}
示例9: GetStanzaHandlers
public List<IXmppStanzaHandler> GetStanzaHandlers(Jid to, Type stanzaType)
{
try
{
locker.EnterReadLock();
var key = GetHandlerKey(to, stanzaType);
if (stanzaHandlers.ContainsKey(key)) return new List<IXmppStanzaHandler>(stanzaHandlers[key]);
if (to.Resource != null && to.Resource.Contains("/"))
{
var newTo = new Jid(to.ToString());
newTo.Resource = newTo.Resource.Substring(0, newTo.Resource.IndexOf('/'));
key = GetHandlerKey(newTo, stanzaType);
if (stanzaHandlers.ContainsKey(key)) return new List<IXmppStanzaHandler>(stanzaHandlers[key]);
}
key = GetHandlerKey(to.Bare, stanzaType);
if (stanzaHandlers.ContainsKey(key)) return new List<IXmppStanzaHandler>(stanzaHandlers[key]);
key = GetHandlerKey(to.Server, stanzaType);
if (stanzaHandlers.ContainsKey(key)) return new List<IXmppStanzaHandler>(stanzaHandlers[key]);
if (stanzaType != typeof(Stanza)) return GetStanzaHandlers(to, typeof(Stanza));
return new List<IXmppStanzaHandler>();
}
finally
{
locker.ExitReadLock();
}
}
示例10: GetKey
public static string GetKey(Jid jid)
{
return string.Format("{0}/", jid.ToString().ToLowerInvariant());
}
示例11: Main
static void Main(string[] args)
{
XmppClientConnection xmppCon = new XmppClientConnection();
Console.Title = "Console Client";
// read the jid from the console
PrintHelp("Enter you Jid ([email protected]): ");
Jid jid = new Jid(Console.ReadLine());
PrintHelp(String.Format("Enter password for '{0}': ", jid.ToString()));
xmppCon.Password = Console.ReadLine();
xmppCon.Username = jid.User;
xmppCon.Server = jid.Server;
xmppCon.AutoAgents = false;
xmppCon.AutoPresence = true;
xmppCon.AutoRoster = true;
xmppCon.AutoResolveConnectServer = true;
// Connect to the server now
// !!! this is asynchronous !!!
try
{
xmppCon.OnRosterStart += new ObjectHandler(xmppCon_OnRosterStart);
xmppCon.OnRosterItem += new XmppClientConnection.RosterHandler(xmppCon_OnRosterItem);
xmppCon.OnRosterEnd += new ObjectHandler(xmppCon_OnRosterEnd);
xmppCon.OnPresence += new PresenceHandler(xmppCon_OnPresence);
xmppCon.OnMessage += new MessageHandler(xmppCon_OnMessage);
xmppCon.OnLogin += new ObjectHandler(xmppCon_OnLogin);
xmppCon.Open();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Wait("Login to server, please wait");
PrintCommands();
bool bQuit = false;
while (!bQuit)
{
string command = Console.ReadLine();
string[] commands = command.Split(' ');
switch (commands[0].ToLower())
{
case "help":
PrintCommands();
break;
case "quit":
bQuit = true;
break;
case "msg":
string msg = command.Substring(command.IndexOf(commands[2]));
xmppCon.Send(new Message(new Jid(commands[1]), MessageType.chat, msg));
break;
case "status":
switch (commands[1])
{
case "online":
xmppCon.Show = ShowType.NONE;
break;
case "away":
xmppCon.Show = ShowType.away;
break;
case "xa":
xmppCon.Show = ShowType.xa;
break;
case "chat":
xmppCon.Show = ShowType.chat;
break;
}
string status = command.Substring(command.IndexOf(commands[2]));
xmppCon.Status = status;
xmppCon.SendMyPresence();
break;
}
}
// close connection
xmppCon.Close();
}
示例12: AllowByJid
/// <summary>
/// Allow stanzas by Jid
/// </summary>
/// <param name="JidToBlock"> </param>
/// <param name="Order"> </param>
/// <param name="stanza"> stanzas you want to block </param>
/// <returns> </returns>
public Item AllowByJid(Jid JidToBlock, int Order, Stanza stanza)
{
return new Item(Action.allow, Order, Type.jid, JidToBlock.ToString(), stanza);
}
示例13: RegisterPlayer
public void RegisterPlayer(Jid user)
{
if (_registeredPlayers.Any(x => x.ToString() == user.ToString())) return;
_registeredPlayers.Add(user);
}
示例14: BlockByJid
/// <summary>
/// Block stanzas by Jid
/// </summary>
/// <param name="JidToBlock"></param>
/// <param name="Order"></param>
/// <param name="stanza">stanzas you want to block</param>
/// <returns></returns>
public Item BlockByJid(Jid JidToBlock, int Order, Stanza stanza)
{
return new Item(Action.deny, Order, XMPPProtocol.Protocol.iq.privacy.Type.jid, JidToBlock.ToString(), stanza);
}
示例15: RemoveRosterItem
/// <summary>
/// Remove a RosterItem from the roster
/// </summary>
/// <param name="jid">The items Jid to remove</param>
/// <returns
/// >returns true if the item was removed, false if it didn't exist
/// and could not be removed
/// </returns>
public bool RemoveRosterItem(Jid jid)
{
if (m_Roster.ContainsKey(jid.ToString()))
{
RosterData d = m_Roster[jid.ToString()];
TreeNode Parent = d.RosterNode.Parent;
d.RosterNode.Remove();
m_Roster.Remove(jid.ToString());
if (m_HideEmptyGroups)
{
if (Parent.Nodes.Count == 0)
Parent.Remove();
}
return true;
}
else
return false;
}