Skip to content

Commit 20637dc

Browse files
author
xnrand
committed
(genericircbot) Implement hook for 001 numeric
1 parent 0c6e070 commit 20637dc

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/main/java/genericircbot/IRCMethods.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,25 @@ protected void onNickChange(String sender, String newnick) {
125125
/**
126126
* Called when the bot has established a connection to IRC and can send
127127
* commands.
128+
* <p>
129+
* <strong>Note:</strong> Refer to {@link AbstractIRCBot} for notes on thread
130+
* safety.
131+
*/
132+
protected void onConnect() {
133+
/* can be overridden */
134+
}
135+
136+
/**
137+
* Called when the bot has established a connection to IRC and registration has
138+
* finished (a 001 numeric is received).
128139
*
129140
* It makes sense to {@link AbstractIRCBot#joinChannel(String) join channels} in
130141
* implementations of this method.
131142
* <p>
132143
* <strong>Note:</strong> Refer to {@link AbstractIRCBot} for notes on thread
133144
* safety.
134145
*/
135-
protected void onConnect() {
146+
protected void onNumeric001() {
136147
/* can be overridden */
137148
}
138149
}

src/main/java/genericircbot/IRCThread.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ private void handleLine(String line) throws FormatFieldNotFoundException {
169169
pingpong[1] = 'O';
170170
this.bot.sendRawLine(new String(pingpong));
171171
}
172+
} else if (line.matches("^:[^ ]+ 001 .*")) {
173+
this.bot.onNumeric001();
172174
}
173175
}
174176

0 commit comments

Comments
 (0)