mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 08:52:18 -05:00
PircBot fixes
This commit is contained in:
parent
ddf80644bd
commit
1bb2de3dcb
@ -86,7 +86,8 @@ public class DccManager {
|
||||
}
|
||||
else if (type.equals("ACCEPT")) {
|
||||
int port = Integer.parseInt(tokenizer.nextToken());
|
||||
long progress = Long.parseLong(tokenizer.nextToken());
|
||||
// XXX: progress is not used?
|
||||
//long progress = Long.parseLong(tokenizer.nextToken());
|
||||
|
||||
DccFileTransfer transfer = null;
|
||||
synchronized (_awaitingResume) {
|
||||
@ -146,6 +147,6 @@ public class DccManager {
|
||||
|
||||
|
||||
private PircBot _bot;
|
||||
private Vector _awaitingResume = new Vector();
|
||||
private Vector<DccFileTransfer> _awaitingResume = new Vector<DccFileTransfer>();
|
||||
|
||||
}
|
||||
|
@ -22,8 +22,9 @@ package org.jibble.pircbot;
|
||||
* @version 1.4.6 (Build time: Wed Apr 11 19:20:59 2007)
|
||||
*/
|
||||
public class IrcException extends Exception {
|
||||
|
||||
/**
|
||||
private static final long serialVersionUID = -3705541066912475928L;
|
||||
|
||||
/**
|
||||
* Constructs a new IrcException.
|
||||
*
|
||||
* @param e The error message to report.
|
||||
|
@ -25,8 +25,9 @@ package org.jibble.pircbot;
|
||||
* @version 1.4.6 (Build time: Wed Apr 11 19:20:59 2007)
|
||||
*/
|
||||
public class NickAlreadyInUseException extends IrcException {
|
||||
|
||||
/**
|
||||
private static final long serialVersionUID = -4724325464519465479L;
|
||||
|
||||
/**
|
||||
* Constructs a new IrcException.
|
||||
*
|
||||
* @param e The error message to report.
|
||||
|
@ -15,7 +15,6 @@ found at http://www.jibble.org/licenses/
|
||||
package org.jibble.pircbot;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
/**
|
||||
* A Thread which is responsible for sending messages to the IRC server.
|
||||
|
@ -2849,10 +2849,10 @@ public abstract class PircBot implements ReplyConstants {
|
||||
channel = channel.toLowerCase();
|
||||
User[] userArray = new User[0];
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
Hashtable<User, User> users = _channels.get(channel);
|
||||
if (users != null) {
|
||||
userArray = new User[users.size()];
|
||||
Enumeration enumeration = users.elements();
|
||||
Enumeration<User> enumeration = users.elements();
|
||||
for (int i = 0; i < userArray.length; i++) {
|
||||
User user = (User) enumeration.nextElement();
|
||||
userArray[i] = user;
|
||||
@ -2879,7 +2879,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
String[] channels = new String[0];
|
||||
synchronized (_channels) {
|
||||
channels = new String[_channels.size()];
|
||||
Enumeration enumeration = _channels.keys();
|
||||
Enumeration<String> enumeration = _channels.keys();
|
||||
for (int i = 0; i < channels.length; i++) {
|
||||
channels[i] = (String) enumeration.nextElement();
|
||||
}
|
||||
@ -2921,9 +2921,9 @@ public abstract class PircBot implements ReplyConstants {
|
||||
private final void addUser(String channel, User user) {
|
||||
channel = channel.toLowerCase();
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
Hashtable<User, User> users = _channels.get(channel);
|
||||
if (users == null) {
|
||||
users = new Hashtable();
|
||||
users = new Hashtable<User, User>();
|
||||
_channels.put(channel, users);
|
||||
}
|
||||
users.put(user, user);
|
||||
@ -2938,7 +2938,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
channel = channel.toLowerCase();
|
||||
User user = new User("", nick);
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
Hashtable<User, User> users = _channels.get(channel);
|
||||
if (users != null) {
|
||||
return (User) users.remove(user);
|
||||
}
|
||||
@ -2952,7 +2952,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
*/
|
||||
private final void removeUser(String nick) {
|
||||
synchronized (_channels) {
|
||||
Enumeration enumeration = _channels.keys();
|
||||
Enumeration<String> enumeration = _channels.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String channel = (String) enumeration.nextElement();
|
||||
this.removeUser(channel, nick);
|
||||
@ -2966,7 +2966,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
*/
|
||||
private final void renameUser(String oldNick, String newNick) {
|
||||
synchronized (_channels) {
|
||||
Enumeration enumeration = _channels.keys();
|
||||
Enumeration<String> enumeration = _channels.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String channel = (String) enumeration.nextElement();
|
||||
User user = this.removeUser(channel, oldNick);
|
||||
@ -2995,7 +2995,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
*/
|
||||
private final void removeAllChannels() {
|
||||
synchronized(_channels) {
|
||||
_channels = new Hashtable();
|
||||
_channels = new Hashtable<String, Hashtable<User, User>>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3003,10 +3003,10 @@ public abstract class PircBot implements ReplyConstants {
|
||||
private final void updateUser(String channel, int userMode, String nick) {
|
||||
channel = channel.toLowerCase();
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
Hashtable<User, User> users = _channels.get(channel);
|
||||
User newUser = null;
|
||||
if (users != null) {
|
||||
Enumeration enumeration = users.elements();
|
||||
Enumeration<User> enumeration = users.elements();
|
||||
while(enumeration.hasMoreElements()) {
|
||||
User userObj = (User) enumeration.nextElement();
|
||||
if (userObj.getNick().equalsIgnoreCase(nick)) {
|
||||
@ -3074,11 +3074,11 @@ public abstract class PircBot implements ReplyConstants {
|
||||
|
||||
// A Hashtable of channels that points to a selfreferential Hashtable of
|
||||
// User objects (used to remember which users are in which channels).
|
||||
private Hashtable _channels = new Hashtable();
|
||||
private Hashtable<String, Hashtable<User, User>> _channels = new Hashtable<String, Hashtable<User, User>>();
|
||||
|
||||
// A Hashtable to temporarily store channel topics when we join them
|
||||
// until we find out who set that topic.
|
||||
private Hashtable _topics = new Hashtable();
|
||||
private Hashtable<String, String> _topics = new Hashtable<String, String>();
|
||||
|
||||
// DccManager to process and handle all DCC events.
|
||||
private DccManager _dccManager = new DccManager(this);
|
||||
|
@ -141,6 +141,6 @@ public class Queue {
|
||||
}
|
||||
|
||||
|
||||
private Vector _queue = new Vector();
|
||||
private Vector<Object> _queue = new Vector<Object>();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user