/// <summary> /// Sends an extended WHO query asking for specific information about a single user /// or the users in a channel, and runs a callback when we have received the response. /// </summary> public void Who(string target, WhoxFlag flags, WhoxField fields, Action <List <ExtendedWho> > callback) { if (ServerInfo.ExtendedWho) { var whox = new List <ExtendedWho>(); // Generate random querytype for WHO query int queryType = RandomNumber.Next(0, 999); // Add the querytype field if it wasn't defined var _fields = fields; if ((fields & WhoxField.QueryType) == 0) { _fields |= WhoxField.QueryType; } string whoQuery = string.Format("WHO {0} {1}%{2},{3}", target, flags.AsString(), _fields.AsString(), queryType); string queryKey = string.Format("WHO {0} {1} {2:D}", target, queryType, _fields); RequestManager.QueueOperation(queryKey, new RequestOperation(whox, ro => { callback?.Invoke((List <ExtendedWho>)ro.State); })); SendRawMessage(whoQuery); } }
public void GetModeList(string channel, char mode, Action<MaskCollection> callback) { RequestManager.QueueOperation("GETMODE " + mode + " " + channel, new RequestOperation(new MaskCollection(), ro => { var c = (MaskCollection)ro.State; if (callback != null) callback(c); })); SendRawMessage("MODE {0} {1}", channel, mode); }
public void WhoIs(string nick, Action<WhoIs> callback) { var whois = new WhoIs(); RequestManager.QueueOperation("WHOIS " + nick, new RequestOperation(whois, ro => { if (callback != null) callback((WhoIs)ro.State); })); SendRawMessage("WHOIS {0}", nick); }
public void GetMode(string channel, Action<IrcChannel> callback) { RequestManager.QueueOperation("MODE " + channel, new RequestOperation(channel, ro => { var c = Channels[(string)ro.State]; if (callback != null) callback(c); })); SendRawMessage("MODE {0}", channel); }