當前位置: 首頁>>代碼示例>>C#>>正文


C# GroupChatModel.InitMessageBuffer方法代碼示例

本文整理匯總了C#中Smuxi.Engine.GroupChatModel.InitMessageBuffer方法的典型用法代碼示例。如果您正苦於以下問題:C# GroupChatModel.InitMessageBuffer方法的具體用法?C# GroupChatModel.InitMessageBuffer怎麽用?C# GroupChatModel.InitMessageBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Smuxi.Engine.GroupChatModel的用法示例。


在下文中一共展示了GroupChatModel.InitMessageBuffer方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnLoggedOn

        void OnLoggedOn(IEnumerable<Room> rooms)
        {
            Trace.Call(rooms);

            try {
                foreach (var room in rooms) {
                    var groupChat = (GroupChatModel) GetChat(room.Name, ChatType.Group);
                    bool newChat;
                    if (groupChat == null) {
                        groupChat = new GroupChatModel(room.Name, room.Name, this);
                        groupChat.InitMessageBuffer(MessageBufferPersistencyType.Volatile);
                        newChat = true;
                    } else {
                        groupChat.UnsafePersons.Clear();
                        newChat = false;
                    }

                    var task = Client.GetRoomInfo(room.Name);
                    task.Wait();
                    // check task.Exception
                    var roomInfo = task.Result;
                    groupChat.Topic = CreateMessageBuilder<JabbrMessageBuilder>().
                        AppendMessage(roomInfo.Topic).
                        ToMessage();
                    foreach (var user in roomInfo.Users) {
                        groupChat.UnsafePersons.Add(user.Name,
                                                    CreatePerson(user));
                    }
                    // add ourself if needed
                    if (!groupChat.UnsafePersons.ContainsKey(Username)) {
                        groupChat.UnsafePersons.Add(Username, Me);
                    }
                    foreach (var msg in roomInfo.RecentMessages) {
                        AddMessage(groupChat, msg);
                    }
                    if (newChat) {
                        Session.AddChat(groupChat);
                    } else {
                        Session.EnableChat(groupChat);
                    }
                    Session.SyncChat(groupChat);
                }
            } catch (Exception ex) {
            #if LOG4NET
                Logger.Error(ex);
            #endif
                var msg = CreateMessageBuilder().
                    AppendEventPrefix().
                    AppendErrorText(_("Retrieving chat information failed. " +
                                      "Reason: {0}"),
                                    ex.Message).
                    ToMessage();
                Session.AddMessageToChat(ProtocolChat, msg);
            }
        }
開發者ID:NattyNarwhal,項目名稱:smuxi,代碼行數:55,代碼來源:JabbrProtocolManager.cs

示例2: FindGroupChats

        public override IList<GroupChatModel> FindGroupChats(GroupChatModel filter)
        {
            Trace.Call(filter);

            var res = Client.GetRooms();
            res.Wait();
            // res.Exception
            var groupChats = new List<GroupChatModel>();
            foreach (var room in res.Result) {
                var groupChat = new GroupChatModel(room.Name, room.Name, this);
                groupChat.InitMessageBuffer(MessageBufferPersistencyType.Volatile);
                groupChat.PersonCount = room.Count;
                groupChats.Add(groupChat);
            }
            return groupChats;
        }
開發者ID:NattyNarwhal,項目名稱:smuxi,代碼行數:16,代碼來源:JabbrProtocolManager.cs

示例3: OnJoinedRoom

        void OnJoinedRoom(Room room)
        {
            Trace.Call(room);

            var groupChat = new GroupChatModel(room.Name, room.Name, this);
            groupChat.InitMessageBuffer(MessageBufferPersistencyType.Volatile);

            var task = Client.GetRoomInfo(room.Name);
            task.Wait();
            // check task.Exception
            var roomInfo = task.Result;

            groupChat.Topic = CreateMessageBuilder<JabbrMessageBuilder>().
                AppendMessage(roomInfo.Topic).
                ToMessage();
            foreach (var user in roomInfo.Users) {
                groupChat.UnsafePersons.Add(user.Name,
                                            CreatePerson(user));
            }
            // add ourself if needed
            if (!groupChat.UnsafePersons.ContainsKey(Username)) {
                groupChat.UnsafePersons.Add(Username, Me);
            }
            Session.AddChat(groupChat);
            Session.SyncChat(groupChat);
        }
開發者ID:NattyNarwhal,項目名稱:smuxi,代碼行數:26,代碼來源:JabbrProtocolManager.cs

示例4: TwitterProtocolManager

        public TwitterProtocolManager(Session session)
            : base(session)
        {
            Trace.Call(session);

            f_FriendsTimelineChat = new GroupChatModel(
                TwitterChatType.FriendsTimeline.ToString(),
                _("Home Timeline"),
                this
            );
            f_FriendsTimelineChat.InitMessageBuffer(
                MessageBufferPersistencyType.Volatile
            );
            f_FriendsTimelineChat.ApplyConfig(Session.UserConfig);
            f_GroupChats.Add(f_FriendsTimelineChat);

            f_RepliesChat = new GroupChatModel(
                TwitterChatType.Replies.ToString(),
                _("Replies"),
                this
            );
            f_RepliesChat.InitMessageBuffer(
                MessageBufferPersistencyType.Volatile
            );
            f_RepliesChat.ApplyConfig(Session.UserConfig);
            f_GroupChats.Add(f_RepliesChat);

            f_DirectMessagesChat = new GroupChatModel(
                TwitterChatType.DirectMessages.ToString(),
                _("Direct Messages"),
                this
            );
            f_DirectMessagesChat.InitMessageBuffer(
                MessageBufferPersistencyType.Volatile
            );
            f_DirectMessagesChat.ApplyConfig(Session.UserConfig);
            f_GroupChats.Add(f_DirectMessagesChat);
        }
開發者ID:carlosmn,項目名稱:smuxi,代碼行數:38,代碼來源:TwitterProtocolManager.cs


注:本文中的Smuxi.Engine.GroupChatModel.InitMessageBuffer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。