コード例 #1
0
ファイル: ChatView.cs プロジェクト: tuukka/smuxi
        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;
            _Name = _ChatModel.Name;
            ID = _ChatModel.ID;
            Name = _Name;

            MessageTextView tv = new MessageTextView();
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.ShowTimestamps = true;
            tv.ShowMarkerline = true;
            tv.Editable = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.MessageAdded += OnMessageTextViewMessageAdded;
            tv.MessageHighlighted += OnMessageTextViewMessageHighlighted;
            tv.PopulatePopup += OnMessageTextViewPopulatePopup;
            _OutputMessageTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Add(_OutputMessageTextView);
            _OutputScrolledWindow = sw;

            // popup menu
            _TabMenu = new Gtk.Menu();

            Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);
            close_item.Activated += new EventHandler(OnTabMenuCloseActivated);
            _TabMenu.Append(close_item);

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();
            _TabLabel.Text = _Name;

            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();

            _ThemeSettings = new ThemeSettings();

            // OPT-TODO: this should use a TaskStack instead of TaskQueue
            _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+_Name+")");
            _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent;
            _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent;
        }
コード例 #2
0
ファイル: TestUI.cs プロジェクト: RoninBG/smuxi
        public void AddChat(ChatModel page)
        {
            Trace.Call(page);

            Console.WriteLine("New page: "+page.Name+ " type: "+page.ChatType);
            Frontend.ChangeActiveChat(page);
        }
コード例 #3
0
ファイル: ChatViewManager.cs プロジェクト: RoninBG/smuxi
        public override void AddChat(ChatModel chat)
        {
            ChatView chatView = (ChatView) CreateChatView(chat);
            chatView.MainWindow = _MainWindow;
            _ChatViews.Add(chat, chatView);

            _ActiveChat = chatView;
        }
コード例 #4
0
ファイル: ProtocolChatView.cs プロジェクト: carlosmn/smuxi
        public ProtocolChatView(ChatModel chat)
            : base(chat)
        {
            Trace.Call(chat);

            Add(OutputScrolledWindow);

            ShowAll();
        }
コード例 #5
0
ファイル: ChatView.cs プロジェクト: RAOF/smuxi
        public ChatView(ChatModel chat, MainWindow window)
        {
            Trace.Call(chat, window);

            if (chat == null) {
                throw new ArgumentNullException("chat");
            }
            if (window == null) {
                throw new ArgumentNullException("window");
            }

            ChatModel = chat;
            f_MainWindow = window;
            f_WidgetID = f_NextID++;
            f_WidgetName = "output_textview_" + f_WidgetID;

            f_MainWindow.Modify("output_vbox", "append",
                "{" +
                    "textview[" + f_WidgetName + "] " +
                        ".expand:vh " +
                        ".display[" + f_WidgetID + "d]:0 " +
                        "offset[" + f_WidgetID + "os]:0 " +
                        "richtext:1 " +
                        "style_color0_normal:fg=black " +
                        "style_color1_normal:fg=red " +
                        "style_color2_normal:fg=green " +
                        "style_color3_normal:fg=yellow " +
                        "style_color4_normal:fg=blue " +
                        "style_color5_normal:fg=magenta " +
                        "style_color6_normal:fg=cyan " +
                        "style_color7_normal:fg=white " +
                        "style_color8_normal:fg=black,attr=bold " +
                        "style_color9_normal:fg=red,attr=bold " +
                        "style_color10_normal:fg=green,attr=bold " +
                        "style_color11_normal:fg=yellow,attr=bold " +
                        "style_color12_normal:fg=blue,attr=bold " +
                        "style_color13_normal:fg=magenta,attr=bold " +
                        "style_color14_normal:fg=cyan,attr=bold " +
                        "style_color15_normal:fg=white,attr=bold " +
                        "style_url_normal:attr=underline " +
                        "style_u_normal:attr=underline " +
                        "style_b_normal:attr=bold " +
                        "style_i_normal:attr=standout " +
                "}"
            );
            MessageTextView = new TextView(f_MainWindow, f_WidgetName);
            MessageTextView.OffsetVariableName = f_WidgetID + "os";
            // HACK: as the chat is not always visible we can't extract the
            // heigth and width information from the textview because it simply
            // returns 0 when invisible, thus we need to abuse output_vbox
            MessageTextView.HeigthVariableName = "output_vbox:h";
            MessageTextView.WidthVariableName = "output_vbox:w";
            MessageTextView.AutoLineWrap = true;

            Participants = new List<PersonModel>();
        }
コード例 #6
0
ファイル: SessionChatView.cs プロジェクト: carlosmn/smuxi
        public SessionChatView(ChatModel chat)
            : base(chat)
        {
            Trace.Call(chat);

            OutputMessageTextView.ShowMarkerline = false;
            OutputMessageTextView.ShowTimestamps = false;

            Add(OutputScrolledWindow);
        }
コード例 #7
0
 public ChatViewAddedEventArgs(ChatModel chatModel, string chatId,
                               ChatType chatType, int chatPosition,
                               Type protocolManagerType)
 {
     ChatModel = chatModel;
     ChatID = chatId;
     ChatType = chatType;
     ChatPosition = chatPosition;
     ProtocolManagerType = protocolManagerType;
 }
コード例 #8
0
ファイル: GnomeUI.cs プロジェクト: flugsio/smuxi
        public void AddChat(ChatModel chat)
        {
            TraceRemotingCall(chat);

            try {
                _ChatViewManager.AddChat(chat);
            } catch (Exception ex) {
                Frontend.ShowException(ex);
            }
        }
コード例 #9
0
ファイル: ChatView.cs プロジェクト: meebey/smuxi
        protected ChatView(ChatModel chat)
        {
            _ChatModel = chat;

            InitializeComponent();

            Name = chat.Name;
            Text = chat.Name;

            _OutputTextView.SelectionChanged += new EventHandler(OutputSelectionChanged);
        }
コード例 #10
0
ファイル: ChatViewManager.cs プロジェクト: RoninBG/smuxi
        public override void AddChat(ChatModel chat)
        {
            ChatView chatView = (ChatView) CreateChatView(chat);
            f_Chats.Add(chatView);

            if (f_Config != null) {
                chatView.ApplyConfig(f_Config);
            }

            f_Notebook.TabPages.Add(chatView);
        }
コード例 #11
0
ファイル: StflUI.cs プロジェクト: pacificIT/smuxi
        public void AddChat(ChatModel chat)
        {
            Trace.Call(chat);

            try {
                _ChatViewManager.AddChat(chat);
            } catch (Exception ex) {
            #if LOG4NET
                _Logger.Fatal(ex);
            #endif
            }
        }
コード例 #12
0
        public ProtocolManagerHookCommand(ProtocolManagerBase protocolManager,
                                          ChatModel chat,
                                          string commandCharacter)
        {
            if (protocolManager == null) {
                throw new ArgumentNullException("protocolManager");
            }

            ProtocolManager = protocolManager;
            Chat = chat;
            CommandCharacter = commandCharacter;
            CommandName = "ProtocolManager.Command";
        }
コード例 #13
0
ファイル: SessionHookCommand.cs プロジェクト: pacificIT/smuxi
        public SessionHookCommand(Session session,
                                  ChatModel chat,
                                  string commandCharacter)
        {
            if (session == null) {
                throw new ArgumentNullException("session");
            }

            Session = session;
            Chat = chat;
            CommandCharacter = commandCharacter;
            CommandName = "Session.Command";
        }
コード例 #14
0
ファイル: SessionChatView.cs プロジェクト: tuukka/smuxi
        public SessionChatView(ChatModel chat)
            : base(chat)
        {
            Trace.Call(chat);

            OutputMessageTextView.ShowMarkerline = false;

            var tabImage = new Gtk.Image(IconPixbuf);
            TabHBox.PackStart(tabImage, false, false, 2);
            TabHBox.ShowAll();

            Add(OutputScrolledWindow);
        }
コード例 #15
0
ファイル: ProtocolChatView.cs プロジェクト: tuukka/smuxi
        public ProtocolChatView(ChatModel chat)
            : base(chat)
        {
            Trace.Call(chat);

            var tabImage = new Gtk.Image(IconPixbuf);
            TabHBox.PackStart(tabImage, false, false, 2);
            TabHBox.ShowAll();

            Add(OutputScrolledWindow);

            ShowAll();
        }
コード例 #16
0
ファイル: StflUI.cs プロジェクト: tuukka/smuxi
        public void AddMessageToChat(ChatModel chat, MessageModel msg)
        {
            Trace.Call(chat, msg);

            ChatView chatView = _ChatViewManager.GetChat(chat);
            #if LOG4NET
            if (chatView == null) {
                _Logger.Fatal(String.Format("AddMessageToChat(): _ChatViewManager.GetChat(chat) chat.Name: {0} returned null!", chat.Name));
                return;
            }
            #endif
            chatView.AddMessage(msg);
        }
コード例 #17
0
ファイル: GnomeUI.cs プロジェクト: tuukka/smuxi
        public void AddChat(ChatModel chat)
        {
            TraceRemotingCall(chat);

            MethodBase mb = Trace.GetMethodBase();
            Gtk.Application.Invoke(delegate {
                TraceRemotingCall(mb, chat);

                try {
                    _ChatViewManager.AddChat(chat);
                } catch (Exception ex) {
                    Frontend.ShowException(ex);
                }
            });
        }
コード例 #18
0
ファイル: PersonChatView.cs プロジェクト: RoninBG/smuxi
        public PersonChatView(ChatModel chat)
            : base(chat)
        {
            Trace.Call(chat);

            _TabImage = new Gtk.Image(
                new Gdk.Pixbuf(
                    null,
                    "person-chat.svg",
                    16,
                    16
                )
            );

            TabHBox.PackStart(_TabImage, false, false, 2);
            TabHBox.ShowAll();

            Add(OutputScrolledWindow);
        }
コード例 #19
0
ファイル: CommandModel.cs プロジェクト: grendello/smuxi
        public CommandModel(FrontendManager fm, ChatModel chat, string cmdChar, string data)
        {
            Trace.Call(fm, chat == null ? "(null)" : chat.GetType().ToString(), cmdChar, data);

            _Data = data;
            _DataArray = data.Split(new char[] {' '});
            _Parameter = String.Join(" ", _DataArray, 1, _DataArray.Length - 1);
            _CommandCharacter = cmdChar;
            if (data.StartsWith(cmdChar) &&
                !data.StartsWith(cmdChar + cmdChar)) {
                _IsCommand = true;
                _Command = (_DataArray[0].Length > cmdChar.Length) ?
                                _DataArray[0].Substring(cmdChar.Length).ToLower() :
                                String.Empty;
            } else if (data.StartsWith(cmdChar + cmdChar)) {
                _Data = data.Substring(cmdChar.Length);
                _DataArray[0] = _DataArray[0].Substring(cmdChar.Length);
            }
            _FrontendManager = fm;
            _Chat = chat;
        }
コード例 #20
0
ファイル: StflUI.cs プロジェクト: pacificIT/smuxi
        public void AddMessageToChat(ChatModel chat, MessageModel msg)
        {
            Trace.Call(chat, msg);

            try {
                ChatView chatView = _ChatViewManager.GetChat(chat);
                if (chatView == null) {
            #if LOG4NET
                    _Logger.Fatal(String.Format("AddMessageToChat(): _ChatViewManager.GetChat(chat) chat.Name: {0} returned null!", chat.Name));
            #endif
                    return;
                }

                // FIXME: this must be marshalled into the UI thread!
                chatView.AddMessage(msg);
                _ChatViewManager.UpdateNavigation();
            } catch (Exception ex) {
            #if LOG4NET
                _Logger.Fatal(ex);
            #endif
            }
        }
コード例 #21
0
ファイル: ChatView.cs プロジェクト: grendello/smuxi
        public ChatView(ChatModel chat, MainWindow window)
        {
            Trace.Call(chat, window);

            if (chat == null) {
                throw new ArgumentNullException("chat");
            }
            if (window == null) {
                throw new ArgumentNullException("window");
            }

            f_ChatModel = chat;
            f_MainWindow = window;
            f_WidgetID = f_NextID++;
            f_WidgetName = "output_textview_" + f_WidgetID;

            f_MainWindow.Modify("output_vbox", "append",
                "{" +
                    "textview[" + f_WidgetName + "] " +
                        ".expand:vh " +
                        ".display[" + f_WidgetID + "d]:0 " +
                        "offset[" + f_WidgetID + "os]:0 " +
                        "richtext:1 " +
                        "style_red_normal:fg=red " +
                        "style_url_normal:attr=underline " +
                        "style_u_normal:attr=underline " +
                        "style_b_normal:attr=bold " +
                        "style_i_normal:attr=standout " +
                "}"
            );
            MessageTextView = new TextView(f_MainWindow, f_WidgetName);
            MessageTextView.OffsetVariableName = f_WidgetID + "os";
            // HACK: as the chat is not always visible we can't extract the
            // heigth and width information from the textview because it simply
            // returns 0 when invisible, thus we need to abuse output_vbox
            MessageTextView.HeigthVariableName = "output_vbox:h";
            MessageTextView.WidthVariableName = "output_vbox:w";
            MessageTextView.AutoLineWrap = true;
        }
コード例 #22
0
ファイル: TestUI.cs プロジェクト: RoninBG/smuxi
        public void AddMessageToChat(ChatModel page, MessageModel msg)
        {
            Trace.Call(page, msg);

            string finalMsg = String.Empty;
            foreach (MessagePartModel msgPart in msg.MessageParts) {
                // TODO: implement other types
                if (msgPart is TextMessagePartModel) {
                    TextMessagePartModel fmsgti = (TextMessagePartModel) msgPart;
                    finalMsg += fmsgti.Text;
                }
            }

            string timestamp;
            try {
                timestamp = msg.TimeStamp.ToLocalTime().ToString((string)Frontend.UserConfig["Interface/Notebook/TimestampFormat"]);
            } catch (FormatException e) {
                timestamp = "Timestamp Format ERROR: " + e.Message;
            }
            finalMsg = timestamp + " " + page.Name + " " + finalMsg;

            Console.WriteLine(finalMsg);
        }
コード例 #23
0
ファイル: OscarProtocolManager.cs プロジェクト: licnep/smuxi
        public override void CloseChat(FrontendManager fm, ChatModel chat)
        {
            Trace.Call(fm, chat);

            throw new NotImplementedException();
        }
コード例 #24
0
 public override void DisableChat(Smuxi.Engine.ChatModel chat)
 {
     throw new NotImplementedException();
 }
コード例 #25
0
 public CommandModel(FrontendManager fm, ChatModel chat, string parameter) :
     this(fm, chat, "/", "/cmd " + parameter)
 {
 }
コード例 #26
0
ファイル: OscarProtocolManager.cs プロジェクト: RoninBG/smuxi
        public override void OpenChat(FrontendManager fm, ChatModel chat)
        {
            Trace.Call(fm, chat);

            throw new NotImplementedException();
        }
コード例 #27
0
ファイル: TestProtocolManager.cs プロジェクト: shubhtr/smuxi
 public override void CloseChat(FrontendManager fm, ChatModel chat)
 {
     throw new System.NotImplementedException();
 }
コード例 #28
0
ファイル: CampfireProtocolManager.cs プロジェクト: glwu/smuxi
        public override void OpenChat(FrontendManager fm, ChatModel chat_)
        {
            Trace.Call(fm, chat_);

            var room = Rooms.Single(r => r.Name.Equals(chat_.Name));
            Client.Post<object>(String.Format("/room/{0}/join.json", room.Id), null);
            room = Client.Get<RoomResponse>(String.Format("/room/{0}.json", room.Id)).Room;
            var chat = Session.GetChat(room.Name, ChatType.Group, this) as GroupChatModel;
            if (chat == null)
                chat = Session.CreateChat<GroupChatModel>(room.Id.ToString(), room.Name, this);

            var bld = CreateMessageBuilder();
            bld.AppendMessage(room.Topic);
            chat.Topic = bld.ToMessage();

            Session.AddChat(chat);

            /* Fill what we know about the users, this is only the currently-connected ones */
            lock (Users) {
                foreach (User user in room.Users) {
                    if (!Users.ContainsKey(user.Id))
                        Users[user.Id] = CreatePerson(user);
                    Session.AddPersonToGroupChat(chat, Users[user.Id]);
                }
            }

            /* Show the recent messages, then go live. FIXME: race condition */
            var recent = Client.Get<MessagesResponse>(String.Format("/room/{0}/recent.json", chat.ID)).Messages;
            foreach (Message message in recent)
                ShowMessage(this, new MessageReceivedEventArgs(chat, message));

            Session.SyncChat(chat);
            chat.IsSynced = true; // Let the part and join messages take affect

            var stream = new CampfireEventStream(chat, BaseUri, new NetworkCredential(Key, "X"));
            lock (EventStreams)
                EventStreams.Add(chat, stream);

            stream.MessageReceived += ShowMessage;
            stream.ErrorReceived += ShowError;
            stream.Start();
        }
コード例 #29
0
 private void _SyncChat(ChatModel chat)
 {
     f_TaskQueue.Queue(delegate {
         _UI.SyncChat(chat);
     });
 }
コード例 #30
0
 private void _AddMessageToChat(ChatModel chat, MessageModel msg)
 {
     f_TaskQueue.Queue(delegate {
         _UI.AddMessageToChat(chat, msg);
     });
 }
コード例 #31
0
 private void _Say(ChatModel chat, string text)
 {
     _Say(chat, text, true);
 }
コード例 #32
0
ファイル: ChatView.cs プロジェクト: Jaykul/smuxi
        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;

            IsAutoScrolling = true;
            MessageTextView tv = new MessageTextView();
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.ShowTimestamps = true;
            tv.ShowMarkerline = true;
            tv.Editable = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.MessageAdded += OnMessageTextViewMessageAdded;
            tv.MessageHighlighted += OnMessageTextViewMessageHighlighted;
            tv.PopulatePopup += OnMessageTextViewPopulatePopup;
            tv.SizeRequested += delegate {
                AutoScroll();
            };
            tv.PersonClicked += OnMessageTextViewPersonClicked;
            _OutputMessageTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            _OutputScrolledWindow = sw;
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Vadjustment.ValueChanged += OnVadjustmentValueChanged;
            sw.Add(_OutputMessageTextView);

            // popup menu
            _TabMenu = new Gtk.Menu();
            _TabMenu.Shown += OnTabMenuShown;

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();

            TabImage = DefaultTabImage;
            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.PackStart(TabImage, false, false, 2);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();

            _ThemeSettings = new ThemeSettings();

            // OPT-TODO: this should use a TaskStack instead of TaskQueue
            _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+ID+")");
            _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent;
            _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent;
        }
コード例 #33
0
        private void OnMessage(object sender, Message msg)
        {
            if (msg.Body == null)
            {
                return;
            }

            var    delay = msg["delay"];
            string stamp = null;

            if (delay != null)
            {
                stamp = delay.Attributes["stamp"].Value;
            }
            bool display = true;

            ChatModel   chat   = null;
            PersonModel person = null;

            if (msg.Type != XmppMessageType.groupchat)
            {
                string jid      = msg.From.Bare;
                var    contact  = _RosterManager[jid];
                string nickname = null;
                if (contact == null || String.IsNullOrEmpty(contact.Nickname))
                {
                    nickname = jid;
                }
                else
                {
                    nickname = contact.Nickname;
                }
                PersonChatModel personChat = (PersonChatModel)Session.GetChat(jid, ChatType.Person, this);
                if (personChat == null)
                {
                    person = new PersonModel(jid, nickname, NetworkID,
                                             Protocol, this);
                    personChat = Session.CreatePersonChat(
                        person, jid, nickname, this
                        );
                    Session.AddChat(personChat);
                    Session.SyncChat(personChat);
                }
                else
                {
                    person = personChat.Person;
                }
                chat = personChat;
            }
            else
            {
                string             group_jid  = msg.From.Bare;
                string             group_name = group_jid;
                string             sender_jid = msg.From.ToString();
                XmppGroupChatModel groupChat  = (XmppGroupChatModel)Session.GetChat(group_jid, ChatType.Group, this);
                if (groupChat == null)
                {
                    // FIXME shouldn't happen?
                    groupChat = Session.CreateChat <XmppGroupChatModel>(
                        group_jid, group_name, this
                        );
                    Session.AddChat(groupChat);
                    Session.SyncChat(groupChat);
                }
                person = groupChat.GetPerson(msg.From.Resource);
                if (person == null)
                {
                    // happens in case of a delayed message if the participant has left meanwhile
                    person = new PersonModel(msg.From.Resource,
                                             msg.From.Resource,
                                             NetworkID, Protocol, this);
                }

                // XXX maybe only a Google Talk bug requires this:
                if (stamp != null)
                {
                    // XXX can't use > because of seconds precision :-(
                    if (stamp.CompareTo(groupChat.LatestSeenStamp) >= 0)
                    {
                        groupChat.LatestSeenStamp = stamp;
                    }
                    else
                    {
                        display = false; // already seen newer delayed message
                    }
                    if (groupChat.SeenNewMessages)
                    {
                        display = false; // already seen newer messages
                    }
                }
                else
                {
                    groupChat.SeenNewMessages = true;
                }

                chat = groupChat;
            }

            if (display)
            {
                var builder = CreateMessageBuilder();
                if (msg.Type != XmppMessageType.error)
                {
                    builder.AppendMessage(person, msg.Body);
                }
                else
                {
                    // TODO: nicer formatting
                    builder.AppendMessage(msg.Error.ToString());
                }
                if (stamp != null)
                {
                    string format = DateTimeFormatInfo.InvariantInfo.UniversalSortableDateTimePattern.Replace(" ", "T");
                    builder.TimeStamp = DateTime.ParseExact(stamp, format, null);
                }
                Session.AddMessageToChat(chat, builder.ToMessage());
            }
        }
コード例 #34
0
 public abstract void OpenChat(FrontendManager fm, ChatModel chat);
コード例 #35
0
ファイル: Notebook.cs プロジェクト: pacificIT/smuxi
        public ChatView GetChat(ChatModel chat)
        {
            for (int i=0; i < NPages; i++) {
                ChatView chatView = (ChatView) GetNthPage(i);
                if (chatView.ChatModel == chat) {
                    return chatView;
                }
            }

            return null;
        }
コード例 #36
0
ファイル: CampfireProtocolManager.cs プロジェクト: glwu/smuxi
        void FormatUpload(MessageBuilder bld, PersonModel person, ChatModel chat, Message message)
        {
            // Figure out what the user uploaded, we need to issue another call for this
            var upload = Client.Get<UploadWrapper>(String.Format("/room/{0}/messages/{1}/upload.json", chat.ID, message.Id)).Upload;

            bld.AppendEventPrefix();
            bld.AppendIdendityName(person).AppendSpace();
            bld.AppendText(_("has uploaded '{0}' ({1} B) {2}"), upload.Name, upload.Byte_Size, upload.Full_Url);
        }
コード例 #37
0
 public abstract void CloseChat(FrontendManager fm, ChatModel chat);
コード例 #38
0
ファイル: OscarProtocolManager.cs プロジェクト: RoninBG/smuxi
        public override void Connect(FrontendManager fm, string host, int port, string username, string password)
        {
            Trace.Call(fm, host, port, username, password);

            _FrontendManager = fm;
            Host = "login.oscar.aol.com";
            Port = 5190;

            // TODO: use config for single network chat or once per network manager
            _NetworkChat = new ProtocolChatModel(NetworkID, NetworkID + " Messenger", this);
            Session.AddChat(_NetworkChat);
            Session.SyncChat(_NetworkChat);

            _OscarSession = new OscarSession(username, password);
            _OscarSession.ClientCapabilities = Capabilities.Chat | Capabilities.OscarLib;
            _OscarSession.LoginCompleted           += new LoginCompletedHandler(_OnLoginCompleted);
            _OscarSession.LoginFailed              += new LoginFailedHandler(_OnLoginFailed);
            _OscarSession.LoginStatusUpdate        += new LoginStatusUpdateHandler(_OnLoginStatusUpdate);
            _OscarSession.ErrorMessage             += new ErrorMessageHandler(_OnErrorMessage);
            _OscarSession.WarningMessage           += new WarningMessageHandler(_OnWarningMessage);
            _OscarSession.StatusUpdate             += new InformationMessageHandler(_OnStatusUpdate);
            _OscarSession.ContactListFinished      += new ContactListFinishedHandler(_OnContactListFinished);
            _OscarSession.Messages.MessageReceived += new MessageReceivedHandler(_OnMessageReceived);
            _OscarSession.Logon(Host, Port);
        }
コード例 #39
0
 private void _AddChat(ChatModel chat)
 {
     f_TaskQueue.Queue(delegate {
         _UI.AddChat(chat);
     });
 }
コード例 #40
0
ファイル: OscarProtocolManager.cs プロジェクト: RoninBG/smuxi
        private void _Say(ChatModel chat, string message)
        {
            if (!chat.IsEnabled) {
                return;
            }

            MessageModel msg = new MessageModel();
            TextMessagePartModel msgPart;

            _OscarSession.Messages.SendMessage(chat.ID, message);

            msgPart = new TextMessagePartModel();
            msgPart.Text = "<";
            msg.MessageParts.Add(msgPart);

            msgPart = new TextMessagePartModel();
            msgPart.Text = _OscarSession.ScreenName;
            msgPart.ForegroundColor = new TextColor(0x0000FF);
            msg.MessageParts.Add(msgPart);

            msgPart = new TextMessagePartModel();
            msgPart.Text = "> ";
            msg.MessageParts.Add(msgPart);

            msgPart = new TextMessagePartModel();
            msgPart.Text = message;
            msg.MessageParts.Add(msgPart);

            Session.AddMessageToChat(chat, msg);
        }
コード例 #41
0
 public void AddTextToChat(ChatModel chat, string text)
 {
     AddMessageToChat(chat, new MessageModel(text));
 }
コード例 #42
0
ファイル: ProtocolChatView.cs プロジェクト: pacificIT/smuxi
        public ProtocolChatView(ChatModel chat)
            : base(chat)
        {
            Trace.Call(chat);

            ProxySettings = new ProxySettings();

            Add(OutputScrolledWindow);

            ReconnectItem = new Gtk.ImageMenuItem(_("Reconnect"));
            ReconnectItem.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu);
            ReconnectItem.Activated += new EventHandler(OnTabMenuReconnectActivated);

            ShowAll();
        }
コード例 #43
0
 public void EnableChat(ChatModel chat)
 {
     f_TaskQueue.Queue(delegate {
         _UI.EnableChat(chat);
     });
 }