本文整理汇总了C#中Smuxi.Engine.GroupChatModel类的典型用法代码示例。如果您正苦于以下问题:C# GroupChatModel类的具体用法?C# GroupChatModel怎么用?C# GroupChatModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroupChatModel类属于Smuxi.Engine命名空间,在下文中一共展示了GroupChatModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TwitterSearchStream
public TwitterSearchStream(TwitterProtocolManager protocolManager,
GroupChatModel chat, string keyword,
OAuthTokens tokens, WebProxy proxy)
{
if (protocolManager == null) {
throw new ArgumentNullException("protocolManager");
}
if (chat == null) {
throw new ArgumentNullException("chat");
}
if (keyword == null) {
throw new ArgumentNullException("keyword");
}
if (tokens == null) {
throw new ArgumentNullException("tokens");
}
ProtocolManager = protocolManager;
Session = protocolManager.Session;
Chat = chat;
var options = new StreamOptions();
options.Track.Add(keyword);
Stream = new TwitterStream(tokens, null, options);
Stream.Proxy = proxy;
Stream.StartPublicStream(OnStreamStopped, OnStatusCreated, OnStatusDeleted, OnEvent);
MessageRateLimiter = new RateLimiter(5, TimeSpan.FromSeconds(5));
}
示例2: CampfireEventStream
public CampfireEventStream(GroupChatModel chat, Uri baseuri, NetworkCredential cred)
{
this.Chat = chat;
this.Cred = cred;
this.Host = Host;
this.BaseUri = baseuri;
this.LastMessage = 0;
}
示例3: IrcGroupChatView
public IrcGroupChatView(GroupChatModel groupChat)
: base(groupChat)
{
Trace.Call(groupChat);
if (PersonTreeView != null) {
Gtk.CellRendererText cellr = new Gtk.CellRendererText();
// HACK: for some reason GTK is giving the space of 2 chars which
// we workaround using a char width of 0
cellr.WidthChars = 0;
Gtk.TreeViewColumn column = new Gtk.TreeViewColumn(String.Empty, cellr);
column.Spacing = 0;
column.SortIndicator = false;
column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(_RenderIrcGroupPersonMode));
PersonTreeView.AppendColumn(column);
PersonTreeView.MoveColumnAfter(IdentityNameColumn, column);
}
}
示例4: IsFilteredMessage
public void IsFilteredMessage()
{
var chat = new GroupChatModel("testchat", "Test Chat", Protocol);
Assert.IsFalse(Session.IsFilteredMessage(chat, "foobar", MessageType.Normal));
var filters = new List<FilterModel>(Session.Filters);
filters.Add(
new FilterModel() {
NetworkID = "TESTnet",
MessagePattern = "/^filter me$/"
}
);
filters.Add(
new FilterModel() {
NetworkID = "OTHERnet"
}
);
Session.Filters = filters;
Assert.IsTrue(Session.IsFilteredMessage(chat, "filter me", MessageType.Normal));
Assert.IsFalse(Session.IsFilteredMessage(chat, "do not filter me", MessageType.Normal));
}
示例5: FindGroupChats
public override IList<GroupChatModel> FindGroupChats(GroupChatModel filter)
{
throw new NotImplementedException();
}
示例6: FindGroupChats
public override IList<GroupChatModel> FindGroupChats(GroupChatModel filter)
{
Trace.Call(filter);
RefreshRooms();
string searchPattern = null;
if (filter == null || String.IsNullOrEmpty(filter.Name)) {
// full channel list
} else {
if (!filter.Name.StartsWith("*") && !filter.Name.EndsWith("*")) {
searchPattern = String.Format("*{0}*", filter.Name);
} else {
searchPattern = filter.Name;
}
}
List<GroupChatModel> chats = new List<GroupChatModel>(Rooms.Count());
IEnumerable<Room> matching;
matching = searchPattern == null ? Rooms :
Rooms.Where(r => Pattern.IsMatch(r.Name, searchPattern));
foreach (var room in matching) {
GroupChatModel chat = new GroupChatModel(room.Id.ToString(), room.Name, null);
var users = Client.Get<RoomResponse>(String.Format("/room/{0}.json", chat.ID)).Room.Users;
/* Don't waste this data */
lock (Users) {
foreach (var user in users) {
if (!Users.ContainsKey(user.Id))
Users[user.Id] = CreatePerson(user);
}
}
chat.PersonCount = users.Length;
chat.Topic = CreateMessageBuilder().AppendMessage(room.Topic).ToMessage();
lock (chat) {
chats.Add(chat);
}
}
return chats;
}
示例7: CommandJoin
public void CommandJoin(CommandModel cmd)
{
Trace.Call(cmd);
RefreshRooms();
/*
* cmd.DataArray is split at SP, but that's an allowed character
* for Campfire. Instead of relying on that, we need to remove the "/join "
* part and then split on ','
*/
var chans = cmd.Parameter.Split(',');
var list = Rooms.Where(r => chans.Any(r.Name.Equals));
foreach(Room room in list) {
var chat = new GroupChatModel(room.Id.ToString(), room.Name, null);
OpenChat(cmd.FrontendManager, chat);
}
}
示例8: FindGroupChats
public override IList<GroupChatModel> FindGroupChats(GroupChatModel filter)
{
Trace.Call(filter);
var list = new List<GroupChatModel>();
if (ContactChat == null) {
list.Add(new GroupChatModel("Contacts", "Contacts", this));
}
return list;
}
示例9: UpdatePersonInGroupChat
public void UpdatePersonInGroupChat(GroupChatModel groupChat, PersonModel oldPerson, PersonModel newPerson)
{
Trace.Call(groupChat, oldPerson, newPerson);
try {
var chatView = _ChatViewManager.GetChat(groupChat);
if (chatView == null) {
#if LOG4NET
_Logger.Fatal(String.Format("UpdatePersonInGroupChat(): _ChatViewManager.GetChat(groupChat) groupChat.Name: {0} returned null!", groupChat.Name));
#endif
return;
}
lock (chatView.Participants) {
chatView.Participants.Remove(oldPerson);
chatView.Participants.Add(newPerson);
}
} catch (Exception ex) {
#if LOG4NET
_Logger.Fatal(ex);
#endif
}
}
示例10: UpdateTopicInGroupChat
public void UpdateTopicInGroupChat(GroupChatModel ecpage, string topic)
{
TraceRemotingCall(ecpage, topic);
MethodBase mb = Trace.GetMethodBase();
_Dispatcher.Invoke(DispatcherPriority.Normal,new MethodInvoker(delegate {
TraceRemotingCall(mb, ecpage, topic);
/*
GroupChatView cpage = (GroupChatView)Frontend.MainWindow.Notebook.GetChat(ecpage);
if (cpage.TopicEntry != null) {
cpage.TopicEntry.Text = topic;
}
*/
}));
}
示例11: RemovePersonFromGroupChat
public void RemovePersonFromGroupChat(GroupChatModel cpage, PersonModel user)
{
Trace.Call(cpage, user);
}
示例12: OnResponse
protected override void OnResponse(Gtk.ResponseType responseType)
{
Trace.Call(responseType);
switch (responseType) {
case Gtk.ResponseType.Ok:
f_GroupChatModel = GetCurrentGroupChat();
break;
case Gtk.ResponseType.Cancel:
CancelFindThread();
break;
}
base.OnResponse(responseType);
}
示例13: OnFindButtonClicked
protected virtual void OnFindButtonClicked(object sender, System.EventArgs e)
{
Trace.Call(sender, e);
try {
string nameFilter = f_NameEntry.Text.Trim();
if (String.IsNullOrEmpty(nameFilter)) {
Gtk.MessageDialog md = new Gtk.MessageDialog(
this,
Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.YesNo,
_("Searching for group chats without a filter is not " +
"recommended. This may take a while, or may not " +
"work at all.\n" +
"Do you wish to continue?")
);
int result = md.Run();
md.Destroy();
if (result != (int) Gtk.ResponseType.Yes) {
return;
}
}
f_ListStore.Clear();
CancelFindThread();
GroupChatModel filter = new GroupChatModel(null, nameFilter, null);
f_FindThread = new Thread(new ThreadStart(delegate {
try {
Gtk.Application.Invoke(delegate {
GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
});
IList<GroupChatModel> chats = f_ProtocolManager.FindGroupChats(filter);
Gtk.Application.Invoke(delegate {
Gdk.Color bgColor = f_TreeView.Style.Background(Gtk.StateType.Normal);
foreach (GroupChatModel chat in chats) {
f_ListStore.AppendValues(
chat,
chat.PersonCount,
chat.Name,
PangoTools.ToMarkup(chat.Topic, bgColor)
);
}
});
} catch (ThreadAbortException ex) {
#if LOG4NET
f_Logger.Debug("FindThread aborted");
#endif
Thread.ResetAbort();
} catch (Exception ex) {
Frontend.ShowError(this, _("Error while fetching the list of group chats from the server."), ex);
} finally {
Gtk.Application.Invoke(delegate {
// if the dialog is gone the GdkWindow might be destroyed already
if (GdkWindow != null) {
GdkWindow.Cursor = null;
}
});
}
}));
f_FindThread.IsBackground = true;
f_FindThread.Start();
} catch (Exception ex) {
Frontend.ShowException(ex);
}
}
示例14: _UpdateTopicInGroupChat
private void _UpdateTopicInGroupChat(GroupChatModel groupChat, MessageModel topic)
{
f_TaskQueue.Queue(delegate {
_UI.UpdateTopicInGroupChat(groupChat, topic);
});
}
示例15: _UpdatePersonInGroupChat
private void _UpdatePersonInGroupChat(GroupChatModel groupChat, PersonModel oldPerson, PersonModel newPerson)
{
f_TaskQueue.Queue(delegate {
_UI.UpdatePersonInGroupChat(groupChat, oldPerson, newPerson);
});
}