m.onServer(server, params);
}
- if (server != null || user != null)
- {
- /*
- * Message class will take care of backwards compatibility
- * for stuff still using redundant checks.
- */
- m.on(server, user, params);
- }
- else
- {
- m.on(source, params);
- }
+ m.on(source, params);
}
public static void run() throws InterruptedException
public void onServer(Server source, String[] params) { }
public void on(String source, String[] params) { }
- /*
- * handle a message that could come from either UID or SID and matched
- * either one of them.
- */
- public void on(Server server, User user, String[] params) {
- /* default implementation for backwards compat */
- if (user != null && server == null)
- {
- on(user.getNick(), params);
- }
- else if (server != null && user == null)
- {
- on(server.getName(), params);
- }
- else
- {
- /*
- * both server and user are set, this shouldn't be possible
- * unless something got changed in AcidCore. or both are null
- * which shouldn't be possible either.
- */
- throw new RuntimeException("both server and user are not null or both are null");
- }
-
- }
-
private static HashMap<String, Message> messages;
public static Message findMessage(String name)
* Support for TS6 TMODE.
* Format is :<SID|UID> TMODE <TS> <CHANNAME> <MODESTRING>
*/
-
package net.rizon.acid.messages;
import net.rizon.acid.core.Acidictive;
super("TMODE");
}
- @Override
- public void on(Server server, User user, String[] params)
+ private void run(String source, String[] params)
{
Channel chan = Channel.findChannel(params[1]);
if (chan == null || shouldDropTsMessage(chan.getTS(), params[0]))
+ {
return;
+ }
String modes = params[2];
for (int i = 3; i < params.length; i++)
+ {
modes += " " + params[i];
+ }
Acidictive.onChanMode(
- user != null ? user.getNick() : server.getName(),
+ source,
chan,
modes);
if (chan.size() == 0 && !chan.hasMode('z'))
+ {
chan.destroy();
+ }
+ }
+
+ @Override
+ public void onUser(User source, String[] params)
+ {
+ run(source.getNick(), params);
+ }
+
+ @Override
+ public void onServer(Server source, String[] params)
+ {
+ run(source.getName(), params);
}
-}
\ No newline at end of file
+}