public ChatRoomInvitationDialog(Network network, Node inviteFrom, ChatRoom room, ChatInviteInfo invitation)
            : base("ChatRoomInvitationDialog")
        {
            this.room = room;
            this.invitation = invitation;

            descLabel.Markup = String.Format(descLabel.Text, GLib.Markup.EscapeText(inviteFrom.ToString()), GLib.Markup.EscapeText(room.Name));

            messageContainer.Visible = !String.IsNullOrEmpty(invitation.Message);
            messageLabel.Text = GLib.Markup.EscapeText(invitation.Message);

            passwordInfoBox.Visible = room.HasPassword;

            passwordEntry.Text = invitation.Password;
            showPasswordCheck.Visible = !String.IsNullOrEmpty(invitation.Password);

            Validate();
        }
Пример #2
0
 public Message CreateChatInviteMessage(Node messageTo, ChatRoom room, string message, string password)
 {
     Message p = new Message(network, MessageType.ChatInvite);
     p.To = messageTo.NodeID;
     ChatInviteInfo c = new ChatInviteInfo();
     c.RoomId = room.Id;
     c.RoomName = room.Name;
     c.Message = message;
     c.Password = password;
     p.Content = c;
     return p;
 }
Пример #3
0
 internal void RaiseReceivedChatInvite(Node from, ChatInviteInfo invitation)
 {
     if (ReceivedChatInvite != null) {
         if (chatRooms.ContainsKey(invitation.RoomId)) {
             ChatRoom room = chatRooms[invitation.RoomId];
             ReceivedChatInvite(this, from, room, invitation);
         } else {
             LoggingService.LogWarning("Ignored invitation for non-existent chatroom: {0}", invitation.RoomName);
         }
     }
 }
Пример #4
0
        /*
        private void network_FileOffered (Network network, FileOfferedEventArgs args)
        {
            try {
                LogManager.Current.WriteToLog (args.From.NickName + " offers to send you " + args.File.FileName);

                MessageDialog dialog = new MessageDialog (null,
                        DialogFlags.Modal,
                        Gtk.MessageType.Question,
                        ButtonsType.YesNo,
                        "{0} would like to send you the following file:\n\n{1}\n\nDo you want to accept it?",
                        args.From.ToString(),
                        args.File.FileName);

                dialog.Show ();

                if (dialog.Run() == (int)Gtk.ResponseType.Yes) {
                    //network.DownloadFile (args.From, args.File.FileFullPath, args.File.File.Size);
                }

                dialog.Destroy ();
            } catch (Exception ex) {
                LoggingService.LogError(ex);
                Gui.ShowErrorDialog (ex.ToString(), Gui.MainWindow.Window);
            }
        }
        */
        private void network_ReceivedChatInvite(Network network, Node inviteFrom, ChatRoom room, ChatInviteInfo invitation)
        {
            try {
                ChatRoomInvitationDialog dialog = new ChatRoomInvitationDialog (network, inviteFrom, room, invitation);
                dialog.Show ();
            } catch (Exception ex) {
                LoggingService.LogError(ex);
                Gui.ShowErrorDialog (ex.ToString(), Gui.MainWindow.Window);
            }
        }
Пример #5
0
 internal void ProcessChatInviteMessage(Node messageFrom, ChatInviteInfo invitation)
 {
     if (network.HasChatRoom(invitation.RoomId)) {
         ChatRoom room = network.GetChatRoom(invitation.RoomId);
         if (room.Users.ContainsKey(messageFrom.NodeID)) {
             network.RaiseReceivedChatInvite (messageFrom, invitation);
         } else {
             network.SendNonCriticalError (messageFrom, new MeshworkError("you tried to invite me to a chatroom that you arent in! shame on you!"));
         }
     } else {
         network.SendNonCriticalError (messageFrom, new MeshworkError("you tried to invite me to a chatroom that doesnt exit! shame on you!"));
     }
 }