Page 1 of 1

Staff IRC channel

Posted: September 10th, 2012, 2:34 am
by nope__avi
Have the option to have all staff-chat forwarded to a separate IRC channel. This would allow for people on IRC (which is usually mostly server staff) to communicate privately to staff members in-game without the people in-game having to switch between IRC and Minecraft. You could then set the IRC channel up to be invite-only or whatever.

Re: Staff IRC channel

Posted: September 10th, 2012, 7:19 am
by Sanjar Khan
We did that with a bot

Re: Staff IRC channel

Posted: September 10th, 2012, 3:46 pm
by Hellenion
It's an interesting idea for sure, though it may be insecure when not configured well.

Though, the security on the IRC network end isn't really fCraft's problem.
Sanjar Khan wrote:We did that with a bot
Sanjar, I am sometimes completely baffled and confused by your replies.

Re: Staff IRC channel

Posted: September 10th, 2012, 5:00 pm
by Sanjar Khan
Just saying, you could use a bot to forward it like Hafnium did with HBOT.

Re: Staff IRC channel

Posted: September 10th, 2012, 7:25 pm
by nope__avi
Hellenion wrote:Though, the security on the IRC network end isn't really fCraft's problem.
It would be up to the server owner to configure the IRC channel to keep it secure.
Sanjar Khan wrote:We did that with a bot
Not everyone knows how to set up a bot to do it (I certainly don't). Also, just because you can do it with a bot doesn't mean it shouldn't be integrated with fCraft.

Re: Staff IRC channel

Posted: September 10th, 2012, 8:04 pm
by boblol0909
If you are able to mod your fcraft and want a quick fix, this will send public messages to all the channels that do not end in "staff" and all the staff messages to channels that end in "staff" (e.g. you could have two channels #myserver and #myserver.staff).

(I'm not sure if this is the latest version, but I assume IRC code hasnt been changed recently.)

On line 570 of IRC.cs, find this:

Code: Select all

case ChatMessageType.Global:
                    if( enabled ) {
                        SendChannelMessage( args.Player.ClassyName + Color.IRCReset + ": " + args.Message );
                    } else if( args.Message.StartsWith( "#" ) ) {
                        SendChannelMessage( args.Player.ClassyName + Color.IRCReset + ": " + args.Message.Substring( 1 ) );
                    }
                    break;
and immediately after it on the next line add:

Code: Select all

case ChatMessageType.Staff:
                    if( enabled ) {
                        SendStaffChannelMessage( args.Player.ClassyName + Color.IRCReset + ": " + args.Message );
                    } else if( args.Message.StartsWith( "#" ) ) {
                        SendStaffChannelMessage( args.Player.ClassyName + Color.IRCReset + ": " + args.Message.Substring( 1 ) );
                    }
                    break;
On line 482 of the same file, find:

Code: Select all

public static void SendChannelMessage( [NotNull] string line ) {
            if( line == null ) throw new ArgumentNullException( "line" );
            if( channelNames == null ) return; // in case IRC bot is disabled.
            if( ConfigKey.IRCUseColor.Enabled() ) {
                line = Color.ToIRCColorCodes( line );
            } else {
                line = NonPrintableChars.Replace( line, "" ).Trim();
            }
            for( int i = 0; i < channelNames.Length; i++ ) {
                  SendRawMessage(IRCCommands.Privmsg(channelNames[i], line));                
            }
        }
Delete it and paste the following right there:

Code: Select all

public static void SendChannelMessage( [NotNull] string line ) {
            if( line == null ) throw new ArgumentNullException( "line" );
            if( channelNames == null ) return; // in case IRC bot is disabled.
            if( ConfigKey.IRCUseColor.Enabled() ) {
                line = Color.ToIRCColorCodes( line );
            } else {
                line = NonPrintableChars.Replace( line, "" ).Trim();
            }
            for( int i = 0; i < channelNames.Length; i++ ) {
                if (!channelNames[i].EndsWith("staff")) {
                    SendRawMessage(IRCCommands.Privmsg(channelNames[i], line));
                }
            }
        }

        public static void SendStaffChannelMessage(string line) {
            if (line == null) throw new ArgumentNullException("line");
            if (channelNames == null) return;
            if (ConfigKey.IRCUseColor.Enabled()) {
                line = Color.ToIRCColorCodes(line);
            }
            else {
                line = NonPrintableChars.Replace(line, "").Trim();
            }
            for (int i = 0; i < channelNames.Length; i++) {
                if (channelNames[i].EndsWith("staff")) {
                    SendRawMessage(IRCCommands.Privmsg(channelNames[i], line));
                }
            }
        }

Re: Staff IRC channel

Posted: September 10th, 2012, 9:15 pm
by fragmer
(Note that modded copies of fCraft are not supported. Use at your own risk.)