Staff IRC channel

Post all ideas and suggestions for fCraft here
Post Reply
nope__avi
Offline
Posts: 25
Joined: April 3rd, 2012, 1:08 am

Staff IRC channel

Post 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.
nope__avi

User avatar
Sanjar Khan
Trustee
Offline
Posts: 1766
Joined: May 24th, 2011, 1:40 pm
Location: Leiden, Zuid Holland

Re: Staff IRC channel

Post by Sanjar Khan »

We did that with a bot
Ferrisbuler2: i will stay but i might not post cus of ollieboy

User avatar
Hellenion
Offline
Posts: 220
Joined: October 20th, 2011, 9:20 am
Location: Subnet
Contact:

Re: Staff IRC channel

Post 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.
A = {x ∈ P(U) | x ∉ x}
Mods:
  1. /Su - Allows players to temporarily become a different rank
  2. /Snap - Like /Line but only draws straight or diagonal lines.
  3. pre-0.630 skip/none block

User avatar
Sanjar Khan
Trustee
Offline
Posts: 1766
Joined: May 24th, 2011, 1:40 pm
Location: Leiden, Zuid Holland

Re: Staff IRC channel

Post by Sanjar Khan »

Just saying, you could use a bot to forward it like Hafnium did with HBOT.
Ferrisbuler2: i will stay but i might not post cus of ollieboy

nope__avi
Offline
Posts: 25
Joined: April 3rd, 2012, 1:08 am

Re: Staff IRC channel

Post 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.
nope__avi

User avatar
boblol0909
SupOP
Offline
Posts: 314
Joined: June 24th, 2011, 10:27 pm

Re: Staff IRC channel

Post 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));
                }
            }
        }

User avatar
fragmer
fCraft Developer
Offline
Posts: 1386
Joined: May 21st, 2011, 10:53 pm

Re: Staff IRC channel

Post by fragmer »

(Note that modded copies of fCraft are not supported. Use at your own risk.)

Post Reply