diff options
Diffstat (limited to 'src/com/wilko/jaim/commands')
20 files changed, 1165 insertions, 0 deletions
diff --git a/src/com/wilko/jaim/commands/TocAddBuddyCommand.java b/src/com/wilko/jaim/commands/TocAddBuddyCommand.java new file mode 100644 index 0000000..30b1370 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocAddBuddyCommand.java @@ -0,0 +1,67 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocAddBuddyCommand.java + * + * Created on 4 May 2002, 13:57 + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +import java.util.Vector; + +/** + * @author paulw + * @version $Revision: 1.3 $ + */ +public class TocAddBuddyCommand extends TocCommand { + + private static final String CMD = "toc_add_buddy"; + + Vector buddyList; + + /** + * Creates new TocAddBuddyCommand + */ + public TocAddBuddyCommand() { + buddyList = new Vector(); + } + + public void addBuddy(String buddy) { + buddyList.add(Utils.normalise(buddy)); + } + + public String toString() { + StringBuffer output = new StringBuffer(CMD); + for (int i = 0; i < buddyList.size(); i++) { + output.append(' '); + output.append((String) buddyList.elementAt(i)); + } + return (output.toString()); + } + + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocAddDenyCommand.java b/src/com/wilko/jaim/commands/TocAddDenyCommand.java new file mode 100644 index 0000000..ec3b493 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocAddDenyCommand.java @@ -0,0 +1,67 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocAddDenyCommand.java + * + * Created on 4 May 2002, 13:57 + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +import java.util.Vector; + +/** + * @author paulw + * @version $Revision: 1.3 $ + */ +public class TocAddDenyCommand extends TocCommand { + + private static final String CMD = "toc_add_deny"; + + Vector buddyList; + + /** + * Creates new TocAddBuddyCommand + */ + public TocAddDenyCommand() { + buddyList = new Vector(); + } + + public void addDeny(String buddy) { + buddyList.add(Utils.normalise(buddy)); + } + + public String toString() { + StringBuffer output = new StringBuffer(CMD); + for (int i = 0; i < buddyList.size(); i++) { + output.append(' '); + output.append((String) buddyList.elementAt(i)); + } + return (output.toString()); + } + + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocAddPermitCommand.java b/src/com/wilko/jaim/commands/TocAddPermitCommand.java new file mode 100644 index 0000000..09d76d0 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocAddPermitCommand.java @@ -0,0 +1,67 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocAddPermitCommand.java + * + * Created on 11 Oct 2002, 15:20 + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +import java.util.Vector; + +/** + * @author paulw + * @version $Revision: 1.1 $ + */ +public class TocAddPermitCommand extends TocCommand { + + private static final String CMD = "toc_add_permit"; + + Vector buddyList; + + /** + * Creates new TocAddBuddyCommand + */ + public TocAddPermitCommand() { + buddyList = new Vector(); + } + + public void addPermit(String buddy) { + buddyList.add(Utils.normalise(buddy)); + } + + public String toString() { + StringBuffer output = new StringBuffer(CMD); + for (int i = 0; i < buddyList.size(); i++) { + output.append(' '); + output.append((String) buddyList.elementAt(i)); + } + return (output.toString()); + } + + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatAcceptCommand.java b/src/com/wilko/jaim/commands/TocChatAcceptCommand.java new file mode 100644 index 0000000..8f2e032 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatAcceptCommand.java @@ -0,0 +1,51 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatAcceptCommand extends TocCommand { + + private final String roomID; + + /** + * Creates new TocIMCommand + */ + public TocChatAcceptCommand(String roomID) { + this.roomID = roomID; + } + + public String toString() { + return ("toc_chat_accept " + roomID); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatEvilCommand.java b/src/com/wilko/jaim/commands/TocChatEvilCommand.java new file mode 100644 index 0000000..5101eae --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatEvilCommand.java @@ -0,0 +1,55 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatEvilCommand extends TocCommand { + + private final String roomID; + private final String screenname; + private final Boolean anonymous; + + /** + * Creates new TocIMCommand + */ + public TocChatEvilCommand(String roomID, String screenname, Boolean anonymous) { + this.roomID = roomID; + this.screenname = screenname; + this.anonymous = anonymous; + } + + public String toString() { + return ("toc_chat_evil " + roomID + " " + screenname + " " + (anonymous ? "anon" : "norm")); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatInviteCommand.java b/src/com/wilko/jaim/commands/TocChatInviteCommand.java new file mode 100644 index 0000000..6970987 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatInviteCommand.java @@ -0,0 +1,55 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatInviteCommand extends TocCommand { + + private final String roomID; + private final String message; + private final String[] buddies; + + /** + * Creates new TocIMCommand + */ + public TocChatInviteCommand(String roomID, String message, String[] buddies) { + this.roomID = roomID; + this.message = message; + this.buddies = buddies; + } + + public String toString() { + return ("toc_chat_invite " + roomID + " \"" + message + "\" " + String.join(" ", buddies)); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatJoinCommand.java b/src/com/wilko/jaim/commands/TocChatJoinCommand.java new file mode 100644 index 0000000..7f01378 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatJoinCommand.java @@ -0,0 +1,53 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatJoinCommand extends TocCommand { + + private final int exchange; + private final String roomName; + + /** + * Creates new TocIMCommand + */ + public TocChatJoinCommand(int exchange, String roomName) { + this.exchange = exchange; + this.roomName = roomName; + } + + public String toString() { + return ("toc_chat_join " + exchange + " " + roomName); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatLeaveCommand.java b/src/com/wilko/jaim/commands/TocChatLeaveCommand.java new file mode 100644 index 0000000..8f05de1 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatLeaveCommand.java @@ -0,0 +1,51 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatLeaveCommand extends TocCommand { + + private final String roomID; + + /** + * Creates new TocIMCommand + */ + public TocChatLeaveCommand(String roomID) { + this.roomID = roomID; + } + + public String toString() { + return ("toc_chat_leave " + roomID); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatSendCommand.java b/src/com/wilko/jaim/commands/TocChatSendCommand.java new file mode 100644 index 0000000..42b7764 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatSendCommand.java @@ -0,0 +1,53 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatSendCommand extends TocCommand { + + private final String roomID; + private final String message; + + /** + * Creates new TocIMCommand + */ + public TocChatSendCommand(String roomID, String message) { + this.roomID = roomID; + this.message = message; + } + + public String toString() { + return ("toc_chat_send " + roomID + " \"" + message + "\""); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocChatWhisperCommand.java b/src/com/wilko/jaim/commands/TocChatWhisperCommand.java new file mode 100644 index 0000000..edf4ff7 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocChatWhisperCommand.java @@ -0,0 +1,55 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocChatWhisperCommand extends TocCommand { + + private final String roomID; + private final String screenname; + private final String message; + + /** + * Creates new TocIMCommand + */ + public TocChatWhisperCommand(String roomID, String screenname, String message) { + this.roomID = roomID; + this.screenname = screenname; + this.message = message; + } + + public String toString() { + return ("toc_chat_whisper " + roomID + " " + screenname + " \"" + message + "\""); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocCommand.java b/src/com/wilko/jaim/commands/TocCommand.java new file mode 100644 index 0000000..ec7e77f --- /dev/null +++ b/src/com/wilko/jaim/commands/TocCommand.java @@ -0,0 +1,44 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocCommand.java + * + * Created on 4 May 2002, 11:19 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.3 $ + */ +public abstract class TocCommand { + + /** + * Creates new TocCommand + */ + public TocCommand() { + } + + abstract public byte[] getBytes(); + + abstract public String toString(); + +} diff --git a/src/com/wilko/jaim/commands/TocEvilCommand.java b/src/com/wilko/jaim/commands/TocEvilCommand.java new file mode 100644 index 0000000..15758e1 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocEvilCommand.java @@ -0,0 +1,61 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocEvilCommand.java + * + * Created on 6 May 2002, 09:05 + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +/** + * @author paulw + * @version $Revision: 1.3 $ + */ +public class TocEvilCommand extends TocCommand { + + private final String buddy; + private final boolean anonymous; + + /** + * Creates new TocEvilCommand + */ + public TocEvilCommand(String buddy, boolean anonymous) { + this.buddy = Utils.normalise(buddy); + this.anonymous = anonymous; + } + + public String toString() { + String ret = "toc_evil " + buddy; + if (anonymous) { + ret = ret + " anon"; + } else + ret = ret + " norm"; + + return (ret); + } + + public byte[] getBytes() { + return toString().getBytes(); + } + +} diff --git a/src/com/wilko/jaim/commands/TocGetInfoCommand.java b/src/com/wilko/jaim/commands/TocGetInfoCommand.java new file mode 100644 index 0000000..47927dd --- /dev/null +++ b/src/com/wilko/jaim/commands/TocGetInfoCommand.java @@ -0,0 +1,71 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +/** + * @author paulw + * @version $version: $ + */ +public class TocGetInfoCommand extends TocCommand { + + private static final String CMD = "toc_get_info "; + private final String username; + + /** + * Creates new TocGetInfoCommand + * + * @param username The screen name for whom information is requested + */ + + public TocGetInfoCommand(String username) { + this.username = Utils.normalise(username); + } + + + public String toString() { + return (CMD + username); + } + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocIMCommand.java b/src/com/wilko/jaim/commands/TocIMCommand.java new file mode 100644 index 0000000..76630da --- /dev/null +++ b/src/com/wilko/jaim/commands/TocIMCommand.java @@ -0,0 +1,60 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocIMCommand.java + * + * Created on 4 May 2002, 15:18 + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocIMCommand extends TocCommand { + + private final String recipient; + private final String msg; + private final String auto; + + /** + * Creates new TocIMCommand + */ + public TocIMCommand(String recipient, String msg, boolean autoMessage) { + this.recipient = Utils.normalise(recipient); + this.msg = Utils.encodeText(msg); + if (autoMessage) + auto = " auto"; + else + auto = ""; + } + + public String toString() { + return ("toc_send_im " + recipient + " " + msg + auto); + } + + public byte[] getBytes() { + return (this.toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocInitDoneCommand.java b/src/com/wilko/jaim/commands/TocInitDoneCommand.java new file mode 100644 index 0000000..c97a324 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocInitDoneCommand.java @@ -0,0 +1,50 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocInitDoneCommand.java + * + * Created on 4 May 2002, 13:35 + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $Revision: 1.4 $ + */ +public class TocInitDoneCommand extends TocCommand { + + private static final String CMD = "toc_init_done"; + + /** + * Creates new TocInitDoneCommand + */ + public TocInitDoneCommand() { + } + + public byte[] getBytes() { + return (CMD.getBytes()); + } + + public String toString() { + return (CMD); + } + +} diff --git a/src/com/wilko/jaim/commands/TocSetAwayCommand.java b/src/com/wilko/jaim/commands/TocSetAwayCommand.java new file mode 100644 index 0000000..0333cc4 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocSetAwayCommand.java @@ -0,0 +1,58 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocSetAwayCommand.java + * + * Created on July 17, 2002, 9:02 PM + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +/** + * @author paulw + * @version $version: $ + */ +public class TocSetAwayCommand extends TocCommand { + + private static final String CMD = "toc_set_away "; + private final String awayMsg; + + /** + * Creates new TocSetInfoCommand + * + * @param awayMsg The away message for this user. May contain HTML. To cancel "away" status set the awayMsg to "" + */ + + public TocSetAwayCommand(String awayMsg) { + this.awayMsg = Utils.encodeText(awayMsg); + } + + + public String toString() { + return (CMD + awayMsg); + } + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocSetConfigCommand.java b/src/com/wilko/jaim/commands/TocSetConfigCommand.java new file mode 100644 index 0000000..c690185 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocSetConfigCommand.java @@ -0,0 +1,72 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocSetConfigCommand.java + * + * Created on October 11, 2002, 9:08 AM + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Buddy; +import com.wilko.jaim.Group; + +import java.util.Enumeration; + +/** + * @author paulw + */ +public class TocSetConfigCommand extends TocCommand { + + private static final String CMD = "toc_set_config "; + private final StringBuffer config; + + /** + * Creates a new instance of TocSetConfigCommand + */ + public TocSetConfigCommand() { + config = new StringBuffer(); + } + + public void addGroup(Group g) { + config.append("g " + g.getName() + "\n"); + Enumeration buddies = g.enumerateBuddies(); + while (buddies.hasMoreElements()) { + Buddy b = (Buddy) buddies.nextElement(); + config.append("b " + b.getName() + "\n"); + if (b.getPermit()) { + config.append("p " + b.getName() + "\n"); + } + if (b.getDeny()) { + config.append("d " + b.getName() + "\n"); + } + } + } + + + public String toString() { + return (CMD + '"' + config.toString() + '"'); + } + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocSetIdleCommand.java b/src/com/wilko/jaim/commands/TocSetIdleCommand.java new file mode 100644 index 0000000..ed1bf74 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocSetIdleCommand.java @@ -0,0 +1,53 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/* + * TocSetIdleCommand.java + * + * Created on July 17, 2002, 9:21 PM + */ + +package com.wilko.jaim.commands; + +/** + * @author paulw + * @version $version: $ + */ +public class TocSetIdleCommand extends TocCommand { + + private static final String CMD = "toc_set_idle "; + private final int idle; + + /** + * Creates new TocSetIdleCommand + * + * @param idleSecs - the period for which the user has been idle + */ + public TocSetIdleCommand(int idleSecs) { + idle = idleSecs; + } + + public String toString() { + return (CMD + idle); + } + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocSetInfoCommand.java b/src/com/wilko/jaim/commands/TocSetInfoCommand.java new file mode 100644 index 0000000..d5a3f5b --- /dev/null +++ b/src/com/wilko/jaim/commands/TocSetInfoCommand.java @@ -0,0 +1,58 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocSetInfoCommand.java + * + * Created on July 17, 2002, 9:02 PM + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +/** + * @author paulw + * @version $version: $ + */ +public class TocSetInfoCommand extends TocCommand { + + private static final String CMD = "toc_set_info "; + private final String information; + + /** + * Creates new TocSetInfoCommand + * + * @param information The information about this user can be located. May contain HTML + */ + + public TocSetInfoCommand(String information) { + this.information = Utils.encodeText(information); + } + + + public String toString() { + return (CMD + information); + } + + public byte[] getBytes() { + return (toString().getBytes()); + } + +} diff --git a/src/com/wilko/jaim/commands/TocSignonCommand.java b/src/com/wilko/jaim/commands/TocSignonCommand.java new file mode 100644 index 0000000..8721ef0 --- /dev/null +++ b/src/com/wilko/jaim/commands/TocSignonCommand.java @@ -0,0 +1,64 @@ +/* + * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * TocSignonCommand.java + * + * Created on 4 May 2002, 11:20 + */ + +package com.wilko.jaim.commands; + +import com.wilko.jaim.Utils; + +/** + * @author paulw + * @version $Revision: 1.3 $ + */ +public class TocSignonCommand extends TocCommand { + + private static final String AGENTNAME = "jaim01"; + private final String server; + private final String username; + private final String password; + private final int port; + + /** + * Creates new TocSignonCommand + */ + public TocSignonCommand(String server, int port, String username, String password) { + this.server = server; + this.port = port; + this.username = Utils.normalise(username); + this.password = Utils.roast(password); + } + + public byte[] getBytes() { + return toString().getBytes(); + } + + public String toString() { + String temp = "toc_signon login.oscar.aol.com 5159 " + username + " " + password + " english " + AGENTNAME; + return (temp); + } + + public void parseString(java.lang.String str) { + } + +} |