1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-25 18:32:15 -05:00

Post unknown messages to the server info window

This commit is contained in:
Sebastian Kaspari 2010-03-13 21:16:32 +01:00
parent 9f0ad056a0
commit d321e2930f
2 changed files with 25 additions and 1 deletions

View File

@ -73,6 +73,11 @@ public class IRCConnection extends PircBot
this.setName(nickname); this.setName(nickname);
} }
/**
* Set the real name of the user
*
* @param realname The realname to use
*/
public void setRealName(String realname) public void setRealName(String realname)
{ {
// XXX: Pircbot uses the version for "real name" and "version". // XXX: Pircbot uses the version for "real name" and "version".
@ -86,7 +91,8 @@ public class IRCConnection extends PircBot
* This is a fix for pircbot as pircbot uses the version as "real name" and as "version" * This is a fix for pircbot as pircbot uses the version as "real name" and as "version"
*/ */
@Override @Override
protected void onVersion(String sourceNick, String sourceLogin, String sourceHostname, String target) { protected void onVersion(String sourceNick, String sourceLogin, String sourceHostname, String target)
{
this.sendRawLine( this.sendRawLine(
"NOTICE " + sourceNick + " :\u0001VERSION " + "NOTICE " + sourceNick + " :\u0001VERSION " +
"Yaaic - Yet another Android IRC client - http://www.yaaic.org" + "Yaaic - Yet another Android IRC client - http://www.yaaic.org" +
@ -543,6 +549,23 @@ public class IRCConnection extends PircBot
service.sendBroadcast(intent); service.sendBroadcast(intent);
} }
/**
* On unknown
*/
@Override
protected void onUnknown(String line)
{
Message message = new Message(line);
message.setIcon(R.drawable.action);
message.setColor(Message.COLOR_GREY);
server.getConversation(ServerInfo.DEFAULT_NAME).addMessage(message);
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
intent.putExtra(Broadcast.EXTRA_CONVERSATION, ServerInfo.DEFAULT_NAME);
service.sendBroadcast(intent);
}
/** /**
* On disconnect * On disconnect
*/ */

View File

@ -41,6 +41,7 @@ public class Message {
public static final int COLOR_RED = 0xFFcc0000; public static final int COLOR_RED = 0xFFcc0000;
public static final int COLOR_BLUE = 0xFF729fcf; public static final int COLOR_BLUE = 0xFF729fcf;
public static final int COLOR_YELLOW = 0xFFbe9b01; public static final int COLOR_YELLOW = 0xFFbe9b01;
public static final int COLOR_GREY = 0xFFaaaaaa;
private int icon = -1; private int icon = -1;
private String text; private String text;