本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}