use of irc.account.Task in project Botnak by Gocnak.
the class IRCViewer method close.
/**
* Disconnects from all chats and disposes of the bot.
*
* @param forget If true, will forget the user.
*/
public synchronized void close(boolean forget) {
GUIMain.log("Logging out of user: " + Settings.accountManager.getUserAccount().getName());
Settings.accountManager.addTask(new Task(getViewer(), Task.Type.DISCONNECT, null));
if (forget) {
Settings.accountManager.setUserAccount(null);
}
GUIMain.viewer = null;
Settings.channelManager.dispose();
}
use of irc.account.Task in project Botnak by Gocnak.
the class IRCViewer method doLeave.
/**
* Leaves a channel and if specified, removes the channel from the
* channel list.
*
* @param channel The channel name to leave (# not included).
*/
public void doLeave(String channel) {
if (!channel.startsWith("#"))
channel = "#" + channel;
Settings.accountManager.addTask(new Task(getViewer(), Task.Type.LEAVE_CHANNEL, channel));
GUIMain.channelSet.remove(channel);
}
use of irc.account.Task in project Botnak by Gocnak.
the class GUIAuthorizeAccount method doneButtonActionPerformed.
private void doneButtonActionPerformed(ActionEvent e) {
String oauth = new String(oauthField.getPassword());
if (!oauth.startsWith("oauth:"))
oauth = "oauth:" + oauth;
String name = accountNameField.getText().trim().toLowerCase();
if (!name.isEmpty() && oauth.length() == 36) {
if (isForBotAccount) {
if (getAccount(true) == null) {
Settings.accountManager.setBotAccount(new Account(name, new Oauth(oauth, false, false, false, false)));
Settings.accountManager.addTask(new Task(null, Task.Type.CREATE_BOT_ACCOUNT, null));
if (GUIMain.settings != null) {
GUISettings.botUser.setText(name);
GUISettings.botPass.setText(oauth);
}
}
} else {
if (getAccount(false) == null) {
Settings.accountManager.setUserAccount(new Account(name, new Oauth(oauth, boxEditStatus.isSelected(), boxCommercial.isSelected(), boxReadSubs.isSelected(), boxFollowed.isSelected())));
Settings.accountManager.addTask(new Task(null, Task.Type.CREATE_VIEWER_ACCOUNT, null));
if (GUIMain.settings != null) {
GUISettings.normUser.setText(name);
GUISettings.normPass.setText(oauth);
}
}
}
}
dispose();
}
use of irc.account.Task in project Botnak by Gocnak.
the class IRCBot method close.
/**
* Disconnects from all chats and disposes of the bot.
*
* @param forget True if you are logging out, false if shutting down.
*/
public void close(boolean forget) {
GUIMain.log("Logging out of bot: " + Settings.accountManager.getBotAccount().getName());
Settings.accountManager.addTask(new Task(getBot(), Task.Type.DISCONNECT, null));
if (forget) {
Settings.accountManager.setBotAccount(null);
}
GUIMain.bot = null;
}
use of irc.account.Task in project Botnak by Gocnak.
the class IRCViewer method doConnect.
public void doConnect(String channel) {
channel = channel.startsWith("#") ? channel : "#" + channel;
Settings.accountManager.addTask(new Task(getViewer(), Task.Type.JOIN_CHANNEL, channel));
if (Settings.logChat.getValue())
Utils.logChat(null, channel, 0);
if (!GUIMain.channelSet.contains(channel))
GUIMain.channelSet.add(channel);
if (Settings.ffzFacesEnable.getValue()) {
if (FaceManager.doneWithFrankerFaces)
FaceManager.handleFFZChannel(channel.substring(1));
}
}