コード例 #1
0
 internal void CreateClient()
 {
     if (!string.IsNullOrWhiteSpace(this.tagProfile.MucJid))
     {
         this.mucClient = this.neuronService.CreateMultiUserChatClient();
         this.OnConnectionStateChanged(new ConnectionStateChangedEventArgs(GetState(), false));
     }
 }
コード例 #2
0
 internal void DestroyClient()
 {
     if (!(this.mucClient is null))
     {
         this.mucClient.Dispose();
         this.mucClient = null;
         this.OnConnectionStateChanged(new ConnectionStateChangedEventArgs(GetState(), false));
     }
 }
コード例 #3
0
		/// <summary>
		/// Message from a MUC room containing an invitation.
		/// </summary>
		/// <param name="MucClient">Multi-User Chat Client.</param>
		/// <param name="e">Message event arguments.</param>
		/// <param name="RoomId">Room ID</param>
		/// <param name="Domain">Domain hosting the room.</param>
		/// <param name="InviteFrom">JID of entity sending the invitation.</param>
		/// <param name="Reason">Reason for invitation.</param>
		/// <param name="Password">Password, if used.</param>
		public RoomInvitationMessageEventArgs(MultiUserChatClient MucClient, MessageEventArgs e, string RoomId, string Domain, 
			string InviteFrom, string Reason, string Password)
			: base(e, RoomId, Domain)
		{
			this.mucClient = MucClient;
			this.inviteFrom = InviteFrom;
			this.reason = Reason;
			this.password = Password;
		}
コード例 #4
0
 /// <summary>
 /// Message from a MUC room containing an invitation.
 /// </summary>
 /// <param name="MucClient">Multi-User Chat Client.</param>
 /// <param name="e">Message event arguments.</param>
 /// <param name="RoomId">Room ID</param>
 /// <param name="Domain">Domain hosting the room.</param>
 /// <param name="Reason">Reason for invitation.</param>
 /// <param name="Password">Password, if used.</param>
 /// <param name="Continuation">If the invitation is a continuation of a private thread.</param>
 /// <param name="ThreadId">Thread Id being continued.</param>
 public DirectInvitationMessageEventArgs(MultiUserChatClient MucClient, MessageEventArgs e, string RoomId, string Domain,
                                         string Reason, string Password, bool Continuation, string ThreadId)
     : base(e, RoomId, Domain)
 {
     this.mucClient    = MucClient;
     this.reason       = Reason;
     this.password     = Password;
     this.threadId     = ThreadId;
     this.continuation = Continuation;
 }
コード例 #5
0
ファイル: MucOccupant.cs プロジェクト: iamr8/IoTGateway
 /// <summary>
 /// Multi-User Chat room occupant.
 /// </summary>
 /// <param name="Client">MUC Client</param>
 /// <param name="RoomId">Room ID</param>
 /// <param name="Domain">Domain hosting the MUC room.</param>
 /// <param name="NickName">Nick-name</param>
 /// <param name="Jid">JID</param>
 /// <param name="Affiliation">Affiliation</param>
 /// <param name="Role">Role</param>
 public MucOccupant(MultiUserChatClient Client, string RoomId, string Domain,
                    string NickName, string Jid, Affiliation Affiliation, Role Role)
 {
     this.client      = Client;
     this.roomId      = RoomId;
     this.domain      = Domain;
     this.nickName    = NickName;
     this.jid         = Jid;
     this.affiliation = Affiliation;
     this.role        = Role;
 }
コード例 #6
0
ファイル: MucService.cs プロジェクト: iamr8/IoTGateway
        public MucService(TreeNode Parent, string JID, string Name, string Node, Dictionary <string, bool> Features,
                          MultiUserChatClient MucClient)
            : base(Parent, JID, Name, Node, Features)
        {
            this.mucClient = MucClient;

            this.children = new SortedDictionary <string, TreeNode>()
            {
                { string.Empty, new Loading(this) }
            };

            this.mucClient.OccupantPresence               += MucClient_OccupantPresence;
            this.mucClient.OccupantRequest                += MucClient_OccupantRequest;
            this.mucClient.PrivateMessageReceived         += MucClient_PrivateMessageReceived;
            this.mucClient.RegistrationRequest            += MucClient_RegistrationRequest;
            this.mucClient.RoomDeclinedInvitationReceived += MucClient_RoomDeclinedInvitationReceived;
            this.mucClient.RoomDestroyed          += MucClient_RoomDestroyed;
            this.mucClient.RoomInvitationReceived += MucClient_RoomInvitationReceived;
            this.mucClient.RoomMessage            += MucClient_RoomMessage;
            this.mucClient.RoomOccupantMessage    += MucClient_RoomOccupantMessage;
            this.mucClient.RoomPresence           += MucClient_RoomPresence;
            this.mucClient.RoomSubject            += MucClient_RoomSubject;
            this.handlersAdded = true;
        }
コード例 #7
0
        /// <summary>
        /// Adds the extension to the client.
        /// </summary>
        /// <param name="Instance">Actor instance.</param>
        /// <param name="Client">XMPP Client</param>
        /// <returns>Extension object.</returns>
        public override Task <object> Add(IActor Instance, Waher.Networking.XMPP.XmppClient Client)
        {
            MultiUserChatClient Extension = new MultiUserChatClient(Client, this.componentAddress);

            Client.SetTag("MUC", Extension);

            Extension.OccupantPresence += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "OccupantPresence",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.OccupantRequest += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "OccupantRequest",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.PrivateMessageReceived += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "PrivateMessageReceived",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RegistrationRequest += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RegistrationRequest",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomDeclinedInvitationReceived += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomDeclinedInvitationReceived",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomDestroyed += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomDestroyed",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomInvitationReceived += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomInvitationReceived",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomMessage += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomMessage",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomOccupantMessage += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomOccupantMessage",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomPresence += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomPresence",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            Extension.RoomSubject += (Sender, e) =>
            {
                this.Model.ExternalEvent(Instance, "RoomSubject",
                                         new KeyValuePair <string, object>("e", e),
                                         new KeyValuePair <string, object>("Client", Client));

                return(Task.CompletedTask);
            };

            return(Task.FromResult <object>(Extension));
        }