private void cmdLogin_Click(object sender, EventArgs e) { Jid jid = new Jid(this.txtJid.Text); this._connection.set_Server(jid.get_Server()); this._connection.set_Username(jid.get_User()); this._connection.set_Password(this.txtPassword.Text); this._connection.set_Resource(this.txtResource.Text); this._connection.set_Priority((int) this.numPriority.Value); this._connection.set_Port(int.Parse(this.txtPort.Text)); this._connection.set_UseSSL(this.chkSSL.Checked); this._connection.set_AutoResolveConnectServer(true); this._connection.set_ConnectServer(null); this._connection.set_SocketConnectionType(0); this._connection.set_UseStartTLS(true); if (this.chkRegister.Checked) { this._connection.set_RegisterAccount(true); } else { this._connection.set_RegisterAccount(false); } base.DialogResult = DialogResult.OK; this.SaveSettings(); base.Close(); }
protected override void ProcessRegisterMessage(Jid player) { TournamentManager.RegisterPlayer(player); Connection.Send(new Message(player, new RegistrationCompleteMessage().ToXml())); base.ProcessRegisterMessage(player); }
public Route(Element route, Jid from, Jid to) : this() { RouteElement = route; From = from; To = to; }
public void LeaveRoom(Room room) { _logger.DebugFormat(" LeaveRoom: Id: [{0}] Nickname: [{1}]", room.Id, room.NickName); var jid = new Jid(room.Id); _mucManager.LeaveRoom(jid, room.NickName); RemoveRoomFromGrabbers(jid); }
public MucRoom(Jid jid, string name, MucService mucService, IServiceProvider context) { if (jid == null) { throw new ArgumentNullException("jid"); } if (mucService == null) { throw new ArgumentNullException("mucService"); } if (context == null) { throw new ArgumentNullException("context"); } this.mucService = mucService; this.context = context; Jid = jid; Name = name; members = new MucRoomMemberCollection(mucService.ServiceManager); members.MemberAdded += BroadcastPresencesToMember; members.MemberRemoved += members_MemberRemoved; //Create handler Handlers.Add(new MucRoomStanzaHandler(this)); Handlers.Add(new ServiceDiscoHandler(Jid)); }
public Message(Jid to, string body, string subject) : this() { To = to; Body = body; Subject = subject; }
public Message(string to, string body, string subject) : this() { To = new Jid(to); Body = body; Subject = subject; }
public Form1(XmppClientConnection con) { InitializeComponent(); connection = con; Jid jid_ = new Jid(tb_login.Text, tb_ip.Text, connection.Resource); jid = jid_.ToString(); }
/// <summary> /// /// </summary> /// <param name="sJid">S jid.</param> /// <param name="sPassword">S password.</param> public XmppManager(AuthInfo authInfo, XmppServiceDescription xmppServiceDescription, OTRKeyRing _OTRKeyRing, OpenPGPRing _OpenPGPRing, ConversationManager _conversationManager, AddressBook _addressBook, Logger _logger) { try { m_Logger = _logger; m_OTRKeyRing = _OTRKeyRing; m_OpenPGPRing = _OpenPGPRing; m_AuthInfo = authInfo; m_OwnJid = new Jid (m_AuthInfo.m_sId); m_ClientConnection = new XmppClientConnection(m_OwnJid.Server); m_Contacts = new Dictionary<string, string> (); m_Logger.log(ELogLevel.LVL_INFO, "Trying to log in xmpp user", m_sModuleName); m_ClientConnection.Open(m_OwnJid.User, m_AuthInfo.m_sPassword); m_ConversationManager = _conversationManager; m_AddressBook = _addressBook; m_PresenceManager = new PresenceManager(m_AddressBook); m_OtrConnections = new Dictionary<string, int>(); //register EventHandlers m_ClientConnection.OnLogin += new ObjectHandler(onLogin); m_ClientConnection.OnPresence += new PresenceHandler(OnPresence); } catch(Exception e) { Console.Write (e.Message); } //info: message callback is registered in onRosterItem callback }
public frmSubscribe(XmppClientConnection con, Jid jid) { this.InitializeComponent(); this._connection = con; this._from = jid; this.lblFrom.Text = jid.ToString(); }
/// <summary> /// Initializes a new instance of the Item class. /// </summary> /// <param name="jid">The JID of the item.</param> /// <param name="node">The node identifier of the item.</param> /// <param name="name">The name of the item.</param> /// <exception cref="ArgumentNullException">The jid parameter is /// null.</exception> public XmppItem(Jid jid, string node = null, string name = null) { jid.ThrowIfNull("jid"); Jid = jid; Node = node; Name = name; }
public Element GetPrivate(Jid jid, Element element) { CheckArgs(jid, element); var elementStr = ExecuteScalar<string>(new SqlQuery("jabber_private").Select("element").Where("jid", jid.Bare).Where("tag", element.TagName).Where("namespace", element.Namespace)); return !string.IsNullOrEmpty(elementStr) ? ElementSerializer.DeSerializeElement<Element>(elementStr) : null; }
private void CheckArgs(Jid jid, Element element) { if (jid == null) throw new ArgumentNullException("jid"); if (element == null) throw new ArgumentNullException("element"); if (string.IsNullOrEmpty(element.TagName)) throw new ArgumentNullException("element.TagName"); if (string.IsNullOrEmpty(element.Namespace)) throw new ArgumentNullException("element.Namespace"); }
/// <summary> /// Initializes a new instance of the JidField class for use in a /// requesting dataform. /// </summary> /// <param name="name">The name of the field.</param> /// <param name="required">Determines whether the field is required or /// optional.</param> /// <param name="label">A human-readable name for the field.</param> /// <param name="description">A natural-language description of the field, /// intended for presentation in a user-agent.</param> /// <param name="jid">The default value of the field.</param> /// <exception cref="ArgumentNullException">The name parameter is /// null.</exception> public JidField(string name, bool required = false, string label = null, string description = null, Jid jid = null) : base(DataFieldType.JidSingle, name, required, label, description) { name.ThrowIfNull("name"); Jid = jid; }
public frmFileTransfer(XmppClientConnection XmppCon, IQ iq) { InitializeComponent(); cmdSend.Enabled = false; this.Text = "Receive File from " + iq.From.ToString(); siIq = iq; si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI; // get SID for file transfer m_Sid = si.Id; m_From = iq.From; file = si.File; if (file != null) { m_lFileLength = file.Size; this.lblDescription.Text = file.Description; this.lblFileName.Text = file.Name; this.lblFileSize.Text = HRSize(m_lFileLength); this.txtDescription.Visible = false; } m_XmppCon = XmppCon; this.progress.Maximum = 100; //this.Text += iq.From.ToString(); //this.tbFileSize.Text = FileTransferUtils.ConvertToByteString(m_lFileLength); XmppCon.OnIq += new IqHandler(XmppCon_OnIq); }
public User GetUser(Jid jid) { ASCContext.SetCurrentTenant(jid.Server); var u = ASCContext.UserManager.GetUserByUserName(jid.User); if (Constants.LostUser.Equals(u) || u.Status == EmployeeStatus.Terminated) return null; return ToUser(u, jid.Server); }
public IQ(IqType type, Jid from, Jid to) : this() { this.Type = type; this.From = from; this.To = to; }
private void mnuLogin_Click(object sender, System.EventArgs e) { Jid jid = new Jid(txtJid.Text); _connection.Server = jid.Server; _connection.Username = jid.User; _connection.Password = txtPassword.Text; _connection.Resource = txtResource.Text; _connection.Priority = (int) PriorityUpDown.Value; _connection.Port = int.Parse(txtPort.Text); _connection.UseCompression = false; // SSL is not supported by the CF yet //_connection.UseSSL = false; //_connection.UseStartTLS = true; // Use this property if the connection host is different the the server part in the Jid // e.g. GTalk is doing this //_connection.ConnectServer = "talk.google.com"; _connection.RegisterAccount = chkRegister.Checked; this.DialogResult = DialogResult.OK; SaveSettings(); this.Close(); }
public bool GetMessageLogging(Jid from, Jid to) { if (from == null) throw new ArgumentNullException("from"); if (to == null) throw new ArgumentNullException("to"); return !loggingCache.ContainsKey(GetKey(from, to)); }
public Message(string to, string body, string subject, string thread) : this() { To = new Jid(to); Body = body; Subject = subject; Thread = thread; }
public IEnumerable<IMessage> Read(Guid clientId, Jid with) { var id = clientId.ToString("N"); var withJid = with.Bare.ToLower(); return _dataProvider.ReadMessages(id, withJid) .Select(ToHistoryItem); }
public void Send(Jid to, string b) { Jid from = UserJid; MetroTalkMessage m = new MetroTalkMessage(); // Send a message agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message(); msg.Type = agsXMPP.protocol.client.MessageType.chat; msg.To = to; msg.Body = b; m.To = to; m.Body = b; m.From = from; m.Date = DateTime.Now; if (cm.conversations.ContainsKey(from.Bare)) { IList<MetroTalkMessage> msgs = cm.conversations[from.Bare]; msgs.Add(m); cm.conversations[from.Bare] = msgs; } else { IList<MetroTalkMessage> msgs = new List<MetroTalkMessage>(); msgs.Add(m); cm.conversations.Add(from.Bare, msgs); } cW.RefreshConversation(); xmppCon.Send(msg); }
public FriendControl(XmppClientConnection conn,Jid jid) { XmppConn = conn; MJid = jid; NickName = MJid.User; InitializeComponent(); headImgbak = ResClass.GetImgRes("big194"); bgImg = null; this.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); this.BackColor = Color.Transparent; if (Environment.OSVersion.Version.Major >= 6) { f = new Font("微软雅黑", 9F, FontStyle.Regular); } else { f = new Font("宋体", 9F, FontStyle.Regular); } this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); System.GC.Collect(); }
public Route(Element route, Jid from, Jid to, RouteType type) : this() { RouteElement = route; From = from; To = to; Type = type; }
public frmGroupChat(XmppClientConnection xmppCon, Jid roomJid) { InitializeComponent(); this.rtfSend.Select(); _roomJid = roomJid; _xmppCon = xmppCon; this.groupChatServerLabel.Text = "Room Name: " + _roomJid.User; frmInputBox input = new frmInputBox("Nickname", "Nickname"); if (!Util.GroupChatForms.Contains(roomJid.Bare) && input.ShowDialog() == DialogResult.OK) { _nickname = input.Result; Util.GroupChatForms.Add(roomJid.Bare.ToLower(), this); this.Show(); } else { return; } // Setup new Message Callback _xmppCon.MessageGrabber.Add(roomJid, new BareJidComparer(), new MessageCB(MessageCallback), null); // Setup new Presence Callback _xmppCon.PresenceGrabber.Add(roomJid, new BareJidComparer(), new PresenceCB(PresenceCallback), null); }
/// <summary> /// Fetch message history from the server. /// /// The 'start' and 'end' attributes MAY be specified to indicate a date range. /// /// If the 'with' attribute is omitted then collections with any JID are returned. /// /// If only 'start' is specified then all collections on or after that date should be returned. /// /// If only 'end' is specified then all collections prior to that date should be returned. /// </summary> /// <param name="pageRequest">Paging options</param> /// <param name="start">Optional start date range to query</param> /// <param name="end">Optional enddate range to query</param> /// <param name="with">Optional JID to filter archive results by</param> public XmppPage<ArchivedChatId> GetArchivedChatIds(XmppPageRequest pageRequest, DateTimeOffset? start = null, DateTimeOffset? end = null, Jid with = null) { pageRequest.ThrowIfNull(); var request = Xml.Element("list", xmlns); if (with != null) { request.Attr("with", with.ToString()); } if (start != null) { request.Attr("start", start.Value.ToXmppDateTimeString()); } if (end != null) { request.Attr("end", end.Value.ToXmppDateTimeString()); } var setNode = pageRequest.ToXmlElement(); request.Child(setNode); var response = IM.IqRequest(IqType.Get, null, null, request); if (response.Type == IqType.Error) { throw Util.ExceptionFromError(response, "Failed to get archived chat ids"); } return new XmppPage<ArchivedChatId>(response.Data["list"], GetChatIdsFromStanza); }
public MucMark(Service service) { _jid = service.Jid; _name = service.Name; _time = DateTime.Now; }
public UserRosterItem(Jid jid) { if (jid == null) throw new ArgumentNullException("jid"); Jid = new Jid(jid.Bare.ToLowerInvariant()); Groups = new List<string>(); }
public Utilisateur(Jid _id) { infos = new Infos(_id); ID = _id; WhatAmIDoing = new State(State.Types.Chatting); }
public void RemoveMuc(Jid mucName) { if (Jid.IsNullOrEmpty(mucName)) throw new ArgumentNullException("mucName"); ExecuteNonQuery(new SqlDelete("jabber_room").Where("jid", mucName.Bare)); RemoveMucMessages(mucName); }
/// <summary> /// Publish a payload to a Node /// </summary> /// <param name="to"></param> /// <param name="from"></param> /// <param name="node"></param> /// <param name="payload"></param> /// <param name="cb"></param> public void PublishItem(Jid to, Jid from, string node, Item payload, IqCB cb) { PublishItem(to, from, node, payload, cb, null); }
public void Subscribe(Jid to, Jid subscribe, string node, IqCB cb) { Subscribe(to, null, subscribe, node, cb, null); }
/* * <iq type="set" * from="[email protected]/home" * to="pubsub.jabber.org" * id="sub1"> * <pubsub xmlns="http://jabber.org/protocol/pubsub"> * <subscribe * node="generic/pgm-mp3-player" * jid="*****@*****.**"/> * </pubsub> * </iq> */ /// <summary> /// /// </summary> /// <param name="to">Jid of the Publish Subscribe Service</param> /// <param name="subscribe">Jid which should be subscribed</param> /// <param name="node">node to which we want to subscribe</param> public void Subscribe(Jid to, Jid subscribe, string node) { Subscribe(to, null, subscribe, node, null, null); }
/* * Example 6. Client requests an instant node * * <iq type="set" * from="*****@*****.**" * to="pubsub.jabber.org" * id="create2"> * <pubsub xmlns="http://jabber.org/protocol/pubsub"> * <create/> * </pubsub> * </iq> */ public void CreateInstantNode(Jid to) { CreateInstantNode(to, null, null, null); }
public void RetractItem(Jid to, Jid from, string node, string id, IqCB cb) { RetractItem(to, from, node, id, cb, null); }
public void RetractItem(Jid to, Jid from, string node, string id) { RetractItem(to, from, node, id, null, null); }
public void RetractItem(Jid to, string node, string id, IqCB cb, object cbArgs) { RetractItem(to, null, node, id, cb, cbArgs); }
/* * Example 9. Entity publishes an item with an ItemID * * <iq type="set" * from="*****@*****.**" * to="pubsub.jabber.org" * id="publish1"> * <pubsub xmlns="http://jabber.org/protocol/pubsub"> * <publish node="generic/pgm-mp3-player"> * <item id="current"> * <tune xmlns="http://jabber.org/protocol/tune"> * <artist>Ralph Vaughan Williams</artist> * <title>Concerto in F for Bass Tuba</title> * <source>Golden Brass: The Collector's Edition</source> * </tune> * </item> * </publish> * </pubsub> * </iq> */ /// <summary> /// Publish a payload to a Node /// </summary> /// <param name="to"></param> /// <param name="node"></param> /// <param name="payload"></param> public void PublishItem(Jid to, string node, Item payload) { PublishItem(to, null, node, payload, null, null); }
public void PurgeNode(Jid to, Jid from, string node) { PurgeNode(to, from, node, null, null); }
/// <summary> /// Publish a payload to a Node /// </summary> /// <param name="to"></param> /// <param name="node"></param> /// <param name="payload"></param> /// <param name="cb"></param> /// <param name="cbArgs"></param> public void PublishItem(Jid to, string node, Item payload, IqCB cb, object cbArgs) { PublishItem(to, null, node, payload, cb, cbArgs); }
public void PurgeNode(Jid to, string node, IqCB cb) { PurgeNode(to, null, node, cb, null); }
public void PurgeNode(Jid to, Jid from, string node, IqCB cb) { PurgeNode(to, from, node, cb, null); }
public void DeleteNode(Jid to, Jid from, string node, IqCB cb) { DeleteNode(to, from, node, cb, null); }
public void PurgeNode(Jid to, string node, IqCB cb, object cbArgs) { PurgeNode(to, null, node, cb, cbArgs); }
public void DeleteNode(Jid to, string node, IqCB cb, object cbArgs) { DeleteNode(to, null, node, cb, cbArgs); }
/* * Example 139. Owner purges all items from a node * * <iq type='set' * from='[email protected]/elsinore' * to='pubsub.shakespeare.lit' * id='purge1'> * <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> * <purge node='blogs/princely_musings'/> * </pubsub> * </iq> */ public void PurgeNode(Jid to, string node) { PurgeNode(to, null, node, null, null); }
/* * Example 133. Owner deletes a node * * <iq type='set' * from='[email protected]/elsinore' * to='pubsub.shakespeare.lit' * id='delete1'> * <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> * <delete node='blogs/princely_musings'/> * </pubsub> * </iq> */ public void DeleteNode(Jid to, string node) { DeleteNode(to, null, node, null, null); }
public void DeleteNode(Jid to, Jid from, string node) { DeleteNode(to, from, node, null, null); }
public void CreateCollectionNode(Jid to, string node, bool defaultConfig, IqCB cb, object cbArgs) { CreateCollectionNode(to, null, node, defaultConfig, cb, cbArgs); }
public void DeleteNode(Jid to, string node, IqCB cb) { DeleteNode(to, null, node, cb, null); }
public void CreateNode(Jid to, string node, bool defaultConfig, IqCB cb) { CreateNode(to, null, node, defaultConfig, cb, null); }
public void CreateCollectionNode(Jid to, Jid from, string node, bool defaultConfig, IqCB cb) { CreateCollectionNode(to, from, node, defaultConfig, cb, null); }
public void OwnerModifyAffiliations(Jid to, Jid from, string node, owner.Affiliate[] affiliates, IqCB cb) { OwnerModifyAffiliations(to, from, node, affiliates, cb, null); }
/* * To create a new collection node, the requesting entity MUST specify a type of "collection" when asking the service to create the node. [20] * * Example 185. Entity requests a new collection node * * <iq type='set' * from='[email protected]/globe' * to='pubsub.shakespeare.lit' * id='create3'> * <pubsub xmlns='http://jabber.org/protocol/pubsub'> * <create node='announcements' type='collection'/> * </pubsub> * </iq> * * Example 186. Service responds with success * * <iq type='result' * from='pubsub.shakespeare.lit' * to='[email protected]/globe' * id='create3'/> * */ public void CreateCollectionNode(Jid to, string node, bool defaultConfig) { CreateCollectionNode(to, null, node, defaultConfig, null, null); }
/* * Owner modifies a single affiliation * * <iq type='set' * from='[email protected]/elsinore' * to='pubsub.shakespeare.lit' * id='ent2'> * <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> * <affiliates node='blogs/princely_musings'/> * <affiliate jid='*****@*****.**' affiliation='owner'/> * <affiliate jid='*****@*****.**' affiliation='none'/> * <affiliate jid='*****@*****.**' affiliation='publisher'/> * </affiliates> * </pubsub> * </iq> */ public void OwnerModifyAffiliations(Jid to, string node, owner.Affiliate[] affiliates) { OwnerModifyAffiliations(to, null, node, affiliates, null, null); }
/// <summary> /// Create a Node /// </summary> /// <param name="to"></param> /// <param name="from"></param> /// <param name="defaultConfig"></param> public void CreateNode(Jid to, Jid from, string node, bool defaultConfig) { CreateNode(to, from, node, defaultConfig, null, null); }
public void OwnerModifyAffiliation(Jid to, Jid from, string node, Jid affiliate, AffiliationType affiliation, IqCB cb) { OwnerModifyAffiliation(to, from, node, affiliate, affiliation, cb, null); }
public void OwnerModifyAffiliations(Jid to, string node, owner.Affiliate[] affiliates, IqCB cb, object cbArgs) { OwnerModifyAffiliations(to, null, node, affiliates, cb, cbArgs); }
public void OwnerModifyAffiliation(Jid to, string node, Jid affiliate, AffiliationType affiliation, IqCB cb, object cbArgs) { OwnerModifyAffiliation(to, null, node, affiliate, affiliation, cb, cbArgs); }
public void CreateNode(Jid to, Jid from, string node) { CreateNode(to, from, node, true, null, null); }