Format all code, add editorconfig
This commit is contained in:
parent
a1dff2cb8d
commit
3faced7068
52 changed files with 2011 additions and 1918 deletions
11
.editorconfig
Normal file
11
.editorconfig
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.iml]
|
||||||
|
indent_size = 2
|
2
.github/README.md
vendored
2
.github/README.md
vendored
|
@ -3,9 +3,11 @@
|
||||||
This is a fork of [Jaim](https://jaimlib.sourceforge.net/), a Java library that implements the AOL TOC protocol.
|
This is a fork of [Jaim](https://jaimlib.sourceforge.net/), a Java library that implements the AOL TOC protocol.
|
||||||
|
|
||||||
This fork features various improvements on the original Jaim:
|
This fork features various improvements on the original Jaim:
|
||||||
|
|
||||||
- Support for chat invites
|
- Support for chat invites
|
||||||
|
|
||||||
## Original README
|
## Original README
|
||||||
|
|
||||||
```
|
```
|
||||||
Readme.txt for Jaimlib
|
Readme.txt for Jaimlib
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.idea" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/lib" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|
|
@ -25,64 +25,79 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/** This is a buddy object that holds the buddy's name and other
|
/**
|
||||||
|
* This is a buddy object that holds the buddy's name and other
|
||||||
* information about a buddy.
|
* information about a buddy.
|
||||||
|
*
|
||||||
* @author Brett Humphreys
|
* @author Brett Humphreys
|
||||||
*/
|
*/
|
||||||
public class Buddy {
|
public class Buddy {
|
||||||
/** Name of the buddy */
|
/**
|
||||||
private String buddyName;
|
* Name of the buddy
|
||||||
|
*/
|
||||||
|
private final String buddyName;
|
||||||
|
|
||||||
/** Permit value */
|
/**
|
||||||
|
* Permit value
|
||||||
|
*/
|
||||||
private boolean permit;
|
private boolean permit;
|
||||||
|
|
||||||
/** deny value */
|
/**
|
||||||
|
* deny value
|
||||||
|
*/
|
||||||
private boolean deny;
|
private boolean deny;
|
||||||
|
|
||||||
/** Constructor that sets the buddy name
|
/**
|
||||||
|
* Constructor that sets the buddy name
|
||||||
|
*
|
||||||
* @param name the name of this buddy.
|
* @param name the name of this buddy.
|
||||||
*/
|
*/
|
||||||
public Buddy ( String name )
|
public Buddy(String name) {
|
||||||
{
|
|
||||||
buddyName = name;
|
buddyName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the buddy name
|
/**
|
||||||
|
* Gets the buddy name
|
||||||
|
*
|
||||||
* @return buddy name
|
* @return buddy name
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return buddyName;
|
return buddyName;
|
||||||
}
|
}
|
||||||
/** Sets the permit value
|
|
||||||
* @param permitVal what to set permit to
|
|
||||||
*/
|
|
||||||
public void setPermit( boolean permitVal )
|
|
||||||
{
|
|
||||||
permit = permitVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets the permit value
|
/**
|
||||||
|
* Gets the permit value
|
||||||
|
*
|
||||||
* @return permit value
|
* @return permit value
|
||||||
*/
|
*/
|
||||||
public boolean getPermit( )
|
public boolean getPermit() {
|
||||||
{
|
|
||||||
return permit;
|
return permit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the deny value
|
/**
|
||||||
* @param denyVal what to set deny to
|
* Sets the permit value
|
||||||
|
*
|
||||||
|
* @param permitVal what to set permit to
|
||||||
*/
|
*/
|
||||||
public void setDeny( boolean denyVal )
|
public void setPermit(boolean permitVal) {
|
||||||
{
|
permit = permitVal;
|
||||||
deny = denyVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the deny value
|
/**
|
||||||
|
* Gets the deny value
|
||||||
|
*
|
||||||
* @return deny value
|
* @return deny value
|
||||||
*/
|
*/
|
||||||
public boolean getDeny( )
|
public boolean getDeny() {
|
||||||
{
|
|
||||||
return deny;
|
return deny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the deny value
|
||||||
|
*
|
||||||
|
* @param denyVal what to set deny to
|
||||||
|
*/
|
||||||
|
public void setDeny(boolean denyVal) {
|
||||||
|
deny = denyVal;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,12 +28,15 @@ package com.wilko.jaim;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
/** A BuddyUpdateTocResponse is delivered to a {@link JaimEventListener } when a buddy update is received from the TOC server
|
/**
|
||||||
|
* A BuddyUpdateTocResponse is delivered to a {@link JaimEventListener } when a buddy update is received from the TOC server
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
public class BuddyUpdateTocResponse extends TocResponse implements TocResponseHandler {
|
public class BuddyUpdateTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static String RESPONSE_TYPE = "UPDATE_BUDDY";
|
||||||
private String buddyName;
|
private String buddyName;
|
||||||
private boolean online;
|
private boolean online;
|
||||||
private int evil;
|
private int evil;
|
||||||
|
@ -45,166 +48,164 @@ public class BuddyUpdateTocResponse extends TocResponse implements TocResponseHa
|
||||||
private Date signonTime;
|
private Date signonTime;
|
||||||
private boolean away;
|
private boolean away;
|
||||||
|
|
||||||
public static String RESPONSE_TYPE="UPDATE_BUDDY";
|
/**
|
||||||
|
* Creates new BuddyUpdateTocResponse
|
||||||
/** Creates new BuddyUpdateTocResponse */
|
*/
|
||||||
public BuddyUpdateTocResponse() {
|
public BuddyUpdateTocResponse() {
|
||||||
buddyName="";
|
buddyName = "";
|
||||||
online=false;
|
online = false;
|
||||||
evil=0;
|
evil = 0;
|
||||||
idleTime=0;
|
idleTime = 0;
|
||||||
onAOL=false;
|
onAOL = false;
|
||||||
unconfirmed=false;
|
unconfirmed = false;
|
||||||
admin=false;
|
admin = false;
|
||||||
confirmed=false;
|
confirmed = false;
|
||||||
away=false;
|
away = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The parseString method is used to populate the fields of this class from a Buddy Update string from the TOC server
|
/**
|
||||||
|
* The parseString method is used to populate the fields of this class from a Buddy Update string from the TOC server
|
||||||
|
*
|
||||||
* @param str The String containing the buddy update
|
* @param str The String containing the buddy update
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(java.lang.String str) {
|
public TocResponse parseString(java.lang.String str) {
|
||||||
BuddyUpdateTocResponse tr=new BuddyUpdateTocResponse();
|
BuddyUpdateTocResponse tr = new BuddyUpdateTocResponse();
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
cmd = str;
|
||||||
cmd=str;
|
StringTokenizer st = new StringTokenizer(str, ":");
|
||||||
StringTokenizer st=new StringTokenizer(str,":");
|
|
||||||
|
|
||||||
st.nextToken();
|
st.nextToken();
|
||||||
buddyName=st.nextToken();
|
buddyName = st.nextToken();
|
||||||
String onlineStr=st.nextToken();
|
String onlineStr = st.nextToken();
|
||||||
if (onlineStr.equals("T"))
|
online = onlineStr.equals("T");
|
||||||
{
|
|
||||||
online=true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
online=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
evil=Integer.parseInt(st.nextToken());
|
evil = Integer.parseInt(st.nextToken());
|
||||||
long signon=Long.parseLong(st.nextToken());
|
long signon = Long.parseLong(st.nextToken());
|
||||||
signonTime=new Date(signon*1000);
|
signonTime = new Date(signon * 1000);
|
||||||
idleTime=Integer.parseInt(st.nextToken());
|
idleTime = Integer.parseInt(st.nextToken());
|
||||||
String userclass=st.nextToken();
|
String userclass = st.nextToken();
|
||||||
if (userclass.charAt(0) == 'A')
|
if (userclass.charAt(0) == 'A')
|
||||||
onAOL=true;
|
onAOL = true;
|
||||||
if (userclass.charAt(1) == 'A')
|
if (userclass.charAt(1) == 'A') {
|
||||||
{
|
admin = true;
|
||||||
admin=true;
|
} else {
|
||||||
}
|
if (userclass.charAt(1) == 'U') {
|
||||||
else
|
unconfirmed = true;
|
||||||
{
|
} else {
|
||||||
if (userclass.charAt(1)=='U')
|
if (userclass.charAt(1) == 'O') {
|
||||||
{
|
confirmed = true;
|
||||||
unconfirmed=true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(userclass.charAt(1)=='O')
|
|
||||||
{
|
|
||||||
confirmed=true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (userclass.length()>2)
|
if (userclass.length() > 2) {
|
||||||
{
|
if (userclass.charAt(2) == 'U') {
|
||||||
if (userclass.charAt(2)=='U')
|
away = true;
|
||||||
{
|
|
||||||
away=true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the away status of the buddy specified by this update
|
/**
|
||||||
|
* Get the away status of the buddy specified by this update
|
||||||
|
*
|
||||||
* @return true if the buddy is "away"
|
* @return true if the buddy is "away"
|
||||||
*/
|
*/
|
||||||
public boolean isAway()
|
public boolean isAway() {
|
||||||
{
|
return (away);
|
||||||
return(away);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the response type of this response. This method is used by the response dispatcher within JaimConnection
|
/**
|
||||||
|
* Get the response type of this response. This method is used by the response dispatcher within JaimConnection
|
||||||
|
*
|
||||||
* @return The response type
|
* @return The response type
|
||||||
*/
|
*/
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
return RESPONSE_TYPE;
|
return RESPONSE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the buddy name from this update
|
/**
|
||||||
|
* Obtain the buddy name from this update
|
||||||
|
*
|
||||||
* @return The buddy name
|
* @return The buddy name
|
||||||
*/
|
*/
|
||||||
public String getBuddy()
|
public String getBuddy() {
|
||||||
{
|
return (buddyName);
|
||||||
return(buddyName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the online status of this buddy update
|
/**
|
||||||
|
* Obtain the online status of this buddy update
|
||||||
|
*
|
||||||
* @return true if the buddy is on line
|
* @return true if the buddy is on line
|
||||||
*/
|
*/
|
||||||
public boolean isOnline()
|
public boolean isOnline() {
|
||||||
{
|
return (online);
|
||||||
return(online);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the idle time of this buddy
|
/**
|
||||||
|
* Obtain the idle time of this buddy
|
||||||
|
*
|
||||||
* @return The idle time in seconds
|
* @return The idle time in seconds
|
||||||
*/
|
*/
|
||||||
public int getIdleTime()
|
public int getIdleTime() {
|
||||||
{
|
return (idleTime);
|
||||||
return(idleTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the "Evil" (Warning) level of this buddy
|
/**
|
||||||
|
* Obtain the "Evil" (Warning) level of this buddy
|
||||||
|
*
|
||||||
* @return The warning level as a percentage
|
* @return The warning level as a percentage
|
||||||
*/
|
*/
|
||||||
public int getEvil()
|
public int getEvil() {
|
||||||
{
|
return (evil);
|
||||||
return(evil);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Is this buddy an "Administrator"
|
/**
|
||||||
|
* Is this buddy an "Administrator"
|
||||||
|
*
|
||||||
* @return true if an administrator
|
* @return true if an administrator
|
||||||
*/
|
*/
|
||||||
public boolean isAdmin()
|
public boolean isAdmin() {
|
||||||
{
|
return (admin);
|
||||||
return(admin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IS this buddy a "confirmed" user
|
/**
|
||||||
|
* IS this buddy a "confirmed" user
|
||||||
|
*
|
||||||
* @return True if this buddy is confirmed
|
* @return True if this buddy is confirmed
|
||||||
*/
|
*/
|
||||||
public boolean isConfirmed()
|
public boolean isConfirmed() {
|
||||||
{
|
return (confirmed);
|
||||||
return(confirmed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Is this user an "Unconfirmed user"
|
/**
|
||||||
|
* Is this user an "Unconfirmed user"
|
||||||
|
*
|
||||||
* @return True if this user is unconfirmed
|
* @return True if this user is unconfirmed
|
||||||
*/
|
*/
|
||||||
public boolean isUnconfirmed()
|
public boolean isUnconfirmed() {
|
||||||
{
|
return (unconfirmed);
|
||||||
return(unconfirmed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the signon time of this buddy
|
/**
|
||||||
|
* Get the signon time of this buddy
|
||||||
|
*
|
||||||
* @return The date/time of signon
|
* @return The date/time of signon
|
||||||
*/
|
*/
|
||||||
public Date getSignonTime()
|
public Date getSignonTime() {
|
||||||
{
|
return (signonTime);
|
||||||
return(signonTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,23 +25,25 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
/** A BuddyUpdateTocResponse is delivered to a {@link JaimEventListener } when a buddy update is received from the TOC server
|
/**
|
||||||
|
* A BuddyUpdateTocResponse is delivered to a {@link JaimEventListener } when a buddy update is received from the TOC server
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
public class ChatInviteTocResponse extends TocResponse implements TocResponseHandler {
|
public class ChatInviteTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static String RESPONSE_TYPE = "CHAT_INVITE";
|
||||||
private String roomName;
|
private String roomName;
|
||||||
private String roomID;
|
private String roomID;
|
||||||
private String senderScreenname;
|
private String senderScreenname;
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
public static String RESPONSE_TYPE="CHAT_INVITE";
|
/**
|
||||||
|
* Creates new BuddyUpdateTocResponse
|
||||||
/** Creates new BuddyUpdateTocResponse */
|
*/
|
||||||
public ChatInviteTocResponse() {
|
public ChatInviteTocResponse() {
|
||||||
roomName = "";
|
roomName = "";
|
||||||
roomID = "";
|
roomID = "";
|
||||||
|
@ -49,19 +51,20 @@ public class ChatInviteTocResponse extends TocResponse implements TocResponseHan
|
||||||
message = "";
|
message = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The parseString method is used to populate the fields of this class from a Buddy Update string from the TOC server
|
/**
|
||||||
|
* The parseString method is used to populate the fields of this class from a Buddy Update string from the TOC server
|
||||||
|
*
|
||||||
* @param str The String containing the buddy update
|
* @param str The String containing the buddy update
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(String str) {
|
public TocResponse parseString(String str) {
|
||||||
ChatInviteTocResponse tr = new ChatInviteTocResponse();
|
ChatInviteTocResponse tr = new ChatInviteTocResponse();
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
cmd = str;
|
||||||
cmd=str;
|
StringTokenizer st = new StringTokenizer(str, ":");
|
||||||
StringTokenizer st=new StringTokenizer(str,":");
|
|
||||||
|
|
||||||
st.nextToken();
|
st.nextToken();
|
||||||
roomName = st.nextToken();
|
roomName = st.nextToken();
|
||||||
|
@ -70,7 +73,9 @@ public class ChatInviteTocResponse extends TocResponse implements TocResponseHan
|
||||||
message = st.nextToken();
|
message = st.nextToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the response type of this response. This method is used by the response dispatcher within JaimConnection
|
/**
|
||||||
|
* Get the response type of this response. This method is used by the response dispatcher within JaimConnection
|
||||||
|
*
|
||||||
* @return The response type
|
* @return The response type
|
||||||
*/
|
*/
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
|
@ -80,6 +85,7 @@ public class ChatInviteTocResponse extends TocResponse implements TocResponseHan
|
||||||
public String getRoomName() {
|
public String getRoomName() {
|
||||||
return roomName;
|
return roomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRoomID() {
|
public String getRoomID() {
|
||||||
return roomID;
|
return roomID;
|
||||||
}
|
}
|
||||||
|
@ -92,12 +98,14 @@ public class ChatInviteTocResponse extends TocResponse implements TocResponseHan
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,51 +21,63 @@
|
||||||
* ConfigTocResponse.java
|
* ConfigTocResponse.java
|
||||||
* Created on 1, October 2002
|
* Created on 1, October 2002
|
||||||
*/
|
*/
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/** A ConfigTocResponse contains the config message received from
|
/**
|
||||||
|
* A ConfigTocResponse contains the config message received from
|
||||||
* the toc server.
|
* the toc server.
|
||||||
*This response is handled by the JaimConnection class, but may also be used by client programs.
|
* This response is handled by the JaimConnection class, but may also be used by client programs.
|
||||||
*Once this event has been received, information returned from {@link JaimConnection#getGroups} is valid
|
* Once this event has been received, information returned from {@link JaimConnection#getGroups} is valid
|
||||||
|
*
|
||||||
* @author Brett Humphreys, Paul Wilkinson
|
* @author Brett Humphreys, Paul Wilkinson
|
||||||
*/
|
*/
|
||||||
public class ConfigTocResponse extends TocResponse implements TocResponseHandler {
|
public class ConfigTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
public static String RESPONSE_TYPE="CONFIG";
|
/**
|
||||||
|
* Value for mode that indicates PERMIT ALL mode
|
||||||
/** The Vector of Group objects */
|
*/
|
||||||
private Vector buddyList = new Vector();
|
public static final int PERMIT_ALL = 1;
|
||||||
|
/**
|
||||||
/** The HashMap of known buddies */
|
* Value for mode that indicates DENY ALL mode
|
||||||
|
*/
|
||||||
|
public static final int DENY_ALL = 2;
|
||||||
|
/**
|
||||||
|
* Value for mode that indicates PERMIT SOME mode
|
||||||
|
*/
|
||||||
|
public static final int PERMIT_SOME = 3;
|
||||||
|
/**
|
||||||
|
* Value for mode that indicates DENY SOME mode
|
||||||
|
*/
|
||||||
|
public static final int DENY_SOME = 4;
|
||||||
|
public static String RESPONSE_TYPE = "CONFIG";
|
||||||
|
/**
|
||||||
|
* The Vector of Group objects
|
||||||
|
*/
|
||||||
|
private final Vector buddyList = new Vector();
|
||||||
|
/**
|
||||||
|
* The HashMap of known buddies
|
||||||
|
*/
|
||||||
private HashMap buddies;
|
private HashMap buddies;
|
||||||
|
/**
|
||||||
/** The mode for this configuration */
|
* The mode for this configuration
|
||||||
|
*/
|
||||||
private int mode;
|
private int mode;
|
||||||
|
|
||||||
/** Value for mode that indicates PERMIT ALL mode */
|
/**
|
||||||
public static final int PERMIT_ALL=1;
|
* Returns an Enumeration of groups. Each Entry is a {@link Group}
|
||||||
|
|
||||||
/** Value for mode that indicates DENY ALL mode */
|
|
||||||
public static final int DENY_ALL=2;
|
|
||||||
|
|
||||||
/** Value for mode that indicates PERMIT SOME mode */
|
|
||||||
public static final int PERMIT_SOME=3;
|
|
||||||
|
|
||||||
/** Value for mode that indicates DENY SOME mode */
|
|
||||||
public static final int DENY_SOME=4;
|
|
||||||
|
|
||||||
/** Returns an Enumeration of groups. Each Entry is a {@link Group}
|
|
||||||
* Each group then has an Enumeration of buddies within that group See {@link Group#enumerateBuddies}.
|
* Each group then has an Enumeration of buddies within that group See {@link Group#enumerateBuddies}.
|
||||||
|
*
|
||||||
* @return list of Group elements or an empty list if none are found.
|
* @return list of Group elements or an empty list if none are found.
|
||||||
*/
|
*/
|
||||||
public Enumeration enumerateGroups()
|
public Enumeration enumerateGroups() {
|
||||||
{
|
|
||||||
return buddyList.elements();
|
return buddyList.elements();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a Collection of groups. Each element is a {@link Group)
|
/**
|
||||||
|
* Returns a Collection of groups. Each element is a {@link Group)
|
||||||
|
*
|
||||||
* @return the groups
|
* @return the groups
|
||||||
*/
|
*/
|
||||||
public Collection getGroups() {
|
public Collection getGroups() {
|
||||||
|
@ -74,45 +86,45 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Get the response type of this response. This method is used by the response dispatcher within JaimConnection
|
/**
|
||||||
|
* Get the response type of this response. This method is used by the response dispatcher within JaimConnection
|
||||||
|
*
|
||||||
* @return The response type
|
* @return The response type
|
||||||
*/
|
*/
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
return RESPONSE_TYPE;
|
return RESPONSE_TYPE;
|
||||||
}
|
}
|
||||||
/** Parses the config string.
|
|
||||||
|
/**
|
||||||
|
* Parses the config string.
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(String message)
|
public TocResponse parseString(String message) {
|
||||||
{
|
|
||||||
ConfigTocResponse tr = new ConfigTocResponse();
|
ConfigTocResponse tr = new ConfigTocResponse();
|
||||||
tr.doParse(message);
|
tr.doParse(message);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String message)
|
private void doParse(String message) {
|
||||||
{
|
cmd = message;
|
||||||
cmd=message;
|
|
||||||
int colonIndex = message.indexOf(':');
|
int colonIndex = message.indexOf(':');
|
||||||
//throw away the first word.
|
//throw away the first word.
|
||||||
message = message.substring(colonIndex+1, message.length());
|
message = message.substring(colonIndex + 1);
|
||||||
buddies = new HashMap();
|
buddies = new HashMap();
|
||||||
StringTokenizer tok = new StringTokenizer(message,"\n");
|
StringTokenizer tok = new StringTokenizer(message, "\n");
|
||||||
String itemType;
|
String itemType;
|
||||||
String itemValue;
|
String itemValue;
|
||||||
Group currentGroup=null;
|
Group currentGroup = null;
|
||||||
Buddy tmpBuddy;
|
Buddy tmpBuddy;
|
||||||
while( tok.hasMoreTokens() )
|
while (tok.hasMoreTokens()) {
|
||||||
{
|
|
||||||
// Can't tokenize on both \n and space since there could be spaces
|
// Can't tokenize on both \n and space since there could be spaces
|
||||||
// in the name, so parsing by hand.
|
// in the name, so parsing by hand.
|
||||||
itemType = tok.nextToken();
|
itemType = tok.nextToken();
|
||||||
int firstSpace = itemType.indexOf(' ');
|
int firstSpace = itemType.indexOf(' ');
|
||||||
itemValue = itemType.substring(firstSpace+1, itemType.length());
|
itemValue = itemType.substring(firstSpace + 1);
|
||||||
itemType = itemType.substring(0, firstSpace);
|
itemType = itemType.substring(0, firstSpace);
|
||||||
|
|
||||||
char type = itemType.charAt(0);
|
char type = itemType.charAt(0);
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case 'g':
|
case 'g':
|
||||||
currentGroup = new Group(itemValue);
|
currentGroup = new Group(itemValue);
|
||||||
buddyList.add(currentGroup);
|
buddyList.add(currentGroup);
|
||||||
|
@ -122,8 +134,7 @@
|
||||||
|
|
||||||
tmpBuddy = getBuddy(itemValue);
|
tmpBuddy = getBuddy(itemValue);
|
||||||
//this shouldn't happen, but:
|
//this shouldn't happen, but:
|
||||||
if(currentGroup==null)
|
if (currentGroup == null) {
|
||||||
{
|
|
||||||
currentGroup = new Group("<unknown>");
|
currentGroup = new Group("<unknown>");
|
||||||
buddyList.add(currentGroup);
|
buddyList.add(currentGroup);
|
||||||
}
|
}
|
||||||
|
@ -150,45 +161,49 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return an existing Buddy with the specified name or return a new buddy if the name is not known
|
/**
|
||||||
|
* Return an existing Buddy with the specified name or return a new buddy if the name is not known
|
||||||
* The buddy is added to the buddies hash if it is a new buddy
|
* The buddy is added to the buddies hash if it is a new buddy
|
||||||
|
*
|
||||||
* @param The name of the buddy we are looking for
|
* @param The name of the buddy we are looking for
|
||||||
* @return The buddy object
|
* @return The buddy object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Buddy getBuddy(String buddyName)
|
private Buddy getBuddy(String buddyName) {
|
||||||
{
|
Buddy retBuddy = (Buddy) buddies.get(buddyName);
|
||||||
Buddy retBuddy = (Buddy)buddies.get(buddyName);
|
if (retBuddy == null) {
|
||||||
if (retBuddy== null)
|
retBuddy = new Buddy(buddyName);
|
||||||
{
|
buddies.put(buddyName, retBuddy);
|
||||||
retBuddy=new Buddy(buddyName);
|
|
||||||
buddies.put(buddyName,retBuddy);
|
|
||||||
}
|
}
|
||||||
return(retBuddy);
|
return (retBuddy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the mode for this configuration
|
/**
|
||||||
* @param modeVal the string value of the mode (1-4)
|
* Gets the mode for this configuration
|
||||||
*/
|
*
|
||||||
public void setMode( int modeVal )
|
|
||||||
{
|
|
||||||
mode = modeVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets the mode for this configuration
|
|
||||||
* @return mode for the configuration
|
* @return mode for the configuration
|
||||||
*/
|
*/
|
||||||
public int getMode( )
|
public int getMode() {
|
||||||
{
|
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Sets the mode for this configuration
|
||||||
|
*
|
||||||
|
* @param modeVal the string value of the mode (1-4)
|
||||||
|
*/
|
||||||
|
public void setMode(int modeVal) {
|
||||||
|
mode = modeVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,17 @@ package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that the connection to the server has been lost.
|
* This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that the connection to the server has been lost.
|
||||||
|
*
|
||||||
* @author wilko
|
* @author wilko
|
||||||
* @version: $revision: $
|
* @version: $revision: $
|
||||||
*/
|
*/
|
||||||
public class ConnectionLostTocResponse extends TocResponse {
|
public class ConnectionLostTocResponse extends TocResponse {
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="CONNECTIONLOST";
|
public static final String RESPONSE_TYPE = "CONNECTIONLOST";
|
||||||
|
|
||||||
/** Creates a new instance of LoginCompleteTocResponse */
|
/**
|
||||||
|
* Creates a new instance of LoginCompleteTocResponse
|
||||||
|
*/
|
||||||
public ConnectionLostTocResponse() {
|
public ConnectionLostTocResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +45,7 @@ public class ConnectionLostTocResponse extends TocResponse {
|
||||||
return (RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return (RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,106 +27,103 @@ package com.wilko.jaim;
|
||||||
|
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
|
|
||||||
/** This TOC response is sent to a {@link JaimEventListener } when an error message is received from the TOC server
|
/**
|
||||||
|
* This TOC response is sent to a {@link JaimEventListener } when an error message is received from the TOC server
|
||||||
*
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
public class ErrorTocResponse extends TocResponse implements TocResponseHandler {
|
public class ErrorTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static final String RESPONSE_TYPE = "ERROR";
|
||||||
int errorCode;
|
int errorCode;
|
||||||
String errorText;
|
String errorText;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="ERROR";
|
/**
|
||||||
|
* Creates new ErrorTocResponse
|
||||||
/** Creates new ErrorTocResponse */
|
*/
|
||||||
public ErrorTocResponse() {
|
public ErrorTocResponse() {
|
||||||
errorCode=0;
|
errorCode = 0;
|
||||||
errorText="";
|
errorText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/** Parse the error response string sent by the TOC server
|
* Obtain the error message that corresponds to the specified error code
|
||||||
* @param str The error response string
|
*
|
||||||
*/
|
* @param code The error code
|
||||||
public TocResponse parseString(String str)
|
|
||||||
{
|
|
||||||
ErrorTocResponse tr=new ErrorTocResponse();
|
|
||||||
tr.doParse(str);
|
|
||||||
return(tr);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doParse(String str)
|
|
||||||
{
|
|
||||||
|
|
||||||
cmd=str;
|
|
||||||
int colonPos=str.indexOf(':');
|
|
||||||
if (colonPos!=-1)
|
|
||||||
{
|
|
||||||
str=str.substring(colonPos+1);
|
|
||||||
colonPos=str.indexOf(':');
|
|
||||||
if (colonPos!=-1)
|
|
||||||
{
|
|
||||||
errorCode=Integer.parseInt(str.substring(0,colonPos));
|
|
||||||
errorText=str.substring(colonPos+1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorCode=Integer.parseInt(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Obtain the error code for this response
|
|
||||||
* @return The error code
|
|
||||||
*/
|
|
||||||
public int getErrorCode()
|
|
||||||
{
|
|
||||||
return(errorCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the error text (if any) associated with this error response
|
|
||||||
* @return The error text
|
* @return The error text
|
||||||
*/
|
*/
|
||||||
public String getErrorText()
|
static public String getErrorDescription(int code) {
|
||||||
{
|
try {
|
||||||
return(errorText);
|
return (java.util.ResourceBundle.getBundle("com/wilko/jaim/TocErrorDescriptions").getString(Integer.toString(code)));
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
return ("Unable to locate error description:" + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the error response string sent by the TOC server
|
||||||
|
*
|
||||||
|
* @param str The error response string
|
||||||
|
*/
|
||||||
|
public TocResponse parseString(String str) {
|
||||||
|
ErrorTocResponse tr = new ErrorTocResponse();
|
||||||
|
tr.doParse(str);
|
||||||
|
return (tr);
|
||||||
|
}
|
||||||
|
|
||||||
/** Obtain the error message that corresponds to this error.
|
private void doParse(String str) {
|
||||||
|
|
||||||
|
cmd = str;
|
||||||
|
int colonPos = str.indexOf(':');
|
||||||
|
if (colonPos != -1) {
|
||||||
|
str = str.substring(colonPos + 1);
|
||||||
|
colonPos = str.indexOf(':');
|
||||||
|
if (colonPos != -1) {
|
||||||
|
errorCode = Integer.parseInt(str.substring(0, colonPos));
|
||||||
|
errorText = str.substring(colonPos + 1);
|
||||||
|
} else {
|
||||||
|
errorCode = Integer.parseInt(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain the error code for this response
|
||||||
|
*
|
||||||
|
* @return The error code
|
||||||
|
*/
|
||||||
|
public int getErrorCode() {
|
||||||
|
return (errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the error text (if any) associated with this error response
|
||||||
|
*
|
||||||
|
* @return The error text
|
||||||
|
*/
|
||||||
|
public String getErrorText() {
|
||||||
|
return (errorText);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain the error message that corresponds to this error.
|
||||||
|
*
|
||||||
* @return The error text with any applicable error argument text inserted
|
* @return The error text with any applicable error argument text inserted
|
||||||
*/
|
*/
|
||||||
public String getErrorDescription() {
|
public String getErrorDescription() {
|
||||||
try {
|
try {
|
||||||
StringBuffer desc=new StringBuffer(java.util.ResourceBundle.getBundle("com/wilko/jaim/TocErrorDescriptions").getString(Integer.toString(errorCode)));
|
StringBuffer desc = new StringBuffer(java.util.ResourceBundle.getBundle("com/wilko/jaim/TocErrorDescriptions").getString(Integer.toString(errorCode)));
|
||||||
String sDesc=desc.toString();
|
String sDesc = desc.toString();
|
||||||
int argpos=sDesc.indexOf("%s");
|
int argpos = sDesc.indexOf("%s");
|
||||||
if (argpos != -1) {
|
if (argpos != -1) {
|
||||||
desc.replace(argpos,argpos+1,errorText);
|
desc.replace(argpos, argpos + 1, errorText);
|
||||||
}
|
}
|
||||||
return(desc.toString());
|
return (desc.toString());
|
||||||
|
|
||||||
}
|
} catch (MissingResourceException e) {
|
||||||
catch (MissingResourceException e) {
|
return ("Unable to locate error description:" + e);
|
||||||
return("Unable to locate error description:"+e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Obtain the error message that corresponds to the specified error code
|
|
||||||
* @param code The error code
|
|
||||||
* @return The error text
|
|
||||||
*/
|
|
||||||
static public String getErrorDescription(int code)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return(java.util.ResourceBundle.getBundle("com/wilko/jaim/TocErrorDescriptions").getString(Integer.toString(code)));
|
|
||||||
}
|
|
||||||
catch (MissingResourceException e)
|
|
||||||
{
|
|
||||||
return("Unable to locate error description:"+e.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,12 +131,14 @@ public class ErrorTocResponse extends TocResponse implements TocResponseHandler
|
||||||
return RESPONSE_TYPE;
|
return RESPONSE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,78 +27,84 @@ package com.wilko.jaim;
|
||||||
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
/** An EvilTocResponse is delivered to a {@link JaimEventListener } when the signed on buddy is "eviled" or warned
|
/**
|
||||||
|
* An EvilTocResponse is delivered to a {@link JaimEventListener } when the signed on buddy is "eviled" or warned
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
public class EvilTocResponse extends TocResponse implements TocResponseHandler {
|
public class EvilTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static final String RESPONSE_TYPE = "EVILED";
|
||||||
private boolean anonymousEvil;
|
private boolean anonymousEvil;
|
||||||
private int evilAmount;
|
private int evilAmount;
|
||||||
private String evilBy;
|
private String evilBy;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="EVILED";
|
/**
|
||||||
|
* Creates new EvilTocResponse
|
||||||
/** Creates new EvilTocResponse */
|
*/
|
||||||
public EvilTocResponse() {
|
public EvilTocResponse() {
|
||||||
anonymousEvil=true;
|
anonymousEvil = true;
|
||||||
evilBy="";
|
evilBy = "";
|
||||||
evilAmount=0;
|
evilAmount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse the evil message from the TOC server
|
/**
|
||||||
|
* Parse the evil message from the TOC server
|
||||||
|
*
|
||||||
* @param str The evil message
|
* @param str The evil message
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(java.lang.String str) {
|
public TocResponse parseString(java.lang.String str) {
|
||||||
EvilTocResponse tr=new EvilTocResponse();
|
EvilTocResponse tr = new EvilTocResponse();
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
|
||||||
|
|
||||||
StringTokenizer st=new StringTokenizer(str,":");
|
StringTokenizer st = new StringTokenizer(str, ":");
|
||||||
|
|
||||||
st.nextToken(); // skip over "EVILED"
|
st.nextToken(); // skip over "EVILED"
|
||||||
evilAmount=Integer.parseInt(st.nextToken());
|
evilAmount = Integer.parseInt(st.nextToken());
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens()) {
|
||||||
{
|
evilBy = st.nextToken();
|
||||||
evilBy=st.nextToken();
|
anonymousEvil = false;
|
||||||
anonymousEvil=false;
|
} else {
|
||||||
}
|
anonymousEvil = true;
|
||||||
else
|
|
||||||
{
|
|
||||||
anonymousEvil=true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the evil amount from this response. This is the current evil or warning level for the authenticated buddy, not the increment specified by the last warning
|
/**
|
||||||
|
* Get the evil amount from this response. This is the current evil or warning level for the authenticated buddy, not the increment specified by the last warning
|
||||||
|
*
|
||||||
* @return The cumulative evil or warning level
|
* @return The cumulative evil or warning level
|
||||||
*/
|
*/
|
||||||
public int getEvilAmount()
|
public int getEvilAmount() {
|
||||||
{
|
return (evilAmount);
|
||||||
return(evilAmount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the name of the buddy that issued the warning.
|
/**
|
||||||
|
* Obtain the name of the buddy that issued the warning.
|
||||||
|
*
|
||||||
* @return The buddy name that issued the warning
|
* @return The buddy name that issued the warning
|
||||||
* @see #isAnonymous
|
* @see #isAnonymous
|
||||||
*/
|
*/
|
||||||
public String getEvilBy()
|
public String getEvilBy() {
|
||||||
{
|
return (evilBy);
|
||||||
return(evilBy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the anonymous status of this warning
|
/**
|
||||||
|
* Obtain the anonymous status of this warning
|
||||||
|
*
|
||||||
* @return true if this warning was issued anonymously
|
* @return true if this warning was issued anonymously
|
||||||
*/
|
*/
|
||||||
public boolean isAnonymous()
|
public boolean isAnonymous() {
|
||||||
{
|
return (anonymousEvil);
|
||||||
return(anonymousEvil);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used by the response dispatcher
|
/**
|
||||||
|
* Used by the response dispatcher
|
||||||
|
*
|
||||||
* @return The response type
|
* @return The response type
|
||||||
*/
|
*/
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
|
@ -106,12 +112,14 @@ public class EvilTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
|
@ -34,43 +33,41 @@ public class FLAPDataFrame extends FLAPFrame {
|
||||||
|
|
||||||
private int frameLen;
|
private int frameLen;
|
||||||
|
|
||||||
/** Creates new FlapDataFrame */
|
/**
|
||||||
|
* Creates new FlapDataFrame
|
||||||
|
*/
|
||||||
public FLAPDataFrame() {
|
public FLAPDataFrame() {
|
||||||
frame[1]=FLAP_FRAME_DATA;
|
frame[1] = FLAP_FRAME_DATA;
|
||||||
frameLen=1;
|
frameLen = 1;
|
||||||
frame[FLAP_DATA_OFFSET]=0;
|
frame[FLAP_DATA_OFFSET] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLAPDataFrame(byte frameData[])
|
public FLAPDataFrame(byte[] frameData) {
|
||||||
{
|
frame[1] = FLAP_FRAME_DATA;
|
||||||
frame[1]=FLAP_FRAME_DATA;
|
frameLen = 1;
|
||||||
frameLen=1;
|
frame[FLAP_DATA_OFFSET] = 0;
|
||||||
frame[FLAP_DATA_OFFSET]=0;
|
|
||||||
setFrameData(frameData);
|
setFrameData(frameData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getFLAPFrameType() {
|
public int getFLAPFrameType() {
|
||||||
return(FLAPFrame.FLAP_FRAME_DATA);
|
return (FLAPFrame.FLAP_FRAME_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addString(String s)
|
public void addString(String s) {
|
||||||
{
|
|
||||||
frameLen--; // Backspace over '0'
|
frameLen--; // Backspace over '0'
|
||||||
for (int i=0;i<s.length();i++)
|
for (int i = 0; i < s.length(); i++) {
|
||||||
{
|
frame[FLAP_DATA_OFFSET + frameLen++] = (byte) s.charAt(i);
|
||||||
frame[FLAP_DATA_OFFSET+frameLen++]=(byte)s.charAt(i);
|
|
||||||
}
|
}
|
||||||
frame[FLAP_DATA_OFFSET+frameLen++]=0;
|
frame[FLAP_DATA_OFFSET + frameLen++] = 0;
|
||||||
setLength(frameLen);
|
setLength(frameLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getContent()
|
public byte[] getContent() {
|
||||||
{
|
|
||||||
byte[] retarray = new byte[getLength()];
|
byte[] retarray = new byte[getLength()];
|
||||||
|
|
||||||
System.arraycopy(frame,FLAPFrame.FLAP_DATA_OFFSET,retarray,0,getLength());
|
System.arraycopy(frame, FLAPFrame.FLAP_DATA_OFFSET, retarray, 0, getLength());
|
||||||
return(retarray);
|
return (retarray);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,21 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class FLAPErrorFrame extends FLAPFrame {
|
public class FLAPErrorFrame extends FLAPFrame {
|
||||||
|
|
||||||
/** Creates new FLAPErrorFrame */
|
/**
|
||||||
|
* Creates new FLAPErrorFrame
|
||||||
|
*/
|
||||||
public FLAPErrorFrame() {
|
public FLAPErrorFrame() {
|
||||||
frame[1]=FLAP_FRAME_ERROR;
|
frame[1] = FLAP_FRAME_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLAPErrorFrame(byte frameData[])
|
public FLAPErrorFrame(byte[] frameData) {
|
||||||
{
|
frame[1] = FLAP_FRAME_ERROR;
|
||||||
frame[1]=FLAP_FRAME_ERROR;
|
|
||||||
setFrameData(frameData);
|
setFrameData(frameData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,94 +26,84 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
public abstract class FLAPFrame {
|
public abstract class FLAPFrame {
|
||||||
|
|
||||||
public static final int FLAP_FRAME_SIGNON=1;
|
public static final int FLAP_FRAME_SIGNON = 1;
|
||||||
public static final int FLAP_FRAME_DATA=2;
|
public static final int FLAP_FRAME_DATA = 2;
|
||||||
public static final int FLAP_FRAME_ERROR=3;
|
public static final int FLAP_FRAME_ERROR = 3;
|
||||||
public static final int FLAP_FRAME_SIGNOFF=4;
|
public static final int FLAP_FRAME_SIGNOFF = 4;
|
||||||
public static final int FLAP_FRAME_KEEP_ALIVE=5;
|
public static final int FLAP_FRAME_KEEP_ALIVE = 5;
|
||||||
public static final int FLAP_DATA_OFFSET=6;
|
public static final int FLAP_DATA_OFFSET = 6;
|
||||||
|
|
||||||
protected byte[] frame;
|
protected byte[] frame;
|
||||||
protected int fLen;
|
protected int fLen;
|
||||||
|
|
||||||
/** Creates new FLAPFrame */
|
/**
|
||||||
|
* Creates new FLAPFrame
|
||||||
|
*/
|
||||||
public FLAPFrame() {
|
public FLAPFrame() {
|
||||||
initialise();
|
initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setFrameData(byte b[])
|
protected void initialise() {
|
||||||
{
|
|
||||||
frame=new byte[b.length];
|
|
||||||
fLen=b.length;
|
|
||||||
System.arraycopy(b,0,frame,0,b.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void initialise()
|
|
||||||
{
|
|
||||||
frame = new byte[8192];
|
frame = new byte[8192];
|
||||||
frame[0]=(byte)'*';
|
frame[0] = (byte) '*';
|
||||||
frame[1]=0;
|
frame[1] = 0;
|
||||||
frame[2]=0;
|
frame[2] = 0;
|
||||||
frame[3]=0;
|
frame[3] = 0;
|
||||||
frame[4]=0;
|
frame[4] = 0;
|
||||||
frame[5]=0;
|
frame[5] = 0;
|
||||||
fLen=6;
|
fLen = 6;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSequence(int sequence)
|
public int getSequence() {
|
||||||
{
|
return ((frame[2] & 0xff) * 256 + (frame[3] & 0xff));
|
||||||
frame[2]=(byte)((sequence/256)&0xff);
|
|
||||||
frame[3]=(byte)(sequence&0xff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSequence()
|
public void setSequence(int sequence) {
|
||||||
{
|
frame[2] = (byte) ((sequence / 256) & 0xff);
|
||||||
return((frame[2]&0xff)*256+(frame[3]&0xff));
|
frame[3] = (byte) (sequence & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength()
|
public int getLength() {
|
||||||
{
|
return ((frame[4] & 0xff) * 256 + (frame[5] & 0xff));
|
||||||
return((frame[4]&0xff)*256+(frame[5]&0xff));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLength(int length)
|
public void setLength(int length) {
|
||||||
{
|
frame[4] = (byte) (length / 256);
|
||||||
frame[4]=(byte)(length/256);
|
frame[5] = (byte) (length & 0xff);
|
||||||
frame[5]=(byte)(length&0xff);
|
fLen = length + FLAP_DATA_OFFSET;
|
||||||
fLen=length+FLAP_DATA_OFFSET;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getFrameData()
|
public byte[] getFrameData() {
|
||||||
{
|
byte[] b = new byte[fLen];
|
||||||
byte[] b=new byte[fLen];
|
System.arraycopy(frame, 0, b, 0, fLen);
|
||||||
System.arraycopy(frame,0,b,0,fLen);
|
return (b);
|
||||||
return(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
protected void setFrameData(byte[] b) {
|
||||||
{
|
frame = new byte[b.length];
|
||||||
StringBuffer temp=new StringBuffer();
|
fLen = b.length;
|
||||||
for (int i=0;i<fLen;i++)
|
System.arraycopy(b, 0, frame, 0, b.length);
|
||||||
{
|
|
||||||
int k=frame[i]&0xff;
|
|
||||||
if (k<16)
|
|
||||||
{
|
|
||||||
temp.append("0"+Integer.toHexString(k)+" ");
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
public String toString() {
|
||||||
temp.append(Integer.toHexString(k)+" ");
|
StringBuffer temp = new StringBuffer();
|
||||||
|
for (int i = 0; i < fLen; i++) {
|
||||||
|
int k = frame[i] & 0xff;
|
||||||
|
if (k < 16) {
|
||||||
|
temp.append("0" + Integer.toHexString(k) + " ");
|
||||||
|
} else {
|
||||||
|
temp.append(Integer.toHexString(k) + " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(temp.toString());
|
return (temp.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract int getFLAPFrameType();
|
public abstract int getFLAPFrameType();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +40,7 @@ public class FLAPFrameException extends java.lang.Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>FLAPFrameException</code> with the specified detail message.
|
* Constructs an <code>FLAPFrameException</code> with the specified detail message.
|
||||||
|
*
|
||||||
* @param msg the detail message.
|
* @param msg the detail message.
|
||||||
*/
|
*/
|
||||||
public FLAPFrameException(String msg) {
|
public FLAPFrameException(String msg) {
|
||||||
|
|
|
@ -26,44 +26,43 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public abstract class FLAPFrameFactory {
|
public abstract class FLAPFrameFactory {
|
||||||
|
|
||||||
/** Creates new FLAPFrameFactory */
|
/**
|
||||||
|
* Creates new FLAPFrameFactory
|
||||||
|
*/
|
||||||
public FLAPFrameFactory() {
|
public FLAPFrameFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FLAPFrame createFLAPFrame(byte[] frameData) throws FLAPFrameException {
|
public static FLAPFrame createFLAPFrame(byte[] frameData) throws FLAPFrameException {
|
||||||
FLAPFrame f=null;
|
FLAPFrame f = null;
|
||||||
if (frameData[0]!='*')
|
if (frameData[0] != '*') {
|
||||||
{
|
|
||||||
throw new FLAPFrameException("Frame does not start with '*'");
|
throw new FLAPFrameException("Frame does not start with '*'");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (frameData[1])
|
switch (frameData[1]) {
|
||||||
{
|
|
||||||
case FLAPFrame.FLAP_FRAME_SIGNON:
|
case FLAPFrame.FLAP_FRAME_SIGNON:
|
||||||
f=new FLAPSignonFrame(frameData);
|
f = new FLAPSignonFrame(frameData);
|
||||||
break;
|
break;
|
||||||
case FLAPFrame.FLAP_FRAME_DATA:
|
case FLAPFrame.FLAP_FRAME_DATA:
|
||||||
f=new FLAPDataFrame(frameData);
|
f = new FLAPDataFrame(frameData);
|
||||||
break;
|
break;
|
||||||
case FLAPFrame.FLAP_FRAME_ERROR:
|
case FLAPFrame.FLAP_FRAME_ERROR:
|
||||||
f=new FLAPErrorFrame(frameData);
|
f = new FLAPErrorFrame(frameData);
|
||||||
break;
|
break;
|
||||||
case FLAPFrame.FLAP_FRAME_SIGNOFF:
|
case FLAPFrame.FLAP_FRAME_SIGNOFF:
|
||||||
f=new FLAPSignoffFrame(frameData);
|
f = new FLAPSignoffFrame(frameData);
|
||||||
break;
|
break;
|
||||||
case FLAPFrame.FLAP_FRAME_KEEP_ALIVE:
|
case FLAPFrame.FLAP_FRAME_KEEP_ALIVE:
|
||||||
f=new FLAPKeepAliveFrame(frameData);
|
f = new FLAPKeepAliveFrame(frameData);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new FLAPFrameException("Illegal FLAP Frame type: "+Integer.toString(frameData[1]));
|
throw new FLAPFrameException("Illegal FLAP Frame type: " + Integer.toString(frameData[1]));
|
||||||
}
|
}
|
||||||
return(f);
|
return (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,51 +26,44 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class FLAPInputFrame extends FLAPFrame {
|
public class FLAPInputFrame extends FLAPFrame {
|
||||||
|
|
||||||
/** Creates new FLAPInputFrame */
|
/**
|
||||||
|
* Creates new FLAPInputFrame
|
||||||
|
*/
|
||||||
private int frameLen;
|
private int frameLen;
|
||||||
|
|
||||||
public FLAPInputFrame() {
|
public FLAPInputFrame() {
|
||||||
frameLen=0;
|
frameLen = 0;
|
||||||
super.initialise();
|
super.initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFrameData(byte b)
|
public void addFrameData(byte b) {
|
||||||
{
|
frame[frameLen++] = b;
|
||||||
frame[frameLen++]=b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getFrameData()
|
public byte[] getFrameData() {
|
||||||
{
|
byte[] b = new byte[frameLen];
|
||||||
byte[] b=new byte[frameLen];
|
System.arraycopy(frame, 0, b, 0, frameLen);
|
||||||
System.arraycopy(frame,0,b,0,frameLen);
|
return (b);
|
||||||
return(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetInputFrame()
|
public void resetInputFrame() {
|
||||||
{
|
frameLen = 0;
|
||||||
frameLen=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean completeFrameRead()
|
public boolean completeFrameRead() {
|
||||||
{
|
if (frameLen > 5) {
|
||||||
if (frameLen > 5)
|
return frameLen - 6 == getLength();
|
||||||
{
|
|
||||||
if (frameLen-6 == getLength())
|
|
||||||
{
|
|
||||||
return(true);
|
|
||||||
}
|
}
|
||||||
}
|
return (false);
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFLAPFrameType() {
|
public int getFLAPFrameType() {
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,27 +26,26 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
public class FLAPKeepAliveFrame extends FLAPFrame {
|
public class FLAPKeepAliveFrame extends FLAPFrame {
|
||||||
|
|
||||||
/** Creates new FLAPKeepAliveFrame */
|
/**
|
||||||
|
* Creates new FLAPKeepAliveFrame
|
||||||
|
*/
|
||||||
public FLAPKeepAliveFrame() {
|
public FLAPKeepAliveFrame() {
|
||||||
this.initialise();
|
this.initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLAPKeepAliveFrame(byte frameData[])
|
public FLAPKeepAliveFrame(byte[] frameData) {
|
||||||
{
|
|
||||||
initialise();
|
initialise();
|
||||||
setFrameData(frameData);
|
setFrameData(frameData);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initialise()
|
protected void initialise() {
|
||||||
{
|
|
||||||
super.initialise();
|
super.initialise();
|
||||||
frame[1]=FLAP_FRAME_KEEP_ALIVE;
|
frame[1] = FLAP_FRAME_KEEP_ALIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFLAPFrameType() {
|
public int getFLAPFrameType() {
|
||||||
|
|
|
@ -26,27 +26,27 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class FLAPSignoffFrame extends FLAPFrame {
|
public class FLAPSignoffFrame extends FLAPFrame {
|
||||||
|
|
||||||
/** Creates new FlapSignonFrame */
|
/**
|
||||||
|
* Creates new FlapSignonFrame
|
||||||
|
*/
|
||||||
public FLAPSignoffFrame() {
|
public FLAPSignoffFrame() {
|
||||||
|
|
||||||
frame[1]=FLAP_FRAME_SIGNOFF;
|
frame[1] = FLAP_FRAME_SIGNOFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLAPSignoffFrame(byte frameData[])
|
public FLAPSignoffFrame(byte[] frameData) {
|
||||||
{
|
frame[1] = FLAP_FRAME_SIGNOFF;
|
||||||
frame[1]=FLAP_FRAME_SIGNOFF;
|
|
||||||
setFrameData(frameData);
|
setFrameData(frameData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getFLAPFrameType() {
|
public int getFLAPFrameType() {
|
||||||
return(FLAPFrame.FLAP_FRAME_SIGNOFF);
|
return (FLAPFrame.FLAP_FRAME_SIGNOFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,65 +26,57 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class FLAPSignonFrame extends FLAPFrame {
|
public class FLAPSignonFrame extends FLAPFrame {
|
||||||
|
|
||||||
/** Creates new FlapSignonFrame */
|
/**
|
||||||
|
* Creates new FlapSignonFrame
|
||||||
|
*/
|
||||||
public FLAPSignonFrame() {
|
public FLAPSignonFrame() {
|
||||||
frame[1]=FLAP_FRAME_SIGNON;
|
frame[1] = FLAP_FRAME_SIGNON;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLAPSignonFrame(byte frameData[])
|
public FLAPSignonFrame(byte[] frameData) {
|
||||||
{
|
frame[1] = FLAP_FRAME_SIGNON;
|
||||||
frame[1]=FLAP_FRAME_SIGNON;
|
|
||||||
setFrameData(frameData);
|
setFrameData(frameData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFLAPVersion()
|
public int getFLAPVersion() {
|
||||||
{
|
return (((frame[6] & 0xff) * 16777216) + ((frame[7] & 0xff) * 65536) + ((frame[8] & 0xff) * 256) + (frame[9] & 0xff));
|
||||||
return(((frame[6]&0xff)*16777216)+((frame[7]&0xff)*65536)+((frame[8]&0xff)*256)+(frame[9]&0xff));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFLAPVersion(int version)
|
public void setFLAPVersion(int version) {
|
||||||
{
|
for (int i = 3; i >= 0; i--) {
|
||||||
for (int i=3;i>=0;i--)
|
frame[6 + i] = (byte) (version & 0xff);
|
||||||
{
|
version = version >> 8;
|
||||||
frame[6+i]=(byte)(version&0xff);
|
|
||||||
version=version>>8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTLVTag(int tag)
|
public void setTLVTag(int tag) {
|
||||||
{
|
for (int i = 1; i >= 0; i--) {
|
||||||
for (int i=1;i>=0;i--)
|
frame[10 + i] = (byte) (tag & 0xff);
|
||||||
{
|
tag = tag >> 8;
|
||||||
frame[10+i]=(byte)(tag&0xff);
|
|
||||||
tag=tag>>8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String name)
|
public void setUserName(String name) {
|
||||||
{
|
|
||||||
|
|
||||||
int len=0;
|
int len = 0;
|
||||||
for (int i=0;i<name.length();i++)
|
for (int i = 0; i < name.length(); i++) {
|
||||||
{
|
|
||||||
char c = name.charAt(i);
|
char c = name.charAt(i);
|
||||||
if (c != ' ')
|
if (c != ' ') {
|
||||||
{
|
frame[FLAP_DATA_OFFSET + 8 + len++] = (byte) c;
|
||||||
frame[FLAP_DATA_OFFSET+8+len++]=(byte)c;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setLength(8+len);
|
setLength(8 + len);
|
||||||
frame[FLAP_DATA_OFFSET+6]=(byte)(len/256);
|
frame[FLAP_DATA_OFFSET + 6] = (byte) (len / 256);
|
||||||
frame[FLAP_DATA_OFFSET+7]=(byte)(len&0xff);
|
frame[FLAP_DATA_OFFSET + 7] = (byte) (len & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFLAPFrameType() {
|
public int getFLAPFrameType() {
|
||||||
return(FLAPFrame.FLAP_FRAME_SIGNON);
|
return (FLAPFrame.FLAP_FRAME_SIGNON);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,61 +25,71 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/** A GenericTocResponse is used internally in the Response parsing and processing logic of {@link JaimConnection}
|
/**
|
||||||
|
* A GenericTocResponse is used internally in the Response parsing and processing logic of {@link JaimConnection}
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.5 $
|
||||||
*/
|
*/
|
||||||
public class GenericTocResponse extends TocResponse implements TocResponseHandler {
|
public class GenericTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
/** Creates new GenericTocCommand */
|
/**
|
||||||
|
* Creates new GenericTocCommand
|
||||||
|
*/
|
||||||
public GenericTocResponse() {
|
public GenericTocResponse() {
|
||||||
this.cmd="";
|
this.cmd = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse an incoming string
|
/**
|
||||||
|
* Parse an incoming string
|
||||||
|
*
|
||||||
* @param str The response string to be parsed
|
* @param str The response string to be parsed
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(String str)
|
public TocResponse parseString(String str) {
|
||||||
{
|
GenericTocResponse tr = new GenericTocResponse();
|
||||||
GenericTocResponse tr=new GenericTocResponse();
|
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return tr;
|
return tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
cmd = str;
|
||||||
cmd=str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a byte array that contains the response
|
/**
|
||||||
|
* Get a byte array that contains the response
|
||||||
|
*
|
||||||
* @return The response as an array of bytes
|
* @return The response as an array of bytes
|
||||||
*/
|
*/
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(cmd.getBytes());
|
return (cmd.getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert this response to a string
|
/**
|
||||||
|
* Convert this response to a string
|
||||||
|
*
|
||||||
* @return The response as a string
|
* @return The response as a string
|
||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (cmd);
|
||||||
return(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used in the response dispatching process
|
/**
|
||||||
|
* Used in the response dispatching process
|
||||||
|
*
|
||||||
* @return The respnse type
|
* @return The respnse type
|
||||||
*/
|
*/
|
||||||
public String getResponseType()
|
public String getResponseType() {
|
||||||
{
|
return ("UNKNOWN");
|
||||||
return("UNKNOWN");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,77 +25,84 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/** This response is delivered to a {@link JaimEventListener } when a GOTO response is received from TOC
|
/**
|
||||||
|
* This response is delivered to a {@link JaimEventListener } when a GOTO response is received from TOC
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class GotoTocResponse extends TocResponse implements TocResponseHandler {
|
public class GotoTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static final String RESPONSE_TYPE = "GOTO_URL";
|
||||||
String windowName;
|
String windowName;
|
||||||
boolean autoResponse;
|
boolean autoResponse;
|
||||||
String URL;
|
String URL;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="GOTO_URL";
|
/**
|
||||||
|
* Creates new GotoTocResponse
|
||||||
/** Creates new GotoTocResponse */
|
*/
|
||||||
public GotoTocResponse() {
|
public GotoTocResponse() {
|
||||||
windowName="";
|
windowName = "";
|
||||||
URL="";
|
URL = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the suggested window name for this URL
|
/**
|
||||||
|
* Obtain the suggested window name for this URL
|
||||||
|
*
|
||||||
* @return The window name
|
* @return The window name
|
||||||
*/
|
*/
|
||||||
public String getWindowName()
|
public String getWindowName() {
|
||||||
{
|
return (windowName);
|
||||||
return(windowName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the URL
|
/**
|
||||||
|
* Obtain the URL
|
||||||
|
*
|
||||||
* @return The URL
|
* @return The URL
|
||||||
*/
|
*/
|
||||||
public String getURL()
|
public String getURL() {
|
||||||
{
|
return (URL);
|
||||||
return(URL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
/** Parse an incoming response string
|
* Parse an incoming response string
|
||||||
|
*
|
||||||
* @param str The string to be parsed
|
* @param str The string to be parsed
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(java.lang.String str) {
|
public TocResponse parseString(java.lang.String str) {
|
||||||
GotoTocResponse tr=new GotoTocResponse();
|
GotoTocResponse tr = new GotoTocResponse();
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
cmd = str;
|
||||||
cmd=str;
|
int colonPos = str.indexOf(':');
|
||||||
int colonPos=str.indexOf(':');
|
if (colonPos != -1) {
|
||||||
if (colonPos!=-1)
|
str = str.substring(colonPos + 1);
|
||||||
{
|
colonPos = str.indexOf(':');
|
||||||
str=str.substring(colonPos+1);
|
if (colonPos != -1) {
|
||||||
colonPos=str.indexOf(':');
|
windowName = str.substring(0, colonPos);
|
||||||
if (colonPos != -1)
|
URL = str.substring(colonPos + 1);
|
||||||
{
|
|
||||||
windowName=str.substring(0,colonPos);
|
|
||||||
URL=str.substring(colonPos+1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the response type for response dispatching purposes
|
/**
|
||||||
|
* Obtain the response type for response dispatching purposes
|
||||||
|
*
|
||||||
* @return The response type
|
* @return The response type
|
||||||
*/
|
*/
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
return(RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,71 +25,89 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
import java.util.Vector;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
/** This is a logical user group. It holds a set of users.
|
/**
|
||||||
|
* This is a logical user group. It holds a set of users.
|
||||||
|
*
|
||||||
* @author Brett Humphreys
|
* @author Brett Humphreys
|
||||||
*/
|
*/
|
||||||
public class Group {
|
public class Group {
|
||||||
|
|
||||||
/** Vector of buddies for this group */
|
/**
|
||||||
private Vector buddies = new Vector();
|
* Vector of buddies for this group
|
||||||
|
*/
|
||||||
|
private final Vector buddies = new Vector();
|
||||||
|
|
||||||
/** Name of this group */
|
/**
|
||||||
private String groupName;
|
* Name of this group
|
||||||
|
*/
|
||||||
|
private final String groupName;
|
||||||
|
|
||||||
/** This constructor sets the name of the group
|
/**
|
||||||
|
* This constructor sets the name of the group
|
||||||
|
*
|
||||||
* @param name the group name
|
* @param name the group name
|
||||||
*/
|
*/
|
||||||
public Group( String name ) {
|
public Group(String name) {
|
||||||
groupName = name;
|
groupName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method adds a buddy to the end of the group
|
/**
|
||||||
|
* This method adds a buddy to the end of the group
|
||||||
|
*
|
||||||
* @param buddy The buddy object to associate with this group
|
* @param buddy The buddy object to associate with this group
|
||||||
*/
|
*/
|
||||||
public void addBuddy(Buddy buddy) {
|
public void addBuddy(Buddy buddy) {
|
||||||
buddies.add(buddy);
|
buddies.add(buddy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method adds a buddy to the specified location in the group
|
/**
|
||||||
|
* This method adds a buddy to the specified location in the group
|
||||||
* If the specified location is beyond the end of the group, then the buddy is added to the end of the group
|
* If the specified location is beyond the end of the group, then the buddy is added to the end of the group
|
||||||
|
*
|
||||||
* @param buddy The buddy object to associate with this group
|
* @param buddy The buddy object to associate with this group
|
||||||
* @param pos the position to add the buddy
|
* @param pos the position to add the buddy
|
||||||
*/
|
*/
|
||||||
public void addBuddy(Buddy buddy,int pos) {
|
public void addBuddy(Buddy buddy, int pos) {
|
||||||
if (pos > buddies.size()) {
|
if (pos > buddies.size()) {
|
||||||
buddies.add(buddy);
|
buddies.add(buddy);
|
||||||
}
|
} else {
|
||||||
else {
|
buddies.add(pos, buddy);
|
||||||
buddies.add(pos,buddy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method gets the group name
|
/**
|
||||||
|
* This method gets the group name
|
||||||
|
*
|
||||||
* @return the group name
|
* @return the group name
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return groupName;
|
return groupName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method returns the buddies in this group
|
/**
|
||||||
|
* This method returns the buddies in this group
|
||||||
|
*
|
||||||
* @return an Enumeration of {@link Buddy} objects
|
* @return an Enumeration of {@link Buddy} objects
|
||||||
*/
|
*/
|
||||||
public Enumeration enumerateBuddies() {
|
public Enumeration enumerateBuddies() {
|
||||||
return buddies.elements();
|
return buddies.elements();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method returns the number of buddies in this group
|
/**
|
||||||
|
* This method returns the number of buddies in this group
|
||||||
|
*
|
||||||
* @return buddy count
|
* @return buddy count
|
||||||
*/
|
*/
|
||||||
public int getBuddyCount() {
|
public int getBuddyCount() {
|
||||||
return(buddies.size());
|
return (buddies.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method returns the buddies in this group
|
/**
|
||||||
|
* This method returns the buddies in this group
|
||||||
|
*
|
||||||
* @return a Collection of {@link Buddy} objects
|
* @return a Collection of {@link Buddy} objects
|
||||||
*/
|
*/
|
||||||
public java.util.Collection getBuddies() {
|
public java.util.Collection getBuddies() {
|
||||||
|
|
|
@ -25,93 +25,100 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/** This response is delivered to a {@link JaimEventListener } when an instant message is received
|
/**
|
||||||
|
* This response is delivered to a {@link JaimEventListener } when an instant message is received
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
public class IMTocResponse extends TocResponse implements TocResponseHandler {
|
public class IMTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static final String RESPONSE_TYPE = "IM_IN";
|
||||||
String from;
|
String from;
|
||||||
boolean autoResponse;
|
boolean autoResponse;
|
||||||
String msg;
|
String msg;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="IM_IN";
|
/**
|
||||||
|
* Creates new TocIMResponse
|
||||||
/** Creates new TocIMResponse */
|
*/
|
||||||
public IMTocResponse() {
|
public IMTocResponse() {
|
||||||
from="";
|
from = "";
|
||||||
msg="";
|
msg = "";
|
||||||
autoResponse=false;
|
autoResponse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the name of the buddy who sent this instant message
|
/**
|
||||||
|
* Obtain the name of the buddy who sent this instant message
|
||||||
|
*
|
||||||
* @return The senders name
|
* @return The senders name
|
||||||
*/
|
*/
|
||||||
public String getFrom()
|
public String getFrom() {
|
||||||
{
|
return (from);
|
||||||
return(from);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the message
|
/**
|
||||||
|
* Obtain the message
|
||||||
|
*
|
||||||
* @return The message
|
* @return The message
|
||||||
* @see Utils#stripHTML
|
* @see Utils#stripHTML
|
||||||
*/
|
*/
|
||||||
public String getMsg()
|
public String getMsg() {
|
||||||
{
|
return (msg);
|
||||||
return(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Is this response an automatically generated response?
|
/**
|
||||||
|
* Is this response an automatically generated response?
|
||||||
|
*
|
||||||
* @return true if this is an automatically generated response
|
* @return true if this is an automatically generated response
|
||||||
*/
|
*/
|
||||||
public boolean getAutoResponse()
|
public boolean getAutoResponse() {
|
||||||
{
|
return (autoResponse);
|
||||||
return(autoResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse an incoming IM response string
|
/**
|
||||||
|
* Parse an incoming IM response string
|
||||||
|
*
|
||||||
* @param str The string to be parsed
|
* @param str The string to be parsed
|
||||||
*/
|
*/
|
||||||
public TocResponse parseString(java.lang.String str) {
|
public TocResponse parseString(java.lang.String str) {
|
||||||
IMTocResponse tr=new IMTocResponse();
|
IMTocResponse tr = new IMTocResponse();
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
cmd = str;
|
||||||
cmd=str;
|
int colonPos = str.indexOf(':');
|
||||||
int colonPos=str.indexOf(':');
|
if (colonPos != -1) {
|
||||||
if (colonPos!=-1)
|
str = str.substring(colonPos + 1);
|
||||||
{
|
colonPos = str.indexOf(':');
|
||||||
str=str.substring(colonPos+1);
|
if (colonPos != -1) {
|
||||||
colonPos=str.indexOf(':');
|
from = str.substring(0, colonPos);
|
||||||
if (colonPos != -1)
|
str = str.substring(colonPos + 1);
|
||||||
{
|
colonPos = str.indexOf(':');
|
||||||
from=str.substring(0,colonPos);
|
if (str.charAt(0) == 'T') {
|
||||||
str=str.substring(colonPos+1);
|
autoResponse = true;
|
||||||
colonPos=str.indexOf(':');
|
|
||||||
if (str.charAt(0) == 'T')
|
|
||||||
{
|
|
||||||
autoResponse=true;
|
|
||||||
}
|
}
|
||||||
if (colonPos != -1)
|
if (colonPos != -1) {
|
||||||
{
|
msg = str.substring(colonPos + 1);
|
||||||
msg=str.substring(colonPos+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Obtain the response type for response dispatching purposes
|
/**
|
||||||
|
* Obtain the response type for response dispatching purposes
|
||||||
|
*
|
||||||
* @return The response type
|
* @return The response type
|
||||||
*/
|
*/
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
return(RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,24 +19,27 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/** The JaimEvent object is delivered to all registered {@link JaimEventListener}
|
/**
|
||||||
* @see JaimConnection#addEventListener
|
* The JaimEvent object is delivered to all registered {@link JaimEventListener}
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $revision: $
|
* @version $revision: $
|
||||||
|
* @see JaimConnection#addEventListener
|
||||||
*/
|
*/
|
||||||
public class JaimEvent extends java.util.EventObject {
|
public class JaimEvent extends java.util.EventObject {
|
||||||
|
|
||||||
private TocResponse tocResponse;
|
private final TocResponse tocResponse;
|
||||||
|
|
||||||
/** Creates new JaimEvent */
|
/**
|
||||||
|
* Creates new JaimEvent
|
||||||
|
*/
|
||||||
public JaimEvent(Object source, TocResponse tocResponse) {
|
public JaimEvent(Object source, TocResponse tocResponse) {
|
||||||
super(source);
|
super(source);
|
||||||
this.tocResponse=tocResponse;
|
this.tocResponse = tocResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TocResponse getTocResponse()
|
public TocResponse getTocResponse() {
|
||||||
{
|
return (tocResponse);
|
||||||
return(tocResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,16 +25,20 @@
|
||||||
|
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/** A JaimEventListener receives JaimEvents from the JaimConnection class.
|
/**
|
||||||
|
* A JaimEventListener receives JaimEvents from the JaimConnection class.
|
||||||
* A {@link JaimEvent} contains a {@link TocResponse} object.
|
* A {@link JaimEvent} contains a {@link TocResponse} object.
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public interface JaimEventListener {
|
public interface JaimEventListener {
|
||||||
|
|
||||||
/** Receive an incoming {@link JaimEvent}
|
/**
|
||||||
*@param ev - The incoming event
|
* Receive an incoming {@link JaimEvent}
|
||||||
|
*
|
||||||
|
* @param ev - The incoming event
|
||||||
*/
|
*/
|
||||||
public void receiveEvent(JaimEvent ev);
|
void receiveEvent(JaimEvent ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +40,7 @@ public class JaimException extends java.lang.Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>JaimException</code> with the specified detail message.
|
* Constructs an <code>JaimException</code> with the specified detail message.
|
||||||
|
*
|
||||||
* @param msg the detail message.
|
* @param msg the detail message.
|
||||||
*/
|
*/
|
||||||
public JaimException(String msg) {
|
public JaimException(String msg) {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $version: $
|
* @version $version: $
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +33,7 @@ public class JaimStateException extends JaimException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>JaimStateException</code> with the specified detail message.
|
* Constructs an <code>JaimStateException</code> with the specified detail message.
|
||||||
|
*
|
||||||
* @param msg the detail message.
|
* @param msg the detail message.
|
||||||
*/
|
*/
|
||||||
public JaimStateException(String msg) {
|
public JaimStateException(String msg) {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $version: $
|
* @version $version: $
|
||||||
*/
|
*/
|
||||||
|
@ -35,6 +34,7 @@ public class JaimTimeoutException extends JaimException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>JaimTimeoutException</code> with the specified detail message.
|
* Constructs an <code>JaimTimeoutException</code> with the specified detail message.
|
||||||
|
*
|
||||||
* @param msg the detail message.
|
* @param msg the detail message.
|
||||||
*/
|
*/
|
||||||
public JaimTimeoutException(String msg) {
|
public JaimTimeoutException(String msg) {
|
||||||
|
|
|
@ -27,14 +27,17 @@ package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that login processing has been completed successfully.
|
* This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that login processing has been completed successfully.
|
||||||
|
*
|
||||||
* @author wilko
|
* @author wilko
|
||||||
* @version: $revision: $
|
* @version: $revision: $
|
||||||
*/
|
*/
|
||||||
public class LoginCompleteTocResponse extends TocResponse {
|
public class LoginCompleteTocResponse extends TocResponse {
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="LOGINCOMPLETE";
|
public static final String RESPONSE_TYPE = "LOGINCOMPLETE";
|
||||||
|
|
||||||
/** Creates a new instance of LoginCompleteTocResponse */
|
/**
|
||||||
|
* Creates a new instance of LoginCompleteTocResponse
|
||||||
|
*/
|
||||||
public LoginCompleteTocResponse() {
|
public LoginCompleteTocResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +45,7 @@ public class LoginCompleteTocResponse extends TocResponse {
|
||||||
return (RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return (RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,44 +26,43 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The NicTocResponse is used internally to manage the TOC signon process. It is not delivered to clients of {@link JaimConnection}
|
* The NicTocResponse is used internally to manage the TOC signon process. It is not delivered to clients of {@link JaimConnection}
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
public class NickTocResponse extends TocResponse implements TocResponseHandler {
|
public class NickTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static final String RESPONSE_TYPE = "NICK";
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="NICK";
|
|
||||||
|
|
||||||
|
/**
|
||||||
/** Creates new NickTocResponse */
|
* Creates new NickTocResponse
|
||||||
|
*/
|
||||||
public NickTocResponse() {
|
public NickTocResponse() {
|
||||||
nickName="";
|
nickName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public TocResponse parseString(java.lang.String str) {
|
public TocResponse parseString(java.lang.String str) {
|
||||||
NickTocResponse tr=new NickTocResponse();
|
NickTocResponse tr = new NickTocResponse();
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
int colonPos = str.indexOf(':');
|
||||||
int colonPos=str.indexOf(':');
|
|
||||||
|
|
||||||
if (colonPos != -1)
|
if (colonPos != -1) {
|
||||||
{
|
nickName = str.substring(colonPos + 1);
|
||||||
nickName=str.substring(colonPos+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNickName()
|
public String getNickName() {
|
||||||
{
|
return (nickName);
|
||||||
return(nickName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,12 +70,14 @@ public class NickTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
return RESPONSE_TYPE;
|
return RESPONSE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,54 +27,54 @@ package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The SignOnTocResponse is used internally to manage the TOC signon process. It is not delivered to clients of {@link JaimConnection}
|
* The SignOnTocResponse is used internally to manage the TOC signon process. It is not delivered to clients of {@link JaimConnection}
|
||||||
|
*
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.5 $
|
||||||
*/
|
*/
|
||||||
public class SignOnTocResponse extends TocResponse implements TocResponseHandler {
|
public class SignOnTocResponse extends TocResponse implements TocResponseHandler {
|
||||||
|
|
||||||
|
public static final String RESPONSE_TYPE = "SIGN_ON";
|
||||||
String version;
|
String version;
|
||||||
|
|
||||||
public static final String RESPONSE_TYPE="SIGN_ON";
|
|
||||||
|
|
||||||
|
/**
|
||||||
/** Creates new SignOnTocResponse */
|
* Creates new SignOnTocResponse
|
||||||
|
*/
|
||||||
public SignOnTocResponse() {
|
public SignOnTocResponse() {
|
||||||
version="";
|
version = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResponseType() {
|
public String getResponseType() {
|
||||||
return(RESPONSE_TYPE);
|
return (RESPONSE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getVersion()
|
protected String getVersion() {
|
||||||
{
|
return (version);
|
||||||
return(version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public TocResponse parseString(String str)
|
public TocResponse parseString(String str) {
|
||||||
{
|
SignOnTocResponse tr = new SignOnTocResponse();
|
||||||
SignOnTocResponse tr=new SignOnTocResponse();
|
|
||||||
tr.doParse(str);
|
tr.doParse(str);
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doParse(String str)
|
private void doParse(String str) {
|
||||||
{
|
cmd = str;
|
||||||
cmd=str;
|
int colonpos = str.indexOf(':');
|
||||||
int colonpos=str.indexOf(':');
|
if (colonpos != -1) {
|
||||||
if (colonpos != -1)
|
version = str.substring(colonpos + 1);
|
||||||
{
|
|
||||||
version=str.substring(colonpos+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
|
* Returns true if this response handler can handle the specified response.
|
||||||
|
*
|
||||||
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
* @return true if the response can be handled
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
public boolean canHandle(String Response) {
|
public boolean canHandle(String Response) {
|
||||||
return(Response.equalsIgnoreCase(RESPONSE_TYPE));
|
return (Response.equalsIgnoreCase(RESPONSE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,40 +28,38 @@ package com.wilko.jaim;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class TocAddBuddyCommand extends TocCommand {
|
public class TocAddBuddyCommand extends TocCommand {
|
||||||
|
|
||||||
private static String CMD="toc_add_buddy";
|
private static final String CMD = "toc_add_buddy";
|
||||||
|
|
||||||
Vector buddyList;
|
Vector buddyList;
|
||||||
|
|
||||||
/** Creates new TocAddBuddyCommand */
|
/**
|
||||||
|
* Creates new TocAddBuddyCommand
|
||||||
|
*/
|
||||||
public TocAddBuddyCommand() {
|
public TocAddBuddyCommand() {
|
||||||
buddyList=new Vector();
|
buddyList = new Vector();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBuddy(String buddy)
|
public void addBuddy(String buddy) {
|
||||||
{
|
|
||||||
buddyList.add(Utils.normalise(buddy));
|
buddyList.add(Utils.normalise(buddy));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
StringBuffer output = new StringBuffer(CMD);
|
||||||
StringBuffer output=new StringBuffer(CMD);
|
for (int i = 0; i < buddyList.size(); i++) {
|
||||||
for (int i=0;i<buddyList.size();i++)
|
|
||||||
{
|
|
||||||
output.append(' ');
|
output.append(' ');
|
||||||
output.append((String)buddyList.elementAt(i));
|
output.append((String) buddyList.elementAt(i));
|
||||||
}
|
}
|
||||||
return(output.toString());
|
return (output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,40 +28,38 @@ package com.wilko.jaim;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class TocAddDenyCommand extends TocCommand {
|
public class TocAddDenyCommand extends TocCommand {
|
||||||
|
|
||||||
private static String CMD="toc_add_deny";
|
private static final String CMD = "toc_add_deny";
|
||||||
|
|
||||||
Vector buddyList;
|
Vector buddyList;
|
||||||
|
|
||||||
/** Creates new TocAddBuddyCommand */
|
/**
|
||||||
|
* Creates new TocAddBuddyCommand
|
||||||
|
*/
|
||||||
public TocAddDenyCommand() {
|
public TocAddDenyCommand() {
|
||||||
buddyList=new Vector();
|
buddyList = new Vector();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDeny(String buddy)
|
public void addDeny(String buddy) {
|
||||||
{
|
|
||||||
buddyList.add(Utils.normalise(buddy));
|
buddyList.add(Utils.normalise(buddy));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
StringBuffer output = new StringBuffer(CMD);
|
||||||
StringBuffer output=new StringBuffer(CMD);
|
for (int i = 0; i < buddyList.size(); i++) {
|
||||||
for (int i=0;i<buddyList.size();i++)
|
|
||||||
{
|
|
||||||
output.append(' ');
|
output.append(' ');
|
||||||
output.append((String)buddyList.elementAt(i));
|
output.append((String) buddyList.elementAt(i));
|
||||||
}
|
}
|
||||||
return(output.toString());
|
return (output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,40 +28,38 @@ package com.wilko.jaim;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.1 $
|
||||||
*/
|
*/
|
||||||
public class TocAddPermitCommand extends TocCommand {
|
public class TocAddPermitCommand extends TocCommand {
|
||||||
|
|
||||||
private static String CMD="toc_add_permit";
|
private static final String CMD = "toc_add_permit";
|
||||||
|
|
||||||
Vector buddyList;
|
Vector buddyList;
|
||||||
|
|
||||||
/** Creates new TocAddBuddyCommand */
|
/**
|
||||||
|
* Creates new TocAddBuddyCommand
|
||||||
|
*/
|
||||||
public TocAddPermitCommand() {
|
public TocAddPermitCommand() {
|
||||||
buddyList=new Vector();
|
buddyList = new Vector();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPermit(String buddy)
|
public void addPermit(String buddy) {
|
||||||
{
|
|
||||||
buddyList.add(Utils.normalise(buddy));
|
buddyList.add(Utils.normalise(buddy));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
StringBuffer output = new StringBuffer(CMD);
|
||||||
StringBuffer output=new StringBuffer(CMD);
|
for (int i = 0; i < buddyList.size(); i++) {
|
||||||
for (int i=0;i<buddyList.size();i++)
|
|
||||||
{
|
|
||||||
output.append(' ');
|
output.append(' ');
|
||||||
output.append((String)buddyList.elementAt(i));
|
output.append((String) buddyList.elementAt(i));
|
||||||
}
|
}
|
||||||
return(output.toString());
|
return (output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,28 +26,28 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
public class TocChatJoinCommand extends TocCommand {
|
public class TocChatJoinCommand extends TocCommand {
|
||||||
|
|
||||||
private int exchange;
|
private final int exchange;
|
||||||
private String roomName;
|
private final String roomName;
|
||||||
|
|
||||||
/** Creates new TocIMCommand */
|
/**
|
||||||
|
* Creates new TocIMCommand
|
||||||
|
*/
|
||||||
public TocChatJoinCommand(int exchange, String roomName) {
|
public TocChatJoinCommand(int exchange, String roomName) {
|
||||||
this.exchange=exchange;
|
this.exchange = exchange;
|
||||||
this.roomName=roomName;
|
this.roomName = roomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return ("toc_chat_join " + exchange + " " + roomName);
|
||||||
return ("toc_chat_join "+exchange+" "+roomName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(this.toString().getBytes());
|
return (this.toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,14 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public abstract class TocCommand {
|
public abstract class TocCommand {
|
||||||
|
|
||||||
/** Creates new TocCommand */
|
/**
|
||||||
|
* Creates new TocCommand
|
||||||
|
*/
|
||||||
public TocCommand() {
|
public TocCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,32 +26,30 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class TocEvilCommand extends TocCommand {
|
public class TocEvilCommand extends TocCommand {
|
||||||
|
|
||||||
private String buddy;
|
private final String buddy;
|
||||||
private boolean anonymous;
|
private final boolean anonymous;
|
||||||
|
|
||||||
/** Creates new TocEvilCommand */
|
/**
|
||||||
|
* Creates new TocEvilCommand
|
||||||
|
*/
|
||||||
public TocEvilCommand(String buddy, boolean anonymous) {
|
public TocEvilCommand(String buddy, boolean anonymous) {
|
||||||
this.buddy=Utils.normalise(buddy);
|
this.buddy = Utils.normalise(buddy);
|
||||||
this.anonymous=anonymous;
|
this.anonymous = anonymous;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
String ret = "toc_evil " + buddy;
|
||||||
String ret="toc_evil "+buddy;
|
if (anonymous) {
|
||||||
if (anonymous)
|
ret = ret + " anon";
|
||||||
{
|
} else
|
||||||
ret=ret+" anon";
|
ret = ret + " norm";
|
||||||
}
|
|
||||||
else
|
|
||||||
ret=ret+" norm";
|
|
||||||
|
|
||||||
return(ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
|
|
|
@ -39,32 +39,31 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $version: $
|
* @version $version: $
|
||||||
*/
|
*/
|
||||||
public class TocGetInfoCommand extends TocCommand {
|
public class TocGetInfoCommand extends TocCommand {
|
||||||
|
|
||||||
private String username;
|
private static final String CMD = "toc_get_info ";
|
||||||
|
private final String username;
|
||||||
|
|
||||||
private static String CMD="toc_get_info ";
|
/**
|
||||||
/** Creates new TocGetInfoCommand
|
* Creates new TocGetInfoCommand
|
||||||
*@param username The screen name for whom information is requested
|
|
||||||
*
|
*
|
||||||
|
* @param username The screen name for whom information is requested
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public TocGetInfoCommand(String username) {
|
public TocGetInfoCommand(String username) {
|
||||||
this.username=Utils.normalise(username);
|
this.username = Utils.normalise(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (CMD + username);
|
||||||
return(CMD+username);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,33 +26,33 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
public class TocIMCommand extends TocCommand {
|
public class TocIMCommand extends TocCommand {
|
||||||
|
|
||||||
private String recipient;
|
private final String recipient;
|
||||||
private String msg;
|
private final String msg;
|
||||||
private String auto;
|
private final String auto;
|
||||||
|
|
||||||
/** Creates new TocIMCommand */
|
/**
|
||||||
public TocIMCommand(String recipient, String msg,boolean autoMessage) {
|
* Creates new TocIMCommand
|
||||||
this.recipient=Utils.normalise(recipient);
|
*/
|
||||||
this.msg=Utils.encodeText(msg);
|
public TocIMCommand(String recipient, String msg, boolean autoMessage) {
|
||||||
|
this.recipient = Utils.normalise(recipient);
|
||||||
|
this.msg = Utils.encodeText(msg);
|
||||||
if (autoMessage)
|
if (autoMessage)
|
||||||
auto=" auto";
|
auto = " auto";
|
||||||
else
|
else
|
||||||
auto="";
|
auto = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return ("toc_send_im " + recipient + " " + msg + auto);
|
||||||
return ("toc_send_im "+recipient+" "+msg+auto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(this.toString().getBytes());
|
return (this.toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,25 +26,25 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
public class TocInitDoneCommand extends TocCommand {
|
public class TocInitDoneCommand extends TocCommand {
|
||||||
|
|
||||||
private static final String CMD="toc_init_done";
|
private static final String CMD = "toc_init_done";
|
||||||
|
|
||||||
/** Creates new TocInitDoneCommand */
|
/**
|
||||||
|
* Creates new TocInitDoneCommand
|
||||||
|
*/
|
||||||
public TocInitDoneCommand() {
|
public TocInitDoneCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(CMD.getBytes());
|
return (CMD.getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (CMD);
|
||||||
return(CMD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.5 $
|
||||||
*/
|
*/
|
||||||
|
@ -34,14 +33,12 @@ public abstract class TocResponse {
|
||||||
|
|
||||||
protected String cmd;
|
protected String cmd;
|
||||||
|
|
||||||
public TocResponse()
|
public TocResponse() {
|
||||||
{
|
cmd = "";
|
||||||
cmd="";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (cmd);
|
||||||
return(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getResponseType();
|
public abstract String getResponseType();
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.5 $
|
||||||
*/
|
*/
|
||||||
|
@ -37,46 +36,40 @@ public abstract class TocResponseFactory {
|
||||||
|
|
||||||
static Vector responseHandlers = new Vector();
|
static Vector responseHandlers = new Vector();
|
||||||
|
|
||||||
/** Creates new TocResponseFactory */
|
/**
|
||||||
|
* Creates new TocResponseFactory
|
||||||
|
*/
|
||||||
public TocResponseFactory() {
|
public TocResponseFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addResponseHandler(TocResponseHandler h)
|
public static void addResponseHandler(TocResponseHandler h) {
|
||||||
{
|
synchronized (responseHandlers) {
|
||||||
synchronized (responseHandlers)
|
|
||||||
{
|
|
||||||
responseHandlers.add(h);
|
responseHandlers.add(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static TocResponse createResponse(byte[] b)
|
static TocResponse createResponse(byte[] b) {
|
||||||
{
|
TocResponse tr = null;
|
||||||
TocResponse tr=null;
|
String strversion = new String(b);
|
||||||
String strversion=new String(b);
|
int colonpos = strversion.indexOf(':');
|
||||||
int colonpos=strversion.indexOf(':');
|
if (colonpos != -1) {
|
||||||
if (colonpos != -1)
|
String firstWord = strversion.substring(0, colonpos);
|
||||||
{
|
int i = 0;
|
||||||
String firstWord=strversion.substring(0,colonpos);
|
synchronized (responseHandlers) {
|
||||||
int i=0;
|
while ((i < responseHandlers.size()) && (tr == null)) {
|
||||||
synchronized (responseHandlers)
|
TocResponseHandler h = (TocResponseHandler) responseHandlers.elementAt(i);
|
||||||
{
|
if (h.canHandle(firstWord)) {
|
||||||
while ((i<responseHandlers.size())&&(tr==null))
|
tr = h.parseString(strversion);
|
||||||
{
|
|
||||||
TocResponseHandler h=(TocResponseHandler)responseHandlers.elementAt(i);
|
|
||||||
if (h.canHandle(firstWord))
|
|
||||||
{
|
|
||||||
tr=h.parseString(strversion);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tr==null)
|
if (tr == null) {
|
||||||
{
|
GenericTocResponse gtr = new GenericTocResponse();
|
||||||
GenericTocResponse gtr=new GenericTocResponse();
|
tr = gtr.parseString(strversion);
|
||||||
tr=gtr.parseString(strversion);
|
|
||||||
}
|
}
|
||||||
return(tr);
|
return (tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,25 +20,28 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $revision: $
|
* @version $revision: $
|
||||||
*/
|
*/
|
||||||
public interface TocResponseHandler {
|
public interface TocResponseHandler {
|
||||||
|
|
||||||
/** Returns true if this response handler can handle the specified response.
|
/**
|
||||||
*@param Response - the response string from TOC. This is the part of the response before the first ':'
|
* Returns true if this response handler can handle the specified response.
|
||||||
*@return true if the response can be handled
|
*
|
||||||
|
* @param Response - the response string from TOC. This is the part of the response before the first ':'
|
||||||
|
* @return true if the response can be handled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean canHandle(String Response);
|
boolean canHandle(String Response);
|
||||||
|
|
||||||
/** Parse the provided response
|
/**
|
||||||
*@param Response - the response from the TOC server. This is the full TOC response string
|
* Parse the provided response
|
||||||
*@return - A TocResponse object that represents this response
|
*
|
||||||
|
* @param Response - the response from the TOC server. This is the full TOC response string
|
||||||
|
* @return - A TocResponse object that represents this response
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public TocResponse parseString(String Response);
|
TocResponse parseString(String Response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,31 +26,31 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $version: $
|
* @version $version: $
|
||||||
*/
|
*/
|
||||||
public class TocSetAwayCommand extends TocCommand {
|
public class TocSetAwayCommand extends TocCommand {
|
||||||
|
|
||||||
private String awayMsg;
|
private static final String CMD = "toc_set_away ";
|
||||||
|
private final String awayMsg;
|
||||||
|
|
||||||
private static String CMD="toc_set_away ";
|
/**
|
||||||
/** Creates new TocSetInfoCommand
|
* Creates new TocSetInfoCommand
|
||||||
|
*
|
||||||
* @param awayMsg The away message for this user. May contain HTML. To cancel "away" status set the awayMsg to ""
|
* @param awayMsg The away message for this user. May contain HTML. To cancel "away" status set the awayMsg to ""
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public TocSetAwayCommand(String awayMsg) {
|
public TocSetAwayCommand(String awayMsg) {
|
||||||
this.awayMsg=Utils.encodeText(awayMsg);
|
this.awayMsg = Utils.encodeText(awayMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (CMD + awayMsg);
|
||||||
return(CMD+awayMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,47 +28,42 @@ package com.wilko.jaim;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
*/
|
*/
|
||||||
public class TocSetConfigCommand extends TocCommand {
|
public class TocSetConfigCommand extends TocCommand {
|
||||||
|
|
||||||
private StringBuffer config;
|
private static final String CMD = "toc_set_config ";
|
||||||
|
private final StringBuffer config;
|
||||||
|
|
||||||
private static String CMD="toc_set_config ";
|
/**
|
||||||
|
* Creates a new instance of TocSetConfigCommand
|
||||||
/** Creates a new instance of TocSetConfigCommand */
|
*/
|
||||||
public TocSetConfigCommand() {
|
public TocSetConfigCommand() {
|
||||||
config=new StringBuffer();
|
config = new StringBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGroup(Group g)
|
public void addGroup(Group g) {
|
||||||
{
|
config.append("g " + g.getName() + "\n");
|
||||||
config.append("g "+g.getName()+"\n");
|
Enumeration buddies = g.enumerateBuddies();
|
||||||
Enumeration buddies=g.enumerateBuddies();
|
while (buddies.hasMoreElements()) {
|
||||||
while (buddies.hasMoreElements())
|
Buddy b = (Buddy) buddies.nextElement();
|
||||||
{
|
config.append("b " + b.getName() + "\n");
|
||||||
Buddy b = (Buddy)buddies.nextElement();
|
if (b.getPermit()) {
|
||||||
config.append("b "+b.getName()+"\n");
|
config.append("p " + b.getName() + "\n");
|
||||||
if (b.getPermit())
|
|
||||||
{
|
|
||||||
config.append("p "+b.getName()+"\n");
|
|
||||||
}
|
}
|
||||||
if (b.getDeny())
|
if (b.getDeny()) {
|
||||||
{
|
config.append("d " + b.getName() + "\n");
|
||||||
config.append("d "+b.getName()+"\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (CMD + '"' + config.toString() + '"');
|
||||||
return(CMD+'"'+config.toString()+'"');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,29 +25,29 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $version: $
|
* @version $version: $
|
||||||
*/
|
*/
|
||||||
public class TocSetIdleCommand extends TocCommand {
|
public class TocSetIdleCommand extends TocCommand {
|
||||||
|
|
||||||
private int idle;
|
private static final String CMD = "toc_set_idle ";
|
||||||
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
|
* Creates new TocSetIdleCommand
|
||||||
|
*
|
||||||
|
* @param idleSecs - the period for which the user has been idle
|
||||||
*/
|
*/
|
||||||
public TocSetIdleCommand(int idleSecs) {
|
public TocSetIdleCommand(int idleSecs) {
|
||||||
idle=idleSecs;
|
idle = idleSecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (CMD + idle);
|
||||||
return(CMD+idle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,31 +26,31 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $version: $
|
* @version $version: $
|
||||||
*/
|
*/
|
||||||
public class TocSetInfoCommand extends TocCommand {
|
public class TocSetInfoCommand extends TocCommand {
|
||||||
|
|
||||||
private String information;
|
private static final String CMD = "toc_set_info ";
|
||||||
|
private final String information;
|
||||||
|
|
||||||
private static String CMD="toc_set_info ";
|
/**
|
||||||
/** Creates new TocSetInfoCommand
|
* Creates new TocSetInfoCommand
|
||||||
*@param information The information about this user can be located. May contain HTML
|
*
|
||||||
|
* @param information The information about this user can be located. May contain HTML
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public TocSetInfoCommand(String information) {
|
public TocSetInfoCommand(String information) {
|
||||||
this.information=Utils.encodeText(information);
|
this.information = Utils.encodeText(information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return (CMD + information);
|
||||||
return(CMD+information);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return(toString().getBytes());
|
return (toString().getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,35 +26,34 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
public class TocSignonCommand extends TocCommand {
|
public class TocSignonCommand extends TocCommand {
|
||||||
|
|
||||||
private String server;
|
private static final String AGENTNAME = "jaim01";
|
||||||
private String username;
|
private final String server;
|
||||||
private String password;
|
private final String username;
|
||||||
private int port;
|
private final String password;
|
||||||
|
private final int port;
|
||||||
|
|
||||||
private static final String AGENTNAME="jaim01";
|
/**
|
||||||
|
* Creates new TocSignonCommand
|
||||||
/** Creates new TocSignonCommand */
|
*/
|
||||||
public TocSignonCommand(String server, int port, String username, String password) {
|
public TocSignonCommand(String server, int port, String username, String password) {
|
||||||
this.server=server;
|
this.server = server;
|
||||||
this.port=port;
|
this.port = port;
|
||||||
this.username=Utils.normalise(username);
|
this.username = Utils.normalise(username);
|
||||||
this.password=Utils.roast(password);
|
this.password = Utils.roast(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return toString().getBytes();
|
return toString().getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
String temp = "toc_signon login.oscar.aol.com 5159 " + username + " " + password + " english " + AGENTNAME;
|
||||||
String temp="toc_signon login.oscar.aol.com 5159 "+username+" "+password+" english "+AGENTNAME;
|
return (temp);
|
||||||
return(temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseString(java.lang.String str) {
|
public void parseString(java.lang.String str) {
|
||||||
|
|
|
@ -26,100 +26,92 @@
|
||||||
package com.wilko.jaim;
|
package com.wilko.jaim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author paulw
|
* @author paulw
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
private static final String roastKey="Tic/Toc";
|
private static final String roastKey = "Tic/Toc";
|
||||||
private static final int roastLen=7;
|
private static final int roastLen = 7;
|
||||||
|
|
||||||
/** convert a buddy name to normalised format - remove spaces and convert to lower case
|
/**
|
||||||
|
* convert a buddy name to normalised format - remove spaces and convert to lower case
|
||||||
|
*
|
||||||
* @param input The un-normalised buddy name
|
* @param input The un-normalised buddy name
|
||||||
* @return the normalised buddy name
|
* @return the normalised buddy name
|
||||||
*/
|
*/
|
||||||
public static String normalise(java.lang.String input) {
|
public static String normalise(java.lang.String input) {
|
||||||
StringBuffer output=new StringBuffer();
|
StringBuffer output = new StringBuffer();
|
||||||
String temp=input.toLowerCase();
|
String temp = input.toLowerCase();
|
||||||
for (int i=0;i<input.length();i++)
|
for (int i = 0; i < input.length(); i++) {
|
||||||
{
|
char c = temp.charAt(i);
|
||||||
char c=temp.charAt(i);
|
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) {
|
||||||
if ((c>= '0' && c<='9')||(c>='a' && c<='z'))
|
|
||||||
{
|
|
||||||
output.append(c);
|
output.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(output.toString());
|
return (output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Roast a password using the AOL roasting protocol
|
/**
|
||||||
|
* Roast a password using the AOL roasting protocol
|
||||||
|
*
|
||||||
* @param password The password to be roasted
|
* @param password The password to be roasted
|
||||||
* @return The roasted password
|
* @return The roasted password
|
||||||
*/
|
*/
|
||||||
public static String roast(java.lang.String password) {
|
public static String roast(java.lang.String password) {
|
||||||
char[] hexChars={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||||
|
|
||||||
StringBuffer temppw=new StringBuffer();
|
StringBuffer temppw = new StringBuffer();
|
||||||
temppw.append("0x");
|
temppw.append("0x");
|
||||||
for (int i=0;i<password.length();i++)
|
for (int i = 0; i < password.length(); i++) {
|
||||||
{
|
int roastedByte = password.charAt(i) ^ roastKey.charAt(i % roastLen);
|
||||||
int roastedByte=password.charAt(i)^roastKey.charAt(i%roastLen);
|
|
||||||
|
|
||||||
temppw.append(hexChars[(roastedByte>>4)&0x0f]);
|
temppw.append(hexChars[(roastedByte >> 4) & 0x0f]);
|
||||||
temppw.append(hexChars[roastedByte&0x0f]);
|
temppw.append(hexChars[roastedByte & 0x0f]);
|
||||||
}
|
}
|
||||||
return(temppw.toString());
|
return (temppw.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method performs a simple HTML strip on text. It looks for < characters and then skips input until a matching > is found.
|
/**
|
||||||
|
* This method performs a simple HTML strip on text. It looks for < characters and then skips input until a matching > is found.
|
||||||
* This may fail if the HTML tag contains an embedded '>'
|
* This may fail if the HTML tag contains an embedded '>'
|
||||||
|
*
|
||||||
* @param input The text to have HTML stripped
|
* @param input The text to have HTML stripped
|
||||||
* @return The text stripped of html
|
* @return The text stripped of html
|
||||||
*/
|
*/
|
||||||
public static String stripHTML(java.lang.String input)
|
public static String stripHTML(java.lang.String input) {
|
||||||
{
|
StringBuffer output = new StringBuffer();
|
||||||
StringBuffer output=new StringBuffer();
|
boolean inHTML = false;
|
||||||
boolean inHTML=false;
|
for (int i = 0; i < input.length(); i++) {
|
||||||
for (int i=0;i<input.length();i++)
|
char c = input.charAt(i);
|
||||||
{
|
if (c == '<') {
|
||||||
char c=input.charAt(i);
|
inHTML = true;
|
||||||
if (c=='<')
|
} else {
|
||||||
{
|
if (c == '>') {
|
||||||
inHTML=true;
|
inHTML = false;
|
||||||
}
|
} else {
|
||||||
else
|
if (!inHTML) {
|
||||||
{
|
|
||||||
if (c=='>') {
|
|
||||||
inHTML=false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!inHTML)
|
|
||||||
{
|
|
||||||
output.append(c);
|
output.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(output.toString());
|
return (output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Encode a text message so that it is suitable for transmission using toc_send_im
|
/**
|
||||||
|
* Encode a text message so that it is suitable for transmission using toc_send_im
|
||||||
*
|
*
|
||||||
* @param input The text to be encoded
|
* @param input The text to be encoded
|
||||||
* @return The encoded text
|
* @return The encoded text
|
||||||
*/
|
*/
|
||||||
public static String encodeText(String input)
|
public static String encodeText(String input) {
|
||||||
{
|
StringBuffer output = new StringBuffer("\"");
|
||||||
StringBuffer output=new StringBuffer("\"");
|
for (int i = 0; i < input.length(); i++) {
|
||||||
for (int i=0;i<input.length();i++)
|
char c = input.charAt(i);
|
||||||
{
|
switch (c) {
|
||||||
char c=input.charAt(i);
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case '\"':
|
case '\"':
|
||||||
case '(':
|
case '(':
|
||||||
case ')':
|
case ')':
|
||||||
|
@ -136,7 +128,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
output.append('\"');
|
output.append('\"');
|
||||||
return(output.toString());
|
return (output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,13 @@
|
||||||
|
|
||||||
package com.wilko.jaimtest;
|
package com.wilko.jaimtest;
|
||||||
|
|
||||||
import java.net.*;
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
import com.wilko.jaim.*;
|
import com.wilko.jaim.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author paulw
|
* @author paulw
|
||||||
|
|
Loading…
Reference in a new issue