本文整理汇总了C#中Sharkbite.Irc.UserInfo类的典型用法代码示例。如果您正苦于以下问题:C# UserInfo类的具体用法?C# UserInfo怎么用?C# UserInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserInfo类属于Sharkbite.Irc命名空间,在下文中一共展示了UserInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPrivate
public void OnPrivate(UserInfo info, string message)
{
if (message.ToLower() == "hi")
{
connection.Sender.PrivateMessage(info.Nick, "Nobody loves you");
}
}
示例2: OnPublic
public void OnPublic(UserInfo user, string channel, string message)
{
Calls c = new Calls();
string txt = c.CallPublic(user.Nick.ToString(), message, channel, connection);
textviewLog.Buffer.Text = txt.ToString();
//connection.Sender.PublicMessage(channel, user + " " + "Cuando digas mi nombre lavate la boca ingenuo mortal");
}
示例3: HandlePublicMessage
protected override void HandlePublicMessage(UserInfo user, string message)
{
var strategies = GetStrategiesThatCanRespond(message, user.Nick, _settings.PublicScriptFolder);
if (strategies.Count > 0)
{
var selectedStrategy = GetPrioritizedStrategy(strategies);
Console.WriteLine("Found strategy, responding: {0}", selectedStrategy.Response);
Say(selectedStrategy.Response);
}
}
示例4: OnJoin
public void OnJoin(UserInfo user, string channel)
{
if(user.Nick == Credentials.Nick)
{
}
else
{
Console.WriteLine(user.Nick + " connected.");
connection.Sender.PublicMessage(Credentials.Channel, "Welcome " + user.Nick + "!");
}
}
示例5: HandleMessage
private void HandleMessage(string messageType, Action<UserInfo, string> handler, UserInfo user, string message)
{
Console.WriteLine("{0} msg from {1} > {2}", messageType, user.Nick, message);
try
{
handler.Invoke(user, message);
}
catch (Exception ex)
{
Console.WriteLine("*** ERROR when handling {0} message:", messageType);
Console.WriteLine(ex);
}
}
示例6: Listener_OnPublic
void Listener_OnPublic(UserInfo user, string channel, string message)
{
//string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./[email protected]#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
//string msg = message;
RemoveVariables(ref message);
RemoveWhitespace(ref message);
if (message.Contains("^UGCS"))
{
Server.UpdateGlobalSettings();
return;
}
if (message.Contains("^IPGET "))
{
foreach (Player p in Player.players)
{
if (p.name == message.Split(' ')[1])
{
if (Server.UseGlobalChat && IsConnected())
{
if (Player.IsLocalIpAddress(p.ip))
{
connection.Sender.PublicMessage(channel, "^IP " + p.name + ": " + Server.IP);
connection.Sender.PublicMessage(channel, "^PLAYER IS CONNECTING THROUGH A LOCAL IP.");
}
else { connection.Sender.PublicMessage(channel, "^IP " + p.name + ": " + p.ip); }
}
}
}
}
if (message.Contains("^SENDRULES "))
{
Player who = Player.Find(message.Split(' ')[1]);
if (who != null)
{
Command.all.Find("gcrules").Use(who, "");
}
}
if (message.Contains("^GETINFO "))
{
if (Server.GlobalChatNick == message.Split(' ')[1])
{
if (Server.UseGlobalChat && IsConnected())
{
connection.Sender.PublicMessage(channel, "^NAME: " + Server.name);
connection.Sender.PublicMessage(channel, "^MOTD: " + Server.motd);
connection.Sender.PublicMessage(channel, "^VERSION: " + Server.VersionString);
connection.Sender.PublicMessage(channel, "^GLOBAL NAME: " + Server.GlobalChatNick);
connection.Sender.PublicMessage(channel, "^URL: " + Server.URL);
connection.Sender.PublicMessage(channel, "^PLAYERS: " + Player.players.Count + "/" + Server.players);
}
}
}
//for RoboDash's anti advertise/swear in #globalchat
if (message.Contains("^ISASERVER "))
{
if (Server.GlobalChatNick == message.Split(' ')[1])
{
connection.Sender.PublicMessage(channel, "^IMASERVER");
}
}
if (message.StartsWith("^"))
return;
message = message.MCCharFilter();
if (String.IsNullOrEmpty(message))
return;
if (OnNewRecieveGlobalMessage != null)
OnNewRecieveGlobalMessage(user.Nick, message);
if (Server.Devs.Contains(message.Split(':')[0].ToLower()) && !message.StartsWith("[Dev]") && !message.StartsWith("[Developer]"))
message = "[Dev]" + message;
else if(Server.Mods.Contains(message.Split(':')[0].ToLower()) && !message.StartsWith("[Mod]") && !message.StartsWith("[Moderator]"))
message = "[Mod]" + message;
else if (Server.Mods.Contains(message.Split(':')[0].ToLower()) && !message.StartsWith("[GCMod]"))
message = "[GCMod]" + message;
/*try {
if(GUI.GuiEvent != null)
GUI.GuiEvents.GlobalChatEvent(this, "> " + user.Nick + ": " + message); }
catch { Server.s.Log(">[Global] " + user.Nick + ": " + message); }*/
Player.GlobalMessage(String.Format("{0}>[Global] {1}: &f{2}", Server.GlobalChatColor, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
}
示例7: OnCtcpRequest
private void OnCtcpRequest( string command, UserInfo who )
{
if( DateTime.Now.ToFileTime() > nextTime )
{
switch( command )
{
case CtcpUtil.Finger:
connection.CtcpSender.CtcpReply( command, who.Nick, fingerMessage + " Idle time: " + FormatIdleTime() );
break;
case CtcpUtil.Time:
connection.CtcpSender.CtcpReply( command, who.Nick, FormatDateTime() );
break;
case CtcpUtil.UserInfo:
connection.CtcpSender.CtcpReply( command, who.Nick, userInfoMessage );
break;
case CtcpUtil.Version:
connection.CtcpSender.CtcpReply( command, who.Nick, versionMessage );
break;
case CtcpUtil.Source:
connection.CtcpSender.CtcpReply( command, who.Nick, sourceMessage );
break;
case CtcpUtil.ClientInfo:
connection.CtcpSender.CtcpReply( command, who.Nick, clientInfoMessage );
break;
default:
string error = command + " is not a supported Ctcp query.";
connection.CtcpSender.CtcpReply( command, who.Nick, error );
break;
}
UpdateTime();
}
}
示例8: Listener_OnJoin
void Listener_OnJoin(UserInfo user, string channel) {
connection.Sender.Names(channel);
doJoinLeaveMessage(user.Nick, "joined", channel);
}
示例9: Listener_OnPrivate
protected void Listener_OnPrivate(UserInfo user, string message)
{
HandleMessage("Private", HandlePrivateMessage, user, message);
}
示例10: HandlePrivateMessage
protected abstract void HandlePrivateMessage(UserInfo user, string message);
示例11: ParseReply
//.........这里部分代码省略.........
{
tokens[4] = RemoveLeadingColon( tokens[4] );
OnNickError( tokens[3], CondenseStrings( tokens, 4) );
}
break;
case ReplyCode.RPL_NOTOPIC:
if( OnError != null )
{
OnError(code, CondenseStrings( tokens, 3) );
}
break;
case ReplyCode.RPL_TOPIC:
if( OnTopicRequest != null )
{
tokens[4] = RemoveLeadingColon( tokens[4] );
OnTopicRequest( tokens[3], CondenseStrings(tokens, 4 ) );
}
break;
case ReplyCode.RPL_INVITING:
if( OnInviteSent != null )
{
OnInviteSent(tokens[3], tokens[4] );
}
break;
case ReplyCode.RPL_AWAY:
if( OnAway != null )
{
OnAway(tokens[3], RemoveLeadingColon( CondenseStrings( tokens, 4) ) );
}
break;
case ReplyCode.RPL_WHOREPLY:
if( OnWho != null )
{
UserInfo user = new UserInfo( tokens[7],tokens[4],tokens[5]);
OnWho(
user,
tokens[3],
tokens[6],
tokens[8],
int.Parse( RemoveLeadingColon( tokens[9] ), CultureInfo.InvariantCulture),
tokens[10],
false );
}
break;
case ReplyCode.RPL_ENDOFWHO:
if( OnWho != null )
{
OnWho( UserInfo.Empty , "","","",0,"",true);
}
break;
case ReplyCode.RPL_WHOISUSER:
UserInfo whoUser = new UserInfo( tokens[3], tokens[4], tokens[5]);
WhoisInfo whoisInfo = LookupInfo( whoUser.Nick );
whoisInfo.userInfo = whoUser;
tokens[7] = RemoveLeadingColon( tokens[7] );
whoisInfo.realName = CondenseStrings( tokens, 7) ;
break;
case ReplyCode.RPL_WHOISCHANNELS:
WhoisInfo whoisChannelInfo = LookupInfo( tokens[3] );
tokens[4] = RemoveLeadingColon( tokens[4] );
int numberOfChannels = tokens.Length - 4;
string[] channels = new String[ numberOfChannels ];
Array.Copy( tokens, 4, channels, 0 , numberOfChannels);
whoisChannelInfo.SetChannels( channels );
break;
case ReplyCode.RPL_WHOISSERVER:
示例12: Listener_OnKick
void Listener_OnKick(UserInfo user, string channel, string kickee, string reason)
{
if (kickee.Trim().ToLower() == nick.ToLower())
{
Server.s.Log("Kicked from Global Chat: " + reason);
Server.s.Log("Attempting to rejoin...");
connection.Sender.Join(channel);
}
}
示例13: Listener_OnKick
void Listener_OnKick(UserInfo user, string channel, string kickee, string reason) {
List<string> chanNicks = GetNicks(channel);
RemoveNick(user.Nick, chanNicks);
}
示例14: Listener_OnChannelModeChange
void Listener_OnChannelModeChange(UserInfo who, string channel, ChannelModeInfo[] modes) {
connection.Sender.Names(channel);
}
示例15: Listener_OnNick
void Listener_OnNick(UserInfo user, string newNick) {
//Player.GlobalMessage(Server.IRCColour + "[IRC] " + user.Nick + " changed nick to " + newNick);
if (newNick.Trim() == "") {
this.Pm(user.Nick, "You cannot have that username");
return;
}
foreach (var kvp in users) {
int index = GetNickIndex(user.Nick, kvp.Value);
if (index >= 0) {
string prefix = GetPrefix(kvp.Value[index]);
kvp.Value[index] = prefix + newNick;
} else {
// should never happen, but just in case.
connection.Sender.Names(kvp.Key);
}
}
string key;
if (newNick.Split('|').Length == 2) {
key = newNick.Split('|')[1];
if (key != null && key != "") {
switch (key) {
case "AFK":
Player.GlobalMessage("[IRC] %I" + user.Nick + Server.DefaultColor + " is AFK"); Server.ircafkset.Add(user.Nick); break;
case "Away":
Player.GlobalMessage("[IRC] %I" + user.Nick + Server.DefaultColor + " is Away"); Server.ircafkset.Add(user.Nick); break;
}
}
}
else if (Server.ircafkset.Contains(newNick)) {
Player.GlobalMessage("[IRC] %I" + newNick + Server.DefaultColor + " is back");
Server.ircafkset.Remove(newNick);
}
else
Player.GlobalMessage("[IRC] %I" + user.Nick + Server.DefaultColor + " is now known as " + newNick);
}