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

Use realname of identity (Workaround for PircBot handling version as real name)

This commit is contained in:
Sebastian Kaspari 2010-03-13 15:17:32 +01:00
parent 01f03747b0
commit 80a5e56294
2 changed files with 35 additions and 4 deletions

View File

@ -20,6 +20,10 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.irc;
import java.io.IOException;
import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException;
import org.yaaic.model.Server;
import android.os.Binder;
@ -62,11 +66,18 @@ public class IRCBinder extends Binder
connection.setNickname(server.getIdentity().getNickname());
connection.setIdent(server.getIdentity().getIdent());
connection.setRealName(server.getIdentity().getRealName());
connection.connect(server.getHost());
connection.connect(server.getHost(), server.getPort());
}
catch (Exception e) {
Log.d(TAG, "Exception: " + e.getMessage());
catch (NickAlreadyInUseException e) {
Log.d(TAG, "NickAlreadyInUseException: " + e.getMessage());
}
catch (IrcException e) {
Log.d(TAG, "IrcException: " + e.getMessage());
}
catch (IOException e) {
Log.d(TAG, "IOException: " + e.getMessage());
}
}
}.start();

View File

@ -61,7 +61,6 @@ public class IRCConnection extends PircBot
this.service = service;
this.setAutoNickChange(true);
this.setVersion("Yaaic - Yet another Android IRC client - http://www.yaaic.org");
}
/**
@ -73,6 +72,27 @@ public class IRCConnection extends PircBot
{
this.setName(nickname);
}
public void setRealName(String realname)
{
// XXX: Pircbot uses the version for "real name" and "version".
// The real "version" value is provided by onVersion()
this.setVersion(realname);
}
/**
* On version (CTCP version)
*
* This is a fix for pircbot as pircbot uses the version as "real name" and as "version"
*/
@Override
protected void onVersion(String sourceNick, String sourceLogin, String sourceHostname, String target) {
this.sendRawLine(
"NOTICE " + sourceNick + " :\u0001VERSION " +
"Yaaic - Yet another Android IRC client - http://www.yaaic.org" +
"\u0001"
);
}
/**
* Set the ident of the user