public override bool Hook_UserJoin(Network network, User user, Channel channel, bool updated) { if (!updated) { return true; } Message(channel.retrieveWindow(), user.Nick + " joined"); return false; }
public override bool Hook_UserPart(Network network, User user, Channel channel, string message, bool updated) { if (!updated) { return true; } Message(channel.retrieveWindow(), user.Nick + " parted"); return false; }
/// <summary> /// Creates a new user /// </summary> /// <param name="nick">Nick</param> /// <param name="host">Host</param> /// <param name="network">Network</param> /// <param name="ident">Ident</param> /// <param name="server">Server</param> /// <param name="channel">Channel</param> public User(string nick, string host, Network network, string ident, string server, Channel channel) { this.Server = server; this.Channel = channel; MakeUser(nick, host, network, ident); }
/// <summary> /// Destroy /// </summary> public void Destroy() { if (IsDestroyed) { return; } Channel = null; Core.SystemForm.ChannelList.RemoveUser(this); _Network = null; destroyed = true; }
public virtual bool Hook_UserJoin(Network network, User user, Channel channel, bool updated) { return true; }
public virtual bool Hook_UserTalk(Network network, User user, Channel channel, string message, bool updated) { return true; }
/// <summary> /// Part /// </summary> /// <param name="channel"></param> public void Part(Channel channel) { _Protocol.Part(channel.Name, this); }
public virtual bool Hook_Topic(Network network, string userline, Channel channel, string topic) { return true; }
/// <summary> /// User talk /// </summary> /// <param name="network"></param> /// <param name="user"></param> /// <param name="channel"></param> /// <param name="message"></param> /// <param name="updated"></param> /// <param name="date"></param> /// <returns></returns> public static bool UserTalk(Network network, User user, Channel channel, string message, bool updated, long date) { bool ok = true; foreach (Extension extension in Core.Extensions) { try { if (extension._Status == Extension.Status.Active) { #pragma warning disable if (!extension.Hook_UserTalk(network, user, channel, message, updated)) { Core.DebugLog("Compatibility warning: extension with name " + extension.Name + " is using obsolete" + " function extension.Hook_UserTalk(network, user, channel, message, updated)"); ok = false; } #pragma warning restore Extension.NetworkTextArgs data = new Extension.NetworkTextArgs(); data.network = network; data.updated = updated; data.date = date; data.message = message; data.user = user; if (!extension.Hook_UserTalk(data)) { ok = false; } } } catch (Exception mf) { Core.DebugLog("Error in hook UserTalk(Network network, User user, Channel channel, string message) module " + extension.Name); Core.handleException(mf); } } return ok; }
/// <summary> /// Create a new instance of channel window /// </summary> /// <param name="channel">Channel</param> /// <param name="nf">Don't focus this new window</param> /// <returns>Instance of channel object</returns> public Channel Channel(string channel, bool nf = false) { Channel previous = getChannel(channel); if (previous == null) { Channel _channel = new Channel(this); RenderedChannel = _channel; _channel.Name = channel; Channels.Add(_channel); Core.SystemForm.ChannelList.InsertChannel(_channel); Graphics.Window window = _Protocol.CreateChat(channel, !nf, this, true); window.isChannel = true; if (!nf) { Core.SystemForm.ChannelList.ReselectWindow(window); } return _channel; } else { return previous; } }
/// <summary> /// User kick /// </summary> /// <param name="network"></param> /// <param name="user"></param> /// <param name="kicker"></param> /// <param name="channel"></param> /// <param name="message"></param> public static bool UserKick(Network network, User user, User kicker, Channel channel, string message) { return true; }
/// <summary> /// Topic is being changed, topic is a new topic, this event happen before the topic is changed and if false is returned /// the topic change is ignored /// </summary> /// <param name="network"></param> /// <param name="user"></param> /// <param name="channel"></param> /// <param name="topic"></param> /// <param name="date"></param> /// <param name="updated"></param> /// <returns></returns> public static bool Topic(Network network, string user, Channel channel, string topic, long date, bool updated) { bool success = true; foreach (Extension extension in Core.Extensions) { try { if (extension._Status == Extension.Status.Active) { Extension.TopicArgs data = new Extension.TopicArgs(); data.channel = channel; data.network = network; data.Source = user; data.date = date; data.updated = updated; data.Topic = topic; if (!extension.Hook_Topic(data)) { success = false; } #pragma warning disable if (!extension.Hook_Topic(network, user, channel, topic)) { Core.DebugLog("Compatibility warning: extension with name " + extension.Name + " is using obsolete function extension.Hook_Topic(network, user, channel, topic)"); success = false; } #pragma warning restore } } catch (Exception mf) { Core.DebugLog("Error in hook Topic(Network network, User user, Channel channel, string topic) module " + extension.Name); Core.handleException(mf); } } return success; }
/// <summary> /// Channel topic is retrieved from server /// </summary> /// <param name="topic">Topic</param> /// <param name="user">User who set it</param> /// <param name="network">Network</param> /// <param name="channel">Channel</param> public static bool ChannelTopic(string topic, User user, Network network, Channel channel) { bool ok = true; return ok; }
/// <summary> /// Channel mode is printed to a window /// </summary> /// <param name="network"></param> /// <param name="channel"></param> /// <param name="Mode"></param> /// <returns></returns> public static bool ChannelInfo(Network network, Channel channel, string Mode) { bool ok = true; return ok; }
/// <summary> /// Events to happen before leaving a channel, if return false, the quiting is cancelled /// </summary> /// <param name="network"></param> /// <param name="channel"></param> /// <returns></returns> public static bool BeforePart(Network network, Channel channel) { return true; }