예제 #1
0
        private void ShowInvitationForm(RoomInvitationReceivedForm Form, RoomInvitationMessageEventArgs e, RoomInformationEventArgs e2)
        {
            bool?b = Form.ShowDialog();

            if (b.HasValue)
            {
                if (b.Value)
                {
                    e.Accept(Form.NickName.Text, (sender2, e3) =>
                    {
                        if (!e3.Ok)
                        {
                            MainWindow.UpdateGui(() =>
                            {
                                MessageBox.Show(MainWindow.currentInstance,
                                                string.IsNullOrEmpty(e3.ErrorText) ? "Unable to process invitation." : e3.ErrorText,
                                                "Error", MessageBoxButton.OK, MessageBoxImage.Error);

                                RoomInvitationReceivedForm Form2 = new RoomInvitationReceivedForm()
                                {
                                    Owner             = MainWindow.currentInstance,
                                    InviteTo          = XmppClient.GetBareJID(e.To),
                                    InviteFrom        = XmppClient.GetBareJID(e.InviteFrom),
                                    InvitationReason  = e.Reason,
                                    RoomName          = Form.RoomName,
                                    RoomJid           = e.RoomId + "@" + e.Domain,
                                    MembersOnly       = e2.MembersOnly,
                                    Moderated         = e2.Moderated,
                                    NonAnonymous      = e2.NonAnonymous,
                                    Open              = e2.Open,
                                    PasswordProtected = e2.PasswordProtected,
                                    Persistent        = e2.Persistent,
                                    Public            = e2.Public,
                                    SemiAnonymous     = e2.SemiAnonymous,
                                    Temporary         = e2.Temporary,
                                    Unmoderated       = e2.Unmoderated,
                                    Unsecured         = e2.Unsecured
                                };

                                this.ShowInvitationForm(Form2, e, e2);
                            });
                        }

                        return(Task.CompletedTask);
                    }, null);
                }
                else
                {
                    e.Decline(Form.Reason.Text);
                }
            }
        }
예제 #2
0
        private Task MucClient_RoomInvitationReceived(object Sender, RoomInvitationMessageEventArgs e)
        {
            RoomInvitationReceivedForm Form = new RoomInvitationReceivedForm()
            {
                Owner            = MainWindow.currentInstance,
                InviteTo         = XmppClient.GetBareJID(e.To),
                InviteFrom       = XmppClient.GetBareJID(e.InviteFrom),
                InvitationReason = e.Reason,
                RoomName         = e.RoomId,
                RoomJid          = e.RoomId + "@" + e.Domain
            };

            this.mucClient.GetRoomInformation(e.RoomId, e.Domain, (sender2, e2) =>
            {
                if (e2.Ok)
                {
                    foreach (Identity Id in e2.Identities)
                    {
                        if (Id.Category == "conference" && Id.Type == "text")
                        {
                            Form.RoomName = Id.Name;
                            break;
                        }
                    }

                    Form.MembersOnly       = e2.MembersOnly;
                    Form.Moderated         = e2.Moderated;
                    Form.NonAnonymous      = e2.NonAnonymous;
                    Form.Open              = e2.Open;
                    Form.PasswordProtected = e2.PasswordProtected;
                    Form.Persistent        = e2.Persistent;
                    Form.Public            = e2.Public;
                    Form.SemiAnonymous     = e2.SemiAnonymous;
                    Form.Temporary         = e2.Temporary;
                    Form.Unmoderated       = e2.Unmoderated;
                    Form.Unsecured         = e2.Unsecured;
                }

                MainWindow.UpdateGui(() =>
                {
                    this.ShowInvitationForm(Form, e, e2);
                });

                return(Task.CompletedTask);
            }, null);

            return(Task.CompletedTask);
        }