1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2025-01-08 12:18:07 -05:00

(Authentication) GUI for NickServ and SASL

This commit is contained in:
Sebastian Kaspari 2011-03-06 13:47:14 +01:00
parent 571090aa13
commit 2fde7559e3
15 changed files with 563 additions and 76 deletions

View File

@ -88,6 +88,10 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:name=".activity.UserActivity"
android:theme="@android:style/Theme.Dialog">
</activity>
<activity
android:name=".activity.AuthenticationActivity"
android:theme="@android:style/Theme.Dialog">
</activity>
<service android:name=".irc.IRCService"></service>
</application>
<uses-sdk android:minSdkVersion="4" />

View File

@ -1,4 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Yaaic - Yet Another Android IRC Client
Copyright 2009-2011 Sebastian Kaspari
This file is part of Yaaic.
Yaaic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Yaaic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"

View File

@ -1,4 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Yaaic - Yet Another Android IRC Client
Copyright 2009-2011 Sebastian Kaspari
This file is part of Yaaic.
Yaaic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Yaaic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/host"
android:layout_width="fill_parent"

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Yaaic - Yet Another Android IRC Client
Copyright 2009-2011 Sebastian Kaspari
This file is part of Yaaic.
Yaaic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Yaaic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Yaaic will authenticate you with these services after connect."
android:padding="5dp" />
<CheckBox
android:id="@+id/nickserv_checkbox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Authenticate with Nickserv" />
<TextView
android:id="@+id/nickserv_label_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Nickserv password"
android:enabled="false" />
<EditText
android:id="@+id/nickserv_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:password="true" />
<CheckBox
android:id="@+id/sasl_checkbox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Authenticate via SASL" />
<TextView
android:id="@+id/sasl_label_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="SASL username"
android:enabled="false" />
<EditText
android:id="@+id/sasl_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:enabled="false" />
<TextView
android:id="@+id/sasl_label_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="SASL password"
android:enabled="false"/>
<EditText
android:id="@+id/sasl_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:password="true" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ok"
android:text="@string/action_ok"
android:minWidth="90dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cancel"
android:text="@string/action_cancel"
android:minWidth="90dp" />
</LinearLayout>
</LinearLayout>

View File

@ -152,6 +152,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:gravity="center_horizontal"
android:padding="3dp"
android:layout_margin="2dp" />
<Button
android:id="@+id/authentication"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/authentication" />
<Button
android:id="@+id/channels"
android:layout_width="fill_parent"

View File

@ -29,6 +29,7 @@
<string name="realname">Real Name</string>
<string name="server">Server</string>
<string name="authentication">Authentication</string>
<string name="channel">Channel</string>
<string name="channels">Channels</string>
<string name="commands">Commands</string>

View File

@ -28,6 +28,7 @@ import org.yaaic.R;
import org.yaaic.Yaaic;
import org.yaaic.db.Database;
import org.yaaic.exception.ValidationException;
import org.yaaic.model.Authentication;
import org.yaaic.model.Extra;
import org.yaaic.model.Identity;
import org.yaaic.model.Server;
@ -56,8 +57,10 @@ public class AddServerActivity extends Activity implements OnClickListener
private static final int REQUEST_CODE_CHANNELS = 1;
private static final int REQUEST_CODE_COMMANDS = 2;
private static final int REQUEST_CODE_ALIASES = 3;
private static final int REQUEST_CODE_AUTHENTICATION = 4;
private Server server;
private Authentication authentication;
private ArrayList<String> aliases;
private ArrayList<String> channels;
private ArrayList<String> commands;
@ -71,6 +74,8 @@ public class AddServerActivity extends Activity implements OnClickListener
super.onCreate(savedInstanceState);
setContentView(R.layout.serveradd);
authentication = new Authentication();
aliases = new ArrayList<String>();
channels = new ArrayList<String>();
commands = new ArrayList<String>();
@ -80,6 +85,7 @@ public class AddServerActivity extends Activity implements OnClickListener
((Button) findViewById(R.id.aliases)).setOnClickListener(this);
((Button) findViewById(R.id.channels)).setOnClickListener(this);
((Button) findViewById(R.id.commands)).setOnClickListener(this);
((Button) findViewById(R.id.authentication)).setOnClickListener(this);
Spinner spinner = (Spinner) findViewById(R.id.charset);
String[] charsets = getResources().getStringArray(R.array.charsets);
@ -95,6 +101,7 @@ public class AddServerActivity extends Activity implements OnClickListener
aliases.addAll(server.getIdentity().getAliases());
this.channels = db.getChannelsByServerId(server.getId());
this.commands = db.getCommandsByServerId(server.getId());
this.authentication = server.getAuthentication();
db.close();
// Set server values
@ -153,6 +160,12 @@ public class AddServerActivity extends Activity implements OnClickListener
case REQUEST_CODE_COMMANDS:
commands = data.getExtras().getStringArrayList(Extra.COMMANDS);
break;
case REQUEST_CODE_AUTHENTICATION:
authentication.setSaslUsername(data.getExtras().getString(Extra.SASL_USER));
authentication.setSaslPassword(data.getExtras().getString(Extra.SASL_PASSWORD));
authentication.setNickservPassword(data.getExtras().getString(Extra.NICKSERV_PASSWORD));
break;
}
}
@ -169,6 +182,14 @@ public class AddServerActivity extends Activity implements OnClickListener
startActivityForResult(aliasIntent, REQUEST_CODE_ALIASES);
break;
case R.id.authentication:
Intent authIntent = new Intent(this, AuthenticationActivity.class);
authIntent.putExtra(Extra.NICKSERV_PASSWORD, authentication.getNickservPassword());
authIntent.putExtra(Extra.SASL_USER, authentication.getSaslUsername());
authIntent.putExtra(Extra.SASL_PASSWORD, authentication.getSaslPassword());
startActivityForResult(authIntent, REQUEST_CODE_AUTHENTICATION);
break;
case R.id.channels:
Intent channelIntent = new Intent(this, AddChannelActivity.class);
channelIntent.putExtra(Extra.CHANNELS, channels);
@ -220,16 +241,9 @@ public class AddServerActivity extends Activity implements OnClickListener
);
Server server = getServerFromView();
long serverId = db.addServer(
server.getTitle(),
server.getHost(),
server.getPort(),
server.getPassword(),
false, // auto connect
server.useSSL(),
identityId,
server.getCharset()
);
server.setAuthentication(authentication);
long serverId = db.addServer(server, (int) identityId);
db.setChannels((int) serverId, channels);
db.setCommands((int) serverId, commands);
@ -255,17 +269,8 @@ public class AddServerActivity extends Activity implements OnClickListener
int identityId = db.getIdentityIdByServerId(serverId);
Server server = getServerFromView();
db.updateServer(
serverId,
server.getTitle(),
server.getHost(),
server.getPort(),
server.getPassword(),
false, // auto connect
server.useSSL(),
identityId,
server.getCharset()
);
server.setAuthentication(authentication);
db.updateServer(serverId, server, identityId);
Identity identity = getIdentityFromView();
db.updateIdentity(

View File

@ -0,0 +1,159 @@
/*
Yaaic - Yet Another Android IRC Client
Copyright 2009-2011 Sebastian Kaspari
This file is part of Yaaic.
Yaaic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Yaaic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.activity;
import org.yaaic.R;
import org.yaaic.model.Extra;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;
/**
* Authentication activity for entering nickserv / sasl usernames and password
* for a given server.
*
* @author Sebastian Kaspari <sebastian@yaaic.org>
*/
public class AuthenticationActivity extends Activity implements OnCheckedChangeListener, OnClickListener
{
private CheckBox nickservCheckbox;
private TextView nickservPasswordLabel;
private EditText nickservPasswordEditText;
private CheckBox saslCheckbox;
private TextView saslUsernameLabel;
private EditText saslUsernameEditText;
private TextView saslPasswordLabel;
private EditText saslPasswordEditText;
/**
* On create
*/
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.authentication);
nickservCheckbox = (CheckBox) findViewById(R.id.nickserv_checkbox);
nickservPasswordLabel = (TextView) findViewById(R.id.nickserv_label_password);
nickservPasswordEditText = (EditText) findViewById(R.id.nickserv_password);
saslCheckbox = (CheckBox) findViewById(R.id.sasl_checkbox);
saslUsernameLabel = (TextView) findViewById(R.id.sasl_label_username);
saslUsernameEditText = (EditText) findViewById(R.id.sasl_username);
saslPasswordLabel = (TextView) findViewById(R.id.sasl_label_password);
saslPasswordEditText = (EditText) findViewById(R.id.sasl_password);
nickservCheckbox.setOnCheckedChangeListener(this);
saslCheckbox.setOnCheckedChangeListener(this);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String nickservPassword = extras.getString(Extra.NICKSERV_PASSWORD);
if (nickservPassword != null && nickservPassword.length() > 0) {
nickservCheckbox.setChecked(true);
nickservPasswordEditText.setText(nickservPassword);
}
String saslUsername = extras.getString(Extra.SASL_USER);
String saslPassword = extras.getString(Extra.SASL_PASSWORD);
if (saslUsername != null && saslUsername.length() > 0) {
saslCheckbox.setChecked(true);
saslUsernameEditText.setText(saslUsername);
saslPasswordEditText.setText(saslPassword);
}
}
((Button) findViewById(R.id.ok)).setOnClickListener(this);
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
}
/**
* On checkbox changed
*/
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
switch (buttonView.getId()) {
case R.id.nickserv_checkbox:
nickservPasswordLabel.setEnabled(isChecked);
nickservPasswordEditText.setEnabled(isChecked);
if (!isChecked) {
nickservPasswordEditText.setText("");
}
break;
case R.id.sasl_checkbox:
saslUsernameLabel.setEnabled(isChecked);
saslUsernameEditText.setEnabled(isChecked);
saslPasswordLabel.setEnabled(isChecked);
saslPasswordEditText.setEnabled(isChecked);
if (!isChecked) {
saslUsernameEditText.setText("");
saslPasswordEditText.setText("");
}
break;
}
}
/**
* On click on button
*/
@Override
public void onClick(View v)
{
switch (v.getId()) {
case R.id.ok:
Intent intent = new Intent();
intent.putExtra(Extra.NICKSERV_PASSWORD, nickservPasswordEditText.getText().toString());
intent.putExtra(Extra.SASL_USER, saslUsernameEditText.getText().toString());
intent.putExtra(Extra.SASL_PASSWORD, saslPasswordEditText.getText().toString());
setResult(RESULT_OK, intent);
finish();
break;
case R.id.cancel:
setResult(RESULT_CANCELED);
finish();
break;
}
}
}

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.yaaic.model.Authentication;
import org.yaaic.model.Identity;
import org.yaaic.model.Server;
import org.yaaic.model.Status;
@ -43,7 +44,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class Database extends SQLiteOpenHelper
{
private static final String DATABASE_NAME = "servers.db";
private static final int DATABASE_VERSION = 4;
private static final int DATABASE_VERSION = 5;
/**
* Create a new helper for database access
@ -70,7 +71,10 @@ public class Database extends SQLiteOpenHelper
+ ServerConstants.AUTOCONNECT + " BOOLEAN, "
+ ServerConstants.USE_SSL + " BOOLEAN, "
+ ServerConstants.CHARSET + " TEXT, "
+ ServerConstants.IDENTITY + " INTEGER"
+ ServerConstants.IDENTITY + " INTEGER, "
+ ServerConstants.NICKSERV_PASSWORD + " TEXT, "
+ ServerConstants.SASL_USERNAME + " TEXT, "
+ ServerConstants.SASL_PASSWORD + " TEXT"
+ ");"
);
@ -145,32 +149,41 @@ public class Database extends SQLiteOpenHelper
+ AliasConstants.IDENTITY + " INTEGER"
+ ");"
);
oldVersion = 4;
}
if (oldVersion == 4) {
// Add authentication fields to database
db.execSQL("ALTER TABLE " + ServerConstants.TABLE_NAME + " ADD " + ServerConstants.NICKSERV_PASSWORD + " TEXT AFTER " + ServerConstants.CHARSET + ";");
db.execSQL("ALTER TABLE " + ServerConstants.TABLE_NAME + " ADD " + ServerConstants.SASL_USERNAME + " TEXT AFTER " + ServerConstants.NICKSERV_PASSWORD + ";");
db.execSQL("ALTER TABLE " + ServerConstants.TABLE_NAME + " ADD " + ServerConstants.SASL_PASSWORD + " TEXT AFTER " + ServerConstants.SASL_USERNAME + ";");
}
}
/**
* Add a new server to the database
*
* @param title Unique title of the server
* @param host Hostname of the server
* @param port Port (default: 3337)
* @param password Password if needed
* @param autoConnect Autoconnect to this server on startup?
* @param useSSL Does the server use SSL?
* @param identityId The id of the identity record
* @param server The server to add.
* @param identityId The id of the assigned identity
*/
public long addServer(String title, String host, int port, String password, boolean autoConnect, boolean useSSL, long identityId, String charset)
public long addServer(Server server, int identityId)
{
ContentValues values = new ContentValues();
values.put(ServerConstants.TITLE, title);
values.put(ServerConstants.HOST, host);
values.put(ServerConstants.PORT, port);
values.put(ServerConstants.PASSWORD, password);
values.put(ServerConstants.AUTOCONNECT, autoConnect);
values.put(ServerConstants.USE_SSL, useSSL);
values.put(ServerConstants.TITLE, server.getTitle());
values.put(ServerConstants.HOST, server.getHost());
values.put(ServerConstants.PORT, server.getPort());
values.put(ServerConstants.PASSWORD, server.getPassword());
values.put(ServerConstants.AUTOCONNECT, false);
values.put(ServerConstants.USE_SSL, server.useSSL());
values.put(ServerConstants.IDENTITY, identityId);
values.put(ServerConstants.CHARSET, charset);
values.put(ServerConstants.CHARSET, server.getCharset());
Authentication authentication = server.getAuthentication();
values.put(ServerConstants.NICKSERV_PASSWORD, authentication.getNickservPassword());
values.put(ServerConstants.SASL_USERNAME, authentication.getSaslUsername());
values.put(ServerConstants.SASL_PASSWORD, authentication.getSaslPassword());
return this.getWritableDatabase().insert(ServerConstants.TABLE_NAME, null, values);
}
@ -178,27 +191,28 @@ public class Database extends SQLiteOpenHelper
/**
* Update the server record in the database
*
* @param serverId
* @param title Unique title of the server
* @param host Hostname of the server
* @param port Port (default: 3337)
* @param password Password if needed
* @param autoConnect Autoconnect to this server on startup?
* @param useSSL Does the server use SSL?
* @param serverId The primary key of the server to update.
* @param server The server to update.
* @param identityId The identity of the server record
*/
public void updateServer(int serverId, String title, String host, int port, String password, boolean autoConnect, boolean useSSL, long identityId, String charset)
public void updateServer(int serverId, Server server, int identityId)
{
ContentValues values = new ContentValues();
values.put(ServerConstants.TITLE, title);
values.put(ServerConstants.HOST, host);
values.put(ServerConstants.PORT, port);
values.put(ServerConstants.PASSWORD, password);
values.put(ServerConstants.AUTOCONNECT, autoConnect);
values.put(ServerConstants.USE_SSL, useSSL);
values.put(ServerConstants.TITLE, server.getTitle());
values.put(ServerConstants.HOST, server.getHost());
values.put(ServerConstants.PORT, server.getPort());
values.put(ServerConstants.PASSWORD, server.getPassword());
values.put(ServerConstants.AUTOCONNECT, false);
values.put(ServerConstants.USE_SSL, server.useSSL());
values.put(ServerConstants.IDENTITY, identityId);
values.put(ServerConstants.CHARSET, charset);
values.put(ServerConstants.CHARSET, server.getCharset());
Authentication authentication = server.getAuthentication();
values.put(ServerConstants.NICKSERV_PASSWORD, authentication.getNickservPassword());
values.put(ServerConstants.SASL_USERNAME, authentication.getSaslUsername());
values.put(ServerConstants.SASL_PASSWORD, authentication.getSaslPassword());
this.getWritableDatabase().update(
ServerConstants.TABLE_NAME,
@ -417,6 +431,12 @@ public class Database extends SQLiteOpenHelper
server.setStatus(Status.DISCONNECTED);
Authentication authentication = new Authentication();
authentication.setNickservPassword(cursor.getString(cursor.getColumnIndex(ServerConstants.NICKSERV_PASSWORD)));
authentication.setSaslUsername(cursor.getString(cursor.getColumnIndex(ServerConstants.SASL_USERNAME)));
authentication.setSaslPassword(cursor.getString(cursor.getColumnIndex(ServerConstants.SASL_PASSWORD)));
server.setAuthentication(authentication);
// Load identity for server
Identity identity = this.getIdentityById(cursor.getInt(cursor.getColumnIndex(ServerConstants.IDENTITY)));
server.setIdentity(identity);

View File

@ -40,6 +40,9 @@ public interface ServerConstants extends BaseColumns
public static final String USE_SSL = "useSSL";
public static final String CHARSET = "charset";
public static final String IDENTITY = "identity";
public static final String NICKSERV_PASSWORD = "nickserv_password";
public static final String SASL_USERNAME = "sasl_username";
public static final String SASL_PASSWORD = "sasl_password";
/**
* All fields of the table
@ -53,6 +56,9 @@ public interface ServerConstants extends BaseColumns
AUTOCONNECT,
USE_SSL,
CHARSET,
IDENTITY
IDENTITY,
NICKSERV_PASSWORD,
SASL_USERNAME,
SASL_PASSWORD
};
}

View File

@ -0,0 +1,125 @@
/*
Yaaic - Yet Another Android IRC Client
Copyright 2009-2011 Sebastian Kaspari
This file is part of Yaaic.
Yaaic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Yaaic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.model;
/**
* Authentication credentials for a server.
*
* @author Sebastian Kaspari <sebastian@yaaic.org>
*/
public class Authentication
{
private String saslUsername;
private String saslPassword;
private String nickservPassword;
/**
* Does this instance have credentials for Nickserv authentication?
*
* @return True if nickserv credentials are present, false otherwise.
*/
public boolean hasNickservCredentials()
{
return this.nickservPassword != null;
}
/**
* Does this instance have credentials for SASL authentication?
*
* @return True if nickserv credentials are present, false otherwise.
*/
public boolean hasSaslCredentials()
{
return this.saslUsername != null;
}
/**
* Set the username for SASL authentication.
*
* @param saslUsername
*/
public void setSaslUsername(String saslUsername)
{
if (saslUsername == "") {
saslUsername = null;
}
this.saslUsername = saslUsername;
}
/**
* Set the password for SASL authentication.
*
* @param saslPassword
*/
public void setSaslPassword(String saslPassword)
{
if (saslPassword == "") {
saslPassword = null;
}
this.saslPassword = saslPassword;
}
/**
* Set the password for Nickserv authentication.
*
* @param nickservPassword
*/
public void setNickservPassword(String nickservPassword)
{
if (nickservPassword == "") {
nickservPassword = null;
}
this.nickservPassword = nickservPassword;
}
/**
* Get the username for SASL authentication.
*
* @return
*/
public String getSaslUsername()
{
return saslUsername;
}
/**
* Get the password for SASL authentication.
*
* @return
*/
public String getSaslPassword()
{
return saslPassword;
}
/**
* Get the password for Nickserv authentication.
*
* @return
*/
public String getNickservPassword()
{
return nickservPassword;
}
}

View File

@ -37,4 +37,8 @@ public class Extra
public static final String MESSAGE = "message";
public static final String USER = "user";
public static final String ACTION = "action";
public static final String NICKSERV_PASSWORD = "nickserv_password";
public static final String SASL_USER = "sasl_user";
public static final String SASL_PASSWORD = "sasl_password";
}

View File

@ -51,6 +51,7 @@ public class Message
/* normal message, this is the default */
public static final int TYPE_MESSAGE = 0;
/* join, part or quit */
public static final int TYPE_MISC = 1;

View File

@ -40,7 +40,9 @@ public class Server
private String password;
private String charset;
private boolean useSSL = false;
private Identity identity;
private Authentication authentication;
private final LinkedHashMap<String, Conversation> conversations = new LinkedHashMap<String, Conversation>();
private ArrayList<String> autoJoinChannels;
@ -69,6 +71,16 @@ public class Server
this.identity = identity;
}
/**
* Set the authentication methods for this server
*
* @param authentication
*/
public void setAuthentication(Authentication authentication)
{
this.authentication = authentication;
}
/**
* Get the identity for this server
*
@ -79,6 +91,16 @@ public class Server
return identity;
}
/**
* Get the authentication methods for this server;
*
* @return authentication
*/
public Authentication getAuthentication()
{
return authentication;
}
/**
* Get unique id of server
*