/// <summary> /// Invite multiple contacts to a chatroom /// </summary> /// <param name="jids"></param> /// <param name="room"></param> /// <param name="reason"></param> public void Invite(Jid[] jids, Jid room, string reason) { Message msg = new Message(); msg.To = room; User user = new User(); foreach (Jid jid in jids) { if (reason != null) user.AddChild(new Invite(jid, reason)); else user.AddChild(new Invite(jid)); } msg.AddChild(user); m_connection.Send(msg); }
/// <summary> /// Change the subject of a room /// </summary> /// <param name="room"></param> /// <param name="newSubject"></param> /// <param name="body"></param> public void ChangeSubject(Jid room, string newSubject, string body) { Message msg = new Message(); msg.Type = MessageType.groupchat; msg.To = room; msg.Subject = newSubject; if (body != null) msg.Body = body; m_connection.Send(msg); }
/// <summary> /// Decline a groupchat invitation /// </summary> /// <param name="to">the jid which invited us</param> /// <param name="room">to room to which we send the decline (this is normally the same room we were invited to)</param> /// <param name="reason">reason why we decline the invitation</param> public void Decline(Jid to, Jid room, string reason) { Message msg = new Message(); msg.To = room; User user = new User(); if (reason != null) user.Decline = new Decline(to, reason); else user.Decline = new Decline(to); msg.AddChild(user); m_connection.Send(msg); }
/// <summary> /// A Message is received. Now check if its from a Jid we are looking for and /// raise the event in this case. /// </summary> /// <param name="sender"></param> /// <param name="msg"></param> private void m_connection_OnMessage(object sender, Message msg) { if (msg == null) return; lock (m_grabbing) { IDictionaryEnumerator myEnum = m_grabbing.GetEnumerator(); while(myEnum.MoveNext()) { TrackerData t = myEnum.Value as TrackerData; if (t.comparer.Compare(new Jid((string)myEnum.Key), msg.From) == 0) { // Execute the callback t.cb(this, msg, t.data); } } } }