aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2007-04-17 10:17:04 +0000
committerDamian Minkov <damencho@jitsi.org>2007-04-17 10:17:04 +0000
commitc2d09bdf4dd69d7195c9466fcf16c8f11c725de3 (patch)
tree9516b08828d4c9d70d5133c23b82da939845c680
parenta4521a845cdbf15394e9c06b9b4421db3b47991e (diff)
downloadjitsi-c2d09bdf4dd69d7195c9466fcf16c8f11c725de3.zip
jitsi-c2d09bdf4dd69d7195c9466fcf16c8f11c725de3.tar.gz
jitsi-c2d09bdf4dd69d7195c9466fcf16c8f11c725de3.tar.bz2
Added AIM icons
-rw-r--r--build.xml2
-rw-r--r--resources/images/aim/aim16x16-away.pngbin0 -> 531 bytes
-rw-r--r--resources/images/aim/aim16x16-invisible.pngbin0 -> 604 bytes
-rw-r--r--resources/images/aim/aim16x16-offline.pngbin0 -> 621 bytes
-rw-r--r--resources/images/aim/cr16-action-aim_connecting.gifbin0 -> 2248 bytes
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java14
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java218
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/ProtocolIconAimImpl.java93
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java15
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/service/protocol/aimconstants/AimStatusEnum.java99
-rw-r--r--src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf1
-rw-r--r--test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf1
14 files changed, 359 insertions, 86 deletions
diff --git a/build.xml b/build.xml
index 01886df..03ebf24 100644
--- a/build.xml
+++ b/build.xml
@@ -1151,6 +1151,8 @@ javax.swing.event, javax.swing.border"/>
<zipfileset src="${lib.noinst}/jsocks-klea.jar" prefix=""/>
<zipfileset dir="resources/images/icq"
prefix="resources/images/icq"/>
+ <zipfileset dir="resources/images/aim"
+ prefix="resources/images/aim"/>
</jar>
</target>
diff --git a/resources/images/aim/aim16x16-away.png b/resources/images/aim/aim16x16-away.png
new file mode 100644
index 0000000..91629de
--- /dev/null
+++ b/resources/images/aim/aim16x16-away.png
Binary files differ
diff --git a/resources/images/aim/aim16x16-invisible.png b/resources/images/aim/aim16x16-invisible.png
new file mode 100644
index 0000000..aa5a20d
--- /dev/null
+++ b/resources/images/aim/aim16x16-invisible.png
Binary files differ
diff --git a/resources/images/aim/aim16x16-offline.png b/resources/images/aim/aim16x16-offline.png
new file mode 100644
index 0000000..053c3b8
--- /dev/null
+++ b/resources/images/aim/aim16x16-offline.png
Binary files differ
diff --git a/resources/images/aim/cr16-action-aim_connecting.gif b/resources/images/aim/cr16-action-aim_connecting.gif
new file mode 100644
index 0000000..ceda8af
--- /dev/null
+++ b/resources/images/aim/cr16-action-aim_connecting.gif
Binary files differ
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
index 07a0a0e..9a17a25 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
@@ -20,7 +20,7 @@ import net.kano.joscar.snaccmd.icq.*;
import net.kano.joustsim.*;
import net.kano.joustsim.oscar.oscar.service.icbm.*;
import net.java.sip.communicator.service.protocol.icqconstants.*;
-
+import net.java.sip.communicator.service.protocol.aimconstants.*;
/**
* A straightforward implementation of the basic instant messaging operation
@@ -729,9 +729,15 @@ public class OperationSetBasicInstantMessagingIcqImpl
, RegistrationStateChangeEvent.REASON_INTERNAL_ERROR
, "Did not receive last keep alive packet.");
- opSetPersPresence.fireProviderPresenceStatusChangeEvent(
- opSetPersPresence.getPresenceStatus().getStatus()
- , IcqStatusEnum.OFFLINE.getStatus());
+ if(icqProvider.USING_ICQ)
+ opSetPersPresence.fireProviderPresenceStatusChangeEvent(
+ opSetPersPresence.getPresenceStatus().getStatus()
+ , IcqStatusEnum.OFFLINE.getStatus());
+ else
+ opSetPersPresence.fireProviderPresenceStatusChangeEvent(
+ opSetPersPresence.getPresenceStatus().getStatus()
+ , AimStatusEnum.OFFLINE.getStatus());
+
}
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
index e413448..ad4593a 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
@@ -12,6 +12,7 @@ import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.icqconstants.*;
+import net.java.sip.communicator.service.protocol.aimconstants.*;
import net.java.sip.communicator.service.protocol.AuthorizationResponse.*;
import net.java.sip.communicator.util.*;
import net.kano.joscar.*;
@@ -173,6 +174,18 @@ public class OperationSetPersistentPresenceIcqImpl
}
+ private static Map scToAimStatusMappings = new Hashtable();
+ static{
+
+ scToAimStatusMappings.put(AimStatusEnum.AWAY,
+ new Long(FullUserInfo.ICQSTATUS_AWAY));
+ scToAimStatusMappings.put(AimStatusEnum.INVISIBLE,
+ new Long(FullUserInfo.ICQSTATUS_INVISIBLE));
+ scToAimStatusMappings.put(AimStatusEnum.ONLINE,
+ new Long(ICQ_ONLINE_MASK));
+
+ }
+
/**
* The server stored contact list that will be encapsulating joustsim's
* buddy list.
@@ -306,7 +319,7 @@ public class OperationSetPersistentPresenceIcqImpl
}
}
- return icqStatusLongToPresenceStatus(responseRetriever.status);
+ return statusLongToPresenceStatus(responseRetriever.status);
}
/**
@@ -318,54 +331,74 @@ public class OperationSetPersistentPresenceIcqImpl
* @return a PresenceStatus instance representation of the "long" icqStatus
* parameter. The returned result is one of the IcqStatusEnum fields.
*/
- private IcqStatusEnum icqStatusLongToPresenceStatus(long icqStatus)
+ private PresenceStatus statusLongToPresenceStatus(long icqStatus)
{
- // Fixed order of status checking
- // The order does matter, as the icqStatus consists of more than one
- // status for example DND = OCCUPIED | DND | AWAY
- if(icqStatus == -1)
- {
- return IcqStatusEnum.OFFLINE;
- }
- else if ( (icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE ) != 0)
- {
- return IcqStatusEnum.INVISIBLE;
- }
- else if ( (icqStatus & FullUserInfo.ICQSTATUS_DND ) != 0)
- {
- return IcqStatusEnum.DO_NOT_DISTURB;
- }
- else if ( (icqStatus & FullUserInfo.ICQSTATUS_OCCUPIED ) != 0)
- {
- return IcqStatusEnum.OCCUPIED;
- }
- else if ( (icqStatus & FullUserInfo.ICQSTATUS_NA ) != 0)
+ if(icqProvider.USING_ICQ)
{
- return IcqStatusEnum.NOT_AVAILABLE;
- }
- else if ( (icqStatus & FullUserInfo.ICQSTATUS_AWAY ) != 0)
- {
- return IcqStatusEnum.AWAY;
- }
- else if ( (icqStatus & FullUserInfo.ICQSTATUS_FFC ) != 0)
- {
- return IcqStatusEnum.FREE_FOR_CHAT;
- }
+ // Fixed order of status checking
+ // The order does matter, as the icqStatus consists of more than one
+ // status for example DND = OCCUPIED | DND | AWAY
+ if(icqStatus == -1)
+ {
+ return IcqStatusEnum.OFFLINE;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE ) != 0)
+ {
+ return IcqStatusEnum.INVISIBLE;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_DND ) != 0)
+ {
+ return IcqStatusEnum.DO_NOT_DISTURB;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_OCCUPIED ) != 0)
+ {
+ return IcqStatusEnum.OCCUPIED;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_NA ) != 0)
+ {
+ return IcqStatusEnum.NOT_AVAILABLE;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_AWAY ) != 0)
+ {
+ return IcqStatusEnum.AWAY;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_FFC ) != 0)
+ {
+ return IcqStatusEnum.FREE_FOR_CHAT;
+ }
+
+ // FIXED: Issue 70
+ // Incomplete status information in ICQ
- // FIXED: Issue 70
- // Incomplete status information in ICQ
+ // if none of the statuses is satisfied
+ // then the default is Online
+ // there is no such status send from the server as Offline
+ // when received error from server, after a query
+ // the status is -1 so Offline
+// else if ((icqStatus & ICQ_ONLINE_MASK) == 0 )
+// {
+// return IcqStatusEnum.OFFLINE;
+// }
- // if none of the statuses is satisfied
- // then the default is Online
- // there is no such status send from the server as Offline
- // when received error from server, after a query
- // the status is -1 so Offline
-// else if ((icqStatus & ICQ_ONLINE_MASK) == 0 )
-// {
-// return IcqStatusEnum.OFFLINE;
-// }
+ return IcqStatusEnum.ONLINE;
+ }
+ else
+ {
+ if(icqStatus == -1)
+ {
+ return AimStatusEnum.OFFLINE;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE ) != 0)
+ {
+ return AimStatusEnum.INVISIBLE;
+ }
+ else if ( (icqStatus & FullUserInfo.ICQSTATUS_AWAY ) != 0)
+ {
+ return AimStatusEnum.AWAY;
+ }
- return IcqStatusEnum.ONLINE;
+ return AimStatusEnum.ONLINE;
+ }
}
/**
@@ -377,9 +410,12 @@ public class OperationSetPersistentPresenceIcqImpl
* @return a PresenceStatus instance representation of the "long" icqStatus
* parameter. The returned result is one of the IcqStatusEnum fields.
*/
- private long presenceStatusToIcqStatusLong(IcqStatusEnum status)
+ private long presenceStatusToStatusLong(PresenceStatus status)
{
- return ((Long)scToIcqStatusMappings.get(status)).longValue();
+ if(icqProvider.USING_ICQ)
+ return ((Long)scToIcqStatusMappings.get(status)).longValue();
+ else
+ return ((Long)scToAimStatusMappings.get(status)).longValue();
}
/**
@@ -657,40 +693,38 @@ public class OperationSetPersistentPresenceIcqImpl
{
assertConnected();
- if (!(status instanceof IcqStatusEnum))
+ if (!(status instanceof IcqStatusEnum || status instanceof AimStatusEnum))
throw new IllegalArgumentException(
- status + " is not a valid ICQ status");
+ status + " is not a valid ICQ/AIM status");
+
+ logger.debug("Will set status: " + status);
- long icqStatus = presenceStatusToIcqStatusLong((IcqStatusEnum)status);
-
- logger.debug("Will set status: " + status + " long=" + icqStatus);
-
MainBosService bosService
= icqProvider.getAimConnection().getBosService();
if(!icqProvider.USING_ICQ)
{
- if(status.equals(IcqStatusEnum.AWAY))
+ if(status.equals(AimStatusEnum.AWAY))
{
- if(getPresenceStatus().equals(IcqStatusEnum.INVISIBLE))
+ if(getPresenceStatus().equals(AimStatusEnum.INVISIBLE))
bosService.setVisibleStatus(true);
bosService.getOscarConnection().sendSnac(new SetInfoCmd(
new InfoData(null, "I'm away!", null, null)));
}
- else if(status.equals(IcqStatusEnum.INVISIBLE))
+ else if(status.equals(AimStatusEnum.INVISIBLE))
{
- if(getPresenceStatus().equals(IcqStatusEnum.AWAY))
+ if(getPresenceStatus().equals(AimStatusEnum.AWAY))
bosService.getOscarConnection().sendSnac(new SetInfoCmd(
new InfoData(null, InfoData.NOT_AWAY, null, null)));
bosService.setVisibleStatus(false);
}
- else if(status.equals(IcqStatusEnum.ONLINE))
+ else if(status.equals(AimStatusEnum.ONLINE))
{
- if(getPresenceStatus().equals(IcqStatusEnum.INVISIBLE))
+ if(getPresenceStatus().equals(AimStatusEnum.INVISIBLE))
bosService.setVisibleStatus(true);
- else if(getPresenceStatus().equals(IcqStatusEnum.AWAY))
+ else if(getPresenceStatus().equals(AimStatusEnum.AWAY))
{
bosService.getOscarConnection().sendSnac(new SetInfoCmd(
new InfoData(null, InfoData.NOT_AWAY, null, null)));
@@ -699,6 +733,10 @@ public class OperationSetPersistentPresenceIcqImpl
}
else
{
+ long icqStatus = presenceStatusToStatusLong((IcqStatusEnum)status);
+
+ logger.debug("Will set status: " + status + " long=" + icqStatus);
+
bosService.getOscarConnection().sendSnac(new SetExtraInfoCmd(icqStatus));
bosService.setStatusMessage(statusMessage);
}
@@ -870,7 +908,7 @@ public class OperationSetPersistentPresenceIcqImpl
*/
public PresenceStatus getPresenceStatus()
{
- return icqStatusLongToPresenceStatus(currentIcqStatus);
+ return statusLongToPresenceStatus(currentIcqStatus);
}
/**
@@ -884,19 +922,24 @@ public class OperationSetPersistentPresenceIcqImpl
{
if(supportedPresenceStatusSet.size() == 0)
{
- supportedPresenceStatusSet.add(IcqStatusEnum.ONLINE);
-
if(icqProvider.USING_ICQ)
{
+ supportedPresenceStatusSet.add(IcqStatusEnum.ONLINE);
supportedPresenceStatusSet.add(IcqStatusEnum.DO_NOT_DISTURB);
supportedPresenceStatusSet.add(IcqStatusEnum.FREE_FOR_CHAT);
supportedPresenceStatusSet.add(IcqStatusEnum.NOT_AVAILABLE);
- supportedPresenceStatusSet.add(IcqStatusEnum.OCCUPIED);
+ supportedPresenceStatusSet.add(IcqStatusEnum.OCCUPIED);
+ supportedPresenceStatusSet.add(IcqStatusEnum.AWAY);
+ supportedPresenceStatusSet.add(IcqStatusEnum.INVISIBLE);
+ supportedPresenceStatusSet.add(IcqStatusEnum.OFFLINE);
+ }
+ else
+ {
+ supportedPresenceStatusSet.add(AimStatusEnum.ONLINE);
+ supportedPresenceStatusSet.add(AimStatusEnum.AWAY);
+ supportedPresenceStatusSet.add(AimStatusEnum.INVISIBLE);
+ supportedPresenceStatusSet.add(AimStatusEnum.OFFLINE);
}
-
- supportedPresenceStatusSet.add(IcqStatusEnum.AWAY);
- supportedPresenceStatusSet.add(IcqStatusEnum.INVISIBLE);
- supportedPresenceStatusSet.add(IcqStatusEnum.OFFLINE);
}
return supportedPresenceStatusSet.iterator();
@@ -1082,8 +1125,8 @@ public class OperationSetPersistentPresenceIcqImpl
void fireProviderPresenceStatusChangeEvent(
long oldStatusL, long newStatusL)
{
- PresenceStatus oldStatus = icqStatusLongToPresenceStatus(oldStatusL);
- PresenceStatus newStatus = icqStatusLongToPresenceStatus(newStatusL);
+ PresenceStatus oldStatus = statusLongToPresenceStatus(oldStatusL);
+ PresenceStatus newStatus = statusLongToPresenceStatus(newStatusL);
if(oldStatus.equals(newStatus)){
logger.debug("Ignored prov stat. change evt. old==new = "
@@ -1415,12 +1458,24 @@ public class OperationSetPersistentPresenceIcqImpl
if(!oldContactStatus.isOnline())
continue;
- contact.updatePresenceStatus(IcqStatusEnum.OFFLINE);
+ if(icqProvider.USING_ICQ)
+ {
+ contact.updatePresenceStatus(IcqStatusEnum.OFFLINE);
- fireContactPresenceStatusChangeEvent(
- contact
- , contact.getParentContactGroup()
- , oldContactStatus, IcqStatusEnum.OFFLINE);
+ fireContactPresenceStatusChangeEvent(
+ contact
+ , contact.getParentContactGroup()
+ , oldContactStatus, IcqStatusEnum.OFFLINE);
+ }
+ else
+ {
+ contact.updatePresenceStatus(AimStatusEnum.OFFLINE);
+
+ fireContactPresenceStatusChangeEvent(
+ contact
+ , contact.getParentContactGroup()
+ , oldContactStatus, AimStatusEnum.OFFLINE);
+ }
}
}
}
@@ -1504,7 +1559,7 @@ public class OperationSetPersistentPresenceIcqImpl
{
if(userInfo.getAwayStatus() != null && userInfo.getAwayStatus().equals(Boolean.TRUE))
{
- currentIcqStatus = presenceStatusToIcqStatusLong(IcqStatusEnum.AWAY);
+ currentIcqStatus = presenceStatusToStatusLong(AimStatusEnum.AWAY);
}
else if(userInfo.getIcqStatus() != -1)
{
@@ -1559,12 +1614,12 @@ public class OperationSetPersistentPresenceIcqImpl
{
Boolean awayStatus = info.getAwayStatus();
if(awayStatus == null || awayStatus.equals(Boolean.FALSE))
- newStatus = IcqStatusEnum.ONLINE;
+ newStatus = AimStatusEnum.ONLINE;
else
- newStatus = IcqStatusEnum.AWAY;
+ newStatus = AimStatusEnum.AWAY;
}
else
- newStatus = icqStatusLongToPresenceStatus(info.getIcqStatus());
+ newStatus = statusLongToPresenceStatus(info.getIcqStatus());
sourceContact.updatePresenceStatus(newStatus);
@@ -1611,7 +1666,12 @@ public class OperationSetPersistentPresenceIcqImpl
PresenceStatus oldStatus
= sourceContact.getPresenceStatus();
- PresenceStatus newStatus = IcqStatusEnum.OFFLINE;
+ PresenceStatus newStatus = null;
+
+ if(icqProvider.USING_ICQ)
+ newStatus = IcqStatusEnum.OFFLINE;
+ else
+ newStatus = AimStatusEnum.OFFLINE;
sourceContact.updatePresenceStatus(newStatus);
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolIconAimImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolIconAimImpl.java
new file mode 100644
index 0000000..d26ae67
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolIconAimImpl.java
@@ -0,0 +1,93 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.protocol.icq;
+
+import java.io.*;
+import java.util.*;
+
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+
+/**
+ * Reperesents the Aim protocol icon. Implements the <tt>ProtocolIcon</tt>
+ * interface in order to provide an aim icon image in two different sizes.
+ *
+ * @author Yana Stamcheva
+ */
+public class ProtocolIconAimImpl
+ implements ProtocolIcon
+{
+ private static Logger logger = Logger.getLogger(ProtocolIconAimImpl.class);
+
+ /**
+ * A hash table containing the protocol icon in different sizes.
+ */
+ private static Hashtable iconsTable = new Hashtable();
+ static {
+ iconsTable.put(ProtocolIcon.ICON_SIZE_16x16,
+ loadIcon("resources/images/aim/aim16x16-online.png"));
+
+ iconsTable.put(ProtocolIcon.ICON_SIZE_64x64,
+ loadIcon("resources/images/aim/aim64x64.png"));
+ }
+
+ /**
+ * Implements the <tt>ProtocolIcon.getSupportedSizes()</tt> method. Returns
+ * an iterator to a set containing the supported icon sizes.
+ * @return an iterator to a set containing the supported icon sizes
+ */
+ public Iterator getSupportedSizes()
+ {
+ return iconsTable.keySet().iterator();
+ }
+
+ /**
+ * Returne TRUE if a icon with the given size is supported, FALSE-otherwise.
+ */
+ public boolean isSizeSupported(String iconSize)
+ {
+ return iconsTable.containsKey(iconSize);
+ }
+
+ /**
+ * Returns the icon image in the given size.
+ * @param iconSize the icon size; one of ICON_SIZE_XXX constants
+ */
+ public byte[] getIcon(String iconSize)
+ {
+ return (byte[])iconsTable.get(iconSize);
+ }
+
+ /**
+ * Returns the icon image used to represent the protocol connecting state.
+ * @return the icon image used to represent the protocol connecting state
+ */
+ public byte[] getConnectingIcon()
+ {
+ return loadIcon("resources/images/aim/cr16-action-aim_connecting.gif");
+ }
+
+ /**
+ * Loads an image from a given image path.
+ * @param imagePath The identifier of the image.
+ * @return The image for the given identifier.
+ */
+ public static byte[] loadIcon(String imagePath)
+ {
+ InputStream is = ProtocolIconAimImpl.class
+ .getClassLoader().getResourceAsStream(imagePath);
+
+ byte[] icon = null;
+ try {
+ icon = new byte[is.available()];
+ is.read(icon);
+ } catch (IOException e) {
+ logger.error("Failed to load icon: " + imagePath, e);
+ }
+ return icon;
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java
index b6a8b05..ac4525f 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java
@@ -92,6 +92,12 @@ public class ProtocolProviderServiceIcqImpl
= new ProtocolIconIcqImpl();
/**
+ * The icon corresponding to the aim protocol.
+ */
+ private ProtocolIconAimImpl aimIcon
+ = new ProtocolIconAimImpl();
+
+ /**
* Property whether we are using AIM or ICQ service
*/
boolean USING_ICQ = true;
@@ -1038,11 +1044,14 @@ public class ProtocolProviderServiceIcqImpl
}
/**
- * Returns the icq protocol icon.
- * @return the icq protocol icon
+ * Returns the icq/aim protocol icon.
+ * @return the icq/aim protocol icon
*/
public ProtocolIcon getProtocolIcon()
{
- return icqIcon;
+ if(USING_ICQ)
+ return icqIcon;
+ else
+ return aimIcon;
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf
index 1f5a05e..36574bf 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf
@@ -11,4 +11,5 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf
index dd0809f..4da5f84 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf
@@ -9,6 +9,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.contactlist.event,
diff --git a/src/net/java/sip/communicator/service/protocol/aimconstants/AimStatusEnum.java b/src/net/java/sip/communicator/service/protocol/aimconstants/AimStatusEnum.java
new file mode 100644
index 0000000..db62d64
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/aimconstants/AimStatusEnum.java
@@ -0,0 +1,99 @@
+package net.java.sip.communicator.service.protocol.aimconstants;
+
+import java.io.*;
+import java.util.*;
+
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+
+/**
+ * An enumeration containing all status instances that MUST be supported by
+ * an implementation of the AIM (Oscar) protocol. Implementations may
+ * support other forms of PresenceStatus but they MUST ALL support those
+ * enumerated here.
+ * <p>
+ * For testing purposes, this class also provides a <tt>List</tt> containing
+ * all of the status fields.
+ *
+ * @author Emil Ivov
+ */
+public class AimStatusEnum
+ extends PresenceStatus
+{
+
+ private static Logger logger = Logger.getLogger(AimStatusEnum.class);
+
+ /**
+ * The Online AIM status. Indicate that the user is able and willing to
+ * communicate.
+ */
+ public static final AimStatusEnum ONLINE
+ = new AimStatusEnum(65, "Online",
+ loadIcon("resources/images/aim/aim16x16-online.png"));
+
+ /**
+ * The Invisible AIM status. Indicates that the user has connectivity even
+ * though it may appear otherwise to others, to whom she would appear to be
+ * offline.
+ */
+ public static final AimStatusEnum INVISIBLE
+ = new AimStatusEnum(45, "Invisible",
+ loadIcon("resources/images/aim/aim16x16-invisible.png"));
+
+ /**
+ * The Away AIM status. Indicates that the user has connectivity but might
+ * not be able to immediately act upon initiation of communication.
+ */
+ public static final AimStatusEnum AWAY
+ = new AimStatusEnum(40, "Away",
+ loadIcon("resources/images/aim/aim16x16-away.png"));
+
+ /**
+ * The Offline AIM status. Indicates the user does not seem to be connected
+ * to the AIM network or at least does not want us to know she is
+ */
+ public static final AimStatusEnum OFFLINE
+ = new AimStatusEnum(0, "Offline",
+ loadIcon("resources/images/aim/aim16x16-offline.png"));
+
+ /**
+ * The minimal set of states that any AIM implementation must support.
+ */
+ public static final ArrayList aimStatusSet =new ArrayList();
+ static{
+ aimStatusSet.add(ONLINE);
+ aimStatusSet.add(INVISIBLE);
+ aimStatusSet.add(AWAY);
+ aimStatusSet.add(OFFLINE);
+ }
+
+ /**
+ * Creates a status with the specified connectivity coeff, name and icon.
+ * @param status the connectivity coefficient for the specified status
+ * @param statusName String
+ * @param statusIcon the icon associated with this status
+ */
+ protected AimStatusEnum(int status, String statusName, byte[] statusIcon)
+ {
+ super(status, statusName, statusIcon);
+ }
+
+ /**
+ * Loads an image from a given image path.
+ * @param imagePath The identifier of the image.
+ * @return The image for the given identifier.
+ */
+ public static byte[] loadIcon(String imagePath) {
+ InputStream is = AimStatusEnum.class.getClassLoader()
+ .getResourceAsStream(imagePath);
+
+ byte[] icon = null;
+ try {
+ icon = new byte[is.available()];
+ is.read(icon);
+ } catch (IOException e) {
+ logger.error("Failed to load icon: " + imagePath, e);
+ }
+ return icon;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
index 0ba2dfe..4b7ab8d 100644
--- a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
+++ b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
@@ -8,6 +8,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration.event,
Export-Package: net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.jabberconstants,
net.java.sip.communicator.service.protocol.msnconstants,
net.java.sip.communicator.service.protocol.yahooconstants,
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf b/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf
index a714138..b5364b4 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf
+++ b/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf
@@ -11,4 +11,5 @@ Import-Package: junit.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event