Beispiel #1
0
        protected virtual void OnPersonsRowActivated(object sender, Gtk.RowActivatedArgs e)
        {
            Trace.Call(sender, e);

            IList <PersonModel> persons = GetSelectedPersons();

            if (persons == null)
            {
                return;
            }

            // this is a generic implemention that should be able to open/create
            // a private chat in most cases, as it depends what OpenChat()
            // of the specific protocol actually expects/needs
            foreach (PersonModel person in persons)
            {
                PersonChatModel personChat = new PersonChatModel(
                    person,
                    person.ID,
                    person.IdentityName,
                    null
                    );

                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        ChatModel.ProtocolManager.OpenChat(
                            Frontend.FrontendManager,
                            personChat
                            );
                    } catch (Exception ex) {
                        Frontend.ShowException(ex);
                    }
                });
            }
        }
Beispiel #2
0
        public XmppPersonChatView(PersonChatModel personChat) : base(personChat)
        {
            Trace.Call(personChat);

            OutputMessageTextView.PopulatePopup += _OnOutputMessageTextViewPopulatePopup;
            ChatStateStartPosition = new Gtk.TextMark("ChatStateStartPosition", true);
            IsDisposed             = false;
        }
Beispiel #3
0
        public PersonChatView(PersonChatModel chat) : base(chat)
        {
            Trace.Call(chat);

            PersonChatModel = chat;

            Add(OutputScrolledWindow);
        }
Beispiel #4
0
        public IrcPersonChatView(PersonChatModel personChat) : base(personChat)
        {
            Trace.Call(personChat);

            OutputMessageTextView.PopulatePopup += OnOutputMessageTextViewPopulatePopup;
        }
Beispiel #5
0
 public TwitterPersonChatView(PersonChatModel personChat) : base(personChat)
 {
     Trace.Call(personChat);
 }
Beispiel #6
0
        protected virtual void OnPersonsRowActivated(object sender, Gtk.RowActivatedArgs e)
        {
            Trace.Call(sender, e);

            IList <PersonModel> persons = GetSelectedPersons();

            if (persons == null || persons.Count == 0)
            {
                return;
            }

            var protocolManager = ProtocolManager;

            if (protocolManager == null)
            {
#if LOG4NET
                _Logger.WarnFormat(
                    "{0}.OnPersonsRowActivated(): ProtocolManager is null, " +
                    "bailing out!", this
                    );
#endif
                return;
            }

            // jump to person chat if available
            foreach (var chatView in Frontend.MainWindow.ChatViewManager.Chats)
            {
                if (!(chatView is PersonChatView))
                {
                    continue;
                }
                var personChatView = (PersonChatView)chatView;
                if (personChatView.PersonModel == persons[0])
                {
                    Frontend.MainWindow.ChatViewManager.CurrentChatView = personChatView;
                    return;
                }
            }

            // this is a generic implemention that should be able to open/create
            // a private chat in most cases, as it depends what OpenChat()
            // of the specific protocol actually expects/needs
            foreach (PersonModel person in persons)
            {
                PersonChatModel personChat = new PersonChatModel(
                    person,
                    person.ID,
                    person.IdentityName,
                    null
                    );

                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        protocolManager.OpenChat(
                            Frontend.FrontendManager,
                            personChat
                            );
                    } catch (Exception ex) {
                        Frontend.ShowException(ex);
                    }
                });
            }
        }
Beispiel #7
0
        protected virtual void OnChatOpenChatButtonClicked(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            try {
                OpenChatDialog dialog = new OpenChatDialog(this);
                int            res    = dialog.Run();

                var chatView = Notebook.CurrentChatView;
                if (chatView == null)
                {
                    return;
                }

                // FIXME: REMOTING CALL
                var manager = chatView.ChatModel.ProtocolManager;
                if (manager == null)
                {
                    return;
                }
                ChatModel chat;
                switch (dialog.ChatType)
                {
                case ChatType.Group:
                    chat = new GroupChatModel(
                        dialog.ChatName,
                        dialog.ChatName,
                        null
                        );
                    break;

                case ChatType.Person:
                    chat = new PersonChatModel(
                        null,
                        dialog.ChatName,
                        dialog.ChatName,
                        null
                        );
                    break;

                default:
                    throw new ApplicationException(
                              String.Format(
                                  _("Unknown ChatType: {0}"),
                                  dialog.ChatType
                                  )
                              );
                }

                dialog.Destroy();
                if (res != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        manager.OpenChat(Frontend.FrontendManager, chat);
                    } catch (Exception ex) {
                        Frontend.ShowException(this, ex);
                    }
                });
            } catch (Exception ex) {
                Frontend.ShowException(this, ex);
            }
        }