예제 #1
0
        public void onMsg(ref IMessageBase msg)
        {
            string message = msg.Message.RawText, param = string.Empty;

            if (message.StartsWith(queryUserIdCommand))
            {
                param = message.Substring(queryUserIdCommand.Length).Trim();

                string result = String.Format("userid \"{0}\" is {1} ", param, (UserIdGenerator.GetId(param)));

                Sync.SyncHost.Instance.Messages.RaiseMessage <ISourceClient>(new IRCMessage("RecentQuery", result));
                msg.Cancel = true;
                return;
            }

            if (message.StartsWith(queryUserNameCommand))
            {
                msg.Cancel = true;
                param      = message.Substring(queryUserNameCommand.Length).Trim();

                if (Int32.TryParse(param, out int id))
                {
                    return;
                }

                string result = String.Format("userName \"{0}\" is {1} ", UserIdGenerator.GetUserName(id), param);

                Sync.SyncHost.Instance.Messages.RaiseMessage <ISourceClient>(new IRCMessage("RecentQuery", result));
            }
        }
예제 #2
0
 private string GetUserName(int id)
 {
     return(UserIdGenerator.GetUserName(id));
 }