Closed GoogleCodeExporter closed 9 years ago
The link above is not working anymore, but basically the configuration should
accept of list of ports instead of a single one, and the connect() should
handle it nicely.
Suggestion: be able to retrieve the connected port in ServerInfo or another
helpful class.
Original comment by emmanuel...@gmail.com
on 17 Dec 2013 at 12:08
I've considered doing this, but ultimately it seemed very complex to implement
in the core Configuration class that was clear without over complicating things
Basically I'd be creating a list of servers and having PircBotX loop through
them. That's simple, but where do I stop? First I have addServer(port). Then it
just keeps getting more complex when you ask yourself "What could you want to
change on the next server connect?"
- addServer(hostname, port)
- addServer(sslSocketFactory, hostname, port)
- addServer(sslSocketFactory, hostname, port, password)
- addServer(sslSocketFactory, hostname, port, password, nick)
- addServer(sslSocketFActory, hostname, port, password, nick, ...)
It will just keep on going. There's a use case for almost every option in
Configuration to change on the next connect. There's also retrying and
timeouts; should I go on to the next server on reconnect? What about
exceptions?
I really recommend "template" configurations. This allows you to configure
PircBotX how you want without any pre-determined list of options you can
change.
Original comment by Lord.Qua...@gmail.com
on 17 Dec 2013 at 2:24
Thanks for your answer!
I don't really agree that there are a lot of cases when trying with different
ports. There is no reason why the user should be able to addServer() to a
configuration.
I was thinking more about having the following methods:
setServer(String host, List<Integer> ports);
setServer(String host, List<Integer> ports, String password);
setServerPorts(List<Integer> ports);
[same for buildForServer() methods]
Why? Because some IRC networks support several ports that do not depend on any
other server configuration. Typically, if I try to connect to Quakenet, I'd
like to try the 6667-6669 ports without having to copy my Configuration each
time. Trying to connect on these ports should not require any other
Configuration change besides the port.
Obviously, trying to connect to a different hostname would be a different
story. If you want to support it, you might consider adding an addServer()
method that takes a ServerParameters object as parameter (for example).
Original comment by emmanuel...@gmail.com
on 17 Dec 2013 at 9:19
This has been implemented in Revision 2431658b032d. Configuration has a list of
hostnames and ports that you add with addServer("irc.freenode.net", 6667)
Original comment by Lord.Qua...@gmail.com
on 21 Nov 2014 at 10:16
Original issue reported on code.google.com by
ec...@google.com
on 13 Dec 2013 at 8:01