mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-25 18:32:15 -05:00
On own nick change: Display message in server info window (Your are now known as ...). Fixes #51.
This commit is contained in:
parent
c6dbe8cc18
commit
50a6047edd
@ -124,6 +124,7 @@
|
||||
<string name="message_join">%1$s joins</string>
|
||||
<string name="message_kick">%1$s kicks %2$s</string>
|
||||
<string name="message_rename">%1$s is now known as %2$s</string>
|
||||
<string name="message_self_rename">You are now known as %1$s</string>
|
||||
<string name="message_op">%1$s ops %2$s</string>
|
||||
<string name="message_part">%1$s parts</string>
|
||||
<string name="message_quit">%1$s quits (%2$s)</string>
|
||||
|
@ -877,13 +877,26 @@ public abstract class PircBot implements ReplyConstants {
|
||||
String errorStr = token;
|
||||
String response = line.substring(line.indexOf(errorStr, senderInfo.length()) + 4, line.length());
|
||||
|
||||
this.processServerResponse(code, response);
|
||||
|
||||
if (code == 433 && !_registered) {
|
||||
if (_autoNickChange) {
|
||||
String oldNick = _nick;
|
||||
|
||||
List<String> aliases = getAliases();
|
||||
_autoNickTries++;
|
||||
_nick = ((_autoNickTries - 1) <= aliases.size()) ?
|
||||
aliases.get(_autoNickTries - 2) :
|
||||
getName() + (_autoNickTries - aliases.size());
|
||||
|
||||
if (_autoNickTries - 1 <= aliases.size()) {
|
||||
// Try next alias
|
||||
_nick = aliases.get(_autoNickTries - 2);
|
||||
} else {
|
||||
// Append a number to the nickname
|
||||
_nick = getName() + (_autoNickTries - aliases.size());
|
||||
}
|
||||
|
||||
// Notify ourself about the change
|
||||
this.onNickChange(oldNick, getLogin(), "", _nick);
|
||||
|
||||
this.sendRawLineViaQueue("NICK " + _nick);
|
||||
}
|
||||
else {
|
||||
@ -893,8 +906,6 @@ public abstract class PircBot implements ReplyConstants {
|
||||
}
|
||||
}
|
||||
|
||||
this.processServerResponse(code, response);
|
||||
// Return from the method.
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -455,6 +455,19 @@ public class IRCConnection extends PircBot
|
||||
{
|
||||
if (getNick().equalsIgnoreCase(newNick)) {
|
||||
this.updateNickMatchPattern();
|
||||
|
||||
// Send message about own change to server info window
|
||||
Message message = new Message(service.getString(R.string.message_self_rename, newNick));
|
||||
message.setColor(Message.COLOR_GREEN);
|
||||
server.getConversation(ServerInfo.DEFAULT_NAME).addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
ServerInfo.DEFAULT_NAME
|
||||
);
|
||||
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
Vector<String> channels = getChannelsByNickname(newNick);
|
||||
|
Loading…
Reference in New Issue
Block a user