raisedragon / pircbotx

Automatically exported from code.google.com/p/pircbotx
0 stars 0 forks source link

Channels not detecting invite only? #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've been attempting to check if a channel is invite only, and it doesnt seem 
to be working

I was trying to see if a channel is invite only, the irc network ive been using 
was running InspIRCD with Anope services, if that matters at all.

<zack6849> $join #test
<zack6849> $exec bot.sendMessage(chan,"" +  
bot.getChannel("#test").isInviteOnly());
<AlphabotV2> false

Console output:

1380629490081 <<<:zack6849!zack6849@192.95.15.190 PRIVMSG #bots :$join #test
1380629493059 <<<:zack6849!zack6849@192.95.15.190 PRIVMSG #bots :$exec 
bot.sendMessage(chan,"" +  bot.getChannel("#test").isInviteOnly());
1380629493064 >>>PRIVMSG #bots :false
1380629499744 <<<:zack6849!zack6849@192.95.15.190 PRIVMSG #bots :$exec 
bot.sendMessage(chan,"" +  bot.getChannel("#test").getMode());
1380629499745 >>>PRIVMSG #bots :
1380629499873 <<<:malice.seion.us 412 AlphabotV2 :No text to send

The channel has mode +i, and that's the default invite only mode for pretty 
much any IRCD i've ever used, so why isnt it showing the channel as invite 
only? if the related code is needed, here it is

package com.zack6849.alphabot.commands;
import com.zack6849.alphabot.api.*;
import org.pircbotx.Channel;
import org.pircbotx.User;
import org.pircbotx.hooks.events.MessageEvent;

public class Join extends Command {

    private Config config;
    private PermissionManager manager;

    public Join() {
        super("Join");
    }

    @Override
    public void execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        User sender = event.getUser();
        if(args.length == 2){
            Channel target = event.getBot().getChannel(args[1]);
            if(!target.isInviteOnly()){
                event.getBot().joinChannel(args[2]);
            }else{
                event.getBot().sendRawLineNow("KNOCK " + target.getName() + " :Asked to join by " + event.getUser().getNick());
            }
        }
    }

    @Override
    public void setConfig(Config config) {
        this.config = config;
    }

    @Override
    public void setManager(PermissionManager manager) {
        this.manager = manager;
    }
}

Original issue reported on code.google.com by zcrai...@gmail.com on 1 Oct 2013 at 12:12

GoogleCodeExporter commented 9 years ago
Not sure how I missed this. I've done a big upgrade to the mode handling system 
that I wanted to do for a while so now all modes are handled correctly, and its 
even user expandable. 

Original comment by Lord.Qua...@gmail.com on 14 Oct 2013 at 11:31