示例#1
0
文件: Class.cs 项目: JGunning/OpenAIM
 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;
 }
示例#2
0
文件: Class.cs 项目: JGunning/OpenAIM
 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;
 }
示例#3
0
文件: Class.cs 项目: JGunning/OpenAIM
 public override bool Hook_UserQuit(Network network, User user, string message, Graphics.Window window, bool updated)
 {
     if (!updated)
     {
         return true;
     }
     Message(window, user.Nick + " joined");
     return false;
 }
示例#4
0
文件: IRC.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="_network"></param>
 /// <param name="_text"></param>
 /// <param name="_pong"></param>
 /// <param name="_date">Date of this message, if you specify 0 the current time will be used</param>
 /// <param name="updated">If true this text will be considered as newly obtained information</param>
 public ProcessorIRC(Network _network, string _text, ref DateTime _pong, long _date = 0, bool updated = true)
 {
     _Network = _network;
     _Protocol = _network._Protocol;
     text = _text;
     pong = _pong;
     date = _date;
     updated_text = updated;
     if (_network._Protocol.GetType() == typeof(ProtocolSv))
     {
         isServices = true;
     }
 }
示例#5
0
文件: Hooks.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Hook that is triggered when you connect to network
 /// </summary>
 /// <param name="network">Network</param>
 public static void AfterConnectToNetwork(Network network)
 {
     network.isLoaded = true;
     foreach (Extension extension in Core.Extensions)
     {
         try
         {
             if (extension._Status == Extension.Status.Active)
             {
                 extension.Hook_AfterConnect(network);
             }
         }
         catch (Exception mf)
         {
             Core.DebugLog("Error in hook AfterConnectToNetwork(Network network) module " + extension.Name);
             Core.handleException(mf);
         }
     }
     return;
 }
示例#6
0
文件: Hooks.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Events to happen before you join a channel, if return false, the join is cancelled
 /// </summary>
 /// <param name="network"></param>
 /// <param name="Channel"></param>
 /// <returns></returns>
 public static bool BeforeJoin(Network network, string Channel)
 {
     bool data = true;
     foreach (Extension extension in Core.Extensions)
     {
         try
         {
             if (extension._Status == Extension.Status.Active)
             {
                 if (!extension.Hook_BeforeJoin(network, Channel))
                 {
                     data = false;
                 }
             }
         }
         catch (Exception mf)
         {
             Core.DebugLog("Error in hook BeforeJoin(Network network,string Channel) module " + extension.Name);
             Core.handleException(mf);
         }
     }
     return data;
 }
示例#7
0
 /// <summary>
 /// This hook is started after connection to a network
 /// </summary>
 /// <param name="network"></param>
 public virtual void Hook_AfterConnect(Network network)
 {
 }
示例#8
0
 public virtual bool Hook_UserTalk(Network network, User user, Channel channel, string message, bool updated)
 {
     return true;
 }
示例#9
0
 /// <summary>
 /// Send a command to network
 /// </summary>
 /// <param name="cm"></param>
 /// <param name="network"></param>
 /// <returns></returns>
 public override bool Command(string cm, Network network = null)
 {
     if (cm.StartsWith(" ", StringComparison.Ordinal) != true && cm.Contains(" "))
     {
         // uppercase
         string first_word = cm.Substring(0, cm.IndexOf(" ", StringComparison.Ordinal)).ToUpper();
         string rest = cm.Substring(first_word.Length);
         Transfer(first_word + rest, Configuration.Priority.Normal, network);
         return true;
     }
     Transfer(cm.ToUpper(), Configuration.Priority.Normal, network);
     return true;
 }
示例#10
0
 /// <summary>
 /// Reconnect network
 /// </summary>
 /// <param name="network"></param>
 public override void ReconnectNetwork(Network network)
 {
     if (IsConnected)
     {
         Disconnect();
     }
     if (main != null)
     {
         Core.KillThread(main);
     }
     main = new System.Threading.Thread(Start);
     Core.SystemForm.Status("Connecting to server " + Server + " port " + Port.ToString());
     main.Start();
     Core.SystemThreads.Add(main);
 }
示例#11
0
文件: User.cs 项目: JGunning/OpenAIM
 private void MakeUser(string nick, string host, Network network, string ident)
 {
     _Network = network;
     if (!string.IsNullOrEmpty(nick))
     {
         char prefix = nick[0];
         if (network.UChars.Contains(prefix))
         {
             SymbolMode(prefix);
             nick = nick.Substring(1);
         }
     }
     Nick = nick;
     Ident = ident;
     Host = host;
 }
示例#12
0
文件: User.cs 项目: JGunning/OpenAIM
 /// <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);
 }
示例#13
0
文件: User.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Creates a new user
 /// </summary>
 /// <param name="nick"></param>
 /// <param name="host"></param>
 /// <param name="network"></param>
 /// <param name="ident"></param>
 public User(string nick, string host, Network network, string ident)
 {
     if (network == null)
     {
         throw new Core.PidgeonException("Network can't be null in here");
     }
     MakeUser(nick, host, network, ident);
     Server = network.ServerName;
 }
示例#14
0
 /// <summary>
 /// Send a raw data to irc server you pick, you should always fill in network, or current network will be used
 /// </summary>
 /// <param name="text">Message</param>
 /// <param name="priority">priority</param>
 /// <param name="network">This value must be filled in - it's not required because some old functions do not provide it</param>
 public override void Transfer(string text, Configuration.Priority priority = Configuration.Priority.Normal, Network network = null)
 {
     if (network == null)
     {
         if (Core.SelectedNetwork != null && NetworkList.Contains(Core.SelectedNetwork))
         {
             Datagram data = new Datagram("RAW", text);
             data.Parameters.Add("network", Core.SelectedNetwork.ServerName);
             Deliver(data);
             return;
         }
     }
     else
     {
         if (NetworkList.Contains(network))
         {
             Datagram data = new Datagram("RAW", text);
             data.Parameters.Add("network", network.ServerName);
             Deliver(data);
         }
         else
         {
             Core.DebugLog("Network is not a part of this services connection " + network.ServerName);
         }
     }
 }
示例#15
0
 /// <summary>
 /// Request a global nick
 /// </summary>
 /// <param name="_Nick"></param>
 /// <param name="network"></param>
 /// <returns></returns>
 public override int RequestNick(string _Nick, Network network = null)
 {
     Deliver(new Datagram("GLOBALNICK", _Nick));
     return 0;
 }
示例#16
0
 /// <summary>
 /// Part a channel
 /// </summary>
 /// <param name="name"></param>
 /// <param name="network"></param>
 public override void Part(string name, Network network = null)
 {
     Transfer("PART " + name, Configuration.Priority.High, network);
 }
示例#17
0
 /// <summary>
 /// Send a message to network
 /// </summary>
 /// <param name="text">Text of message</param>
 /// <param name="to">Who is supposed to receive it</param>
 /// <param name="network">Network where it is sent</param>
 /// <param name="_priority">Priority</param>
 /// <param name="pmsg">Whether it is supposed to be considered a private message</param>
 /// <returns></returns>
 public override int Message(string text, string to, Network network, Configuration.Priority _priority = Configuration.Priority.Normal, bool pmsg = false)
 {
     Datagram message = new Datagram("MESSAGE", text);
     if (network != null && NetworkList.Contains(network))
     {
         message.Parameters.Add("network", network.ServerName);
         message.Parameters.Add("priority", _priority.ToString());
         message.Parameters.Add("to", to);
         Deliver(message);
     }
     else
     {
         Core.DebugLog("Invalid network for message to: " + to);
     }
     return 0;
 }
示例#18
0
 /// <summary>
 /// Join a channel
 /// </summary>
 /// <param name="name"></param>
 /// <param name="network"></param>
 public override void Join(string name, Network network = null)
 {
     Transfer("JOIN " + name);
 }
示例#19
0
 /// <summary>
 /// Disconnect from a specific network on bouncer side
 /// </summary>
 /// <param name="network"></param>
 public void Disconnect(Network network)
 {
     Transfer("QUIT :" + network.Quit, Configuration.Priority.High, network);
     Datagram request = new Datagram("REMOVE", network.ServerName);
     Deliver(request);
 }
示例#20
0
 /// <summary>
 /// This hook is started before pidgeon try to join a channel, return false will abort the action
 /// </summary>
 /// <param name="network"></param>
 /// <param name="Channel"></param>
 /// <returns></returns>
 public virtual bool Hook_BeforeJoin(Network network, string Channel)
 {
     return true;
 }
示例#21
0
文件: User.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Creates a new user
 /// </summary>
 /// <param name="user">user!ident@hostname</param>
 /// <param name="network">Network this class belongs to</param>
 public User(string user, Network network)
 {
     if (!user.Contains("@") || !user.Contains("!"))
     {
         Core.DebugLog("Unable to create user from " + user);
         return;
     }
     string name = user.Substring(0, user.IndexOf("!", StringComparison.Ordinal));
     string ident = user.Substring(user.IndexOf("!", StringComparison.Ordinal) + 1);
     string host = ident.Substring(ident.IndexOf("@", StringComparison.Ordinal) + 1);
     ident = ident.Substring(0, ident.IndexOf("@", StringComparison.Ordinal));
     MakeUser(name, host, network, ident);
     Server = network.ServerName;
 }
示例#22
0
 /////////////////////////////////////////////////////////////////////////////////////
 // Network
 /////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// This hook is started when a network object is created
 /// </summary>
 /// <param name="network"></param>
 public virtual void Hook_Network(Network network)
 {
     return;
 }
示例#23
0
文件: User.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Creates a new user
 /// </summary>
 /// <param name="nick"></param>
 /// <param name="host"></param>
 /// <param name="network"></param>
 /// <param name="ident"></param>
 /// <param name="server"></param>
 public User(string nick, string host, Network network, string ident, string server)
 {
     MakeUser(nick, host, network, ident);
     Server = server;
 }
示例#24
0
 /// <summary>
 /// This function is called when network send us a network info
 /// </summary>
 /// <param name="network"></param>
 /// <param name="command"></param>
 /// <param name="parameters"></param>
 /// <param name="value"></param>
 public virtual void Hook_NetworkInfo(Network network, string command, string parameters, string value)
 {
     return;
 }
示例#25
0
文件: User.cs 项目: JGunning/OpenAIM
 /// <summary>
 /// Destroy
 /// </summary>
 public void Destroy()
 {
     if (IsDestroyed)
     {
         return;
     }
     Channel = null;
     Core.SystemForm.ChannelList.RemoveUser(this);
     _Network = null;
     destroyed = true;
 }
示例#26
0
 public virtual bool Hook_UserJoin(Network network, User user, Channel channel, bool updated)
 {
     return true;
 }
示例#27
0
 /// <summary>
 /// Request nick
 /// </summary>
 /// <param name="_Nick"></param>
 /// <param name="network"></param>
 /// <returns></returns>
 public override int RequestNick(string _Nick, Network network = null)
 {
     Transfer("NICK " + _Nick);
     return 0;
 }
示例#28
0
 public virtual bool Hook_UserQuit(Network network, User user, string message, Graphics.Window window, bool updated)
 {
     return true;
 }
示例#29
0
 public virtual bool Hook_Topic(Network network, string userline, Channel channel, string topic)
 {
     return true;
 }
示例#30
0
 /// <summary>
 /// Transfer
 /// </summary>
 /// <param name="text"></param>
 /// <param name="priority"></param>
 /// <param name="network"></param>
 public override void Transfer(string text, Configuration.Priority priority = Configuration.Priority.Normal, Network network = null)
 {
     Messages.DeliverMessage(text, priority);
 }