From c2d09bdf4dd69d7195c9466fcf16c8f11c725de3 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Tue, 17 Apr 2007 10:17:04 +0000 Subject: [PATCH] Added AIM icons --- build.xml | 2 + resources/images/aim/aim16x16-away.png | Bin 0 -> 531 bytes resources/images/aim/aim16x16-invisible.png | Bin 0 -> 604 bytes resources/images/aim/aim16x16-offline.png | Bin 0 -> 621 bytes .../images/aim/cr16-action-aim_connecting.gif | Bin 0 -> 2248 bytes ...rationSetBasicInstantMessagingIcqImpl.java | 14 +- ...OperationSetPersistentPresenceIcqImpl.java | 218 +++++++++++------- .../protocol/icq/ProtocolIconAimImpl.java | 93 ++++++++ .../icq/ProtocolProviderServiceIcqImpl.java | 15 +- .../protocol/icq/icq.provider.manifest.mf | 1 + .../aimaccregwizz/aimaccregwizz.manifest.mf | 1 + .../protocol/aimconstants/AimStatusEnum.java | 99 ++++++++ .../protocol/protocol.provider.manifest.mf | 1 + .../icq/icq.provider.slick.manifest.mf | 1 + 14 files changed, 359 insertions(+), 86 deletions(-) create mode 100644 resources/images/aim/aim16x16-away.png create mode 100644 resources/images/aim/aim16x16-invisible.png create mode 100644 resources/images/aim/aim16x16-offline.png create mode 100644 resources/images/aim/cr16-action-aim_connecting.gif create mode 100644 src/net/java/sip/communicator/impl/protocol/icq/ProtocolIconAimImpl.java create mode 100644 src/net/java/sip/communicator/service/protocol/aimconstants/AimStatusEnum.java diff --git a/build.xml b/build.xml index 01886dfdd..03ebf2475 100644 --- a/build.xml +++ b/build.xml @@ -1151,6 +1151,8 @@ javax.swing.event, javax.swing.border"/> + diff --git a/resources/images/aim/aim16x16-away.png b/resources/images/aim/aim16x16-away.png new file mode 100644 index 0000000000000000000000000000000000000000..91629def7a18c0b0cfdd2d6c220b06f52ce8b601 GIT binary patch literal 531 zcmV+u0_^>XP)y??0n*3zC^!l@sa^(YXEH7X%8GEF@RjIUS>Rgfv<4*)! zY>X?=+V;}TpKL7wyAi~|<}ZM~#vr#}jeFC}BByO^*LZpNiUYC=rfv@B0$i;w{Mk2M zVdcwC)*&znZ-LZ|)UraO!>Sp=O!yG+CcF>%0YUZTG#K7O9TKvDmcO7NOaU`tL8KN) zE#S=#S0I6x>XJjiTOH&rkOm#BU}L+MdEMOhxAUS2+IpV5b2om(_rIz*E5&!-it@;g z8=X<|Oe#Dzxii;l!1<7pp8=u{kvi;Js+Q{DX!`~w7WaC3C((y0`O zIN6E;HH5~LQ0+$~rG~`x=A#Wa$<4j@acGD1BguiYocDJQ&v{-BlIWMf9O>VyTL+cO zw_N@saPtB)pm}2LPcdC;yE^uKS&pYvp|lA^d$|DpV7K}q~bx10N!NuHt?Vq z3Jn<0dgyxK0KPe?xB_VPLW2}!*eida-tlP(j=Hd4UIBibp@x|F4A_RuD)0&jooD(g zFvh$n)tgIJvpq{{>bh*NWVJ1cDmA*Bdu9Y2YBAgo6{zY`MgMW zb|Enxe;SESOpOKuv>liEYTZgqM&j|Y5j;e_dUX6`CiYlT>Wl)Cxv$h*C2T2SOEg@O zEhK>(ka&mH5w?_Q_+n%C`-Niy7AV=G;fsH5k~yY^k$f8fym!x#4-y>{Tpxf2)eojiBn?hfiNVe)@9sO1CV~dx9lFe!w6X zP%v-^NGNFNpTGY6{rB&~3SAcfCD(YmIEGZ*@;&D&*6bj_av^bp!r_)3yFuXIeWx`r}0F`U|H(Ga;nMbzWskBXGFg$3 z2deqi!P7RMp69K5bn4AT9hp;Prhnky5ux1U!LW3PYiwiM8ONuR6Mrq^_wg6ZbDOsC Q2+-XOp00i_>zopr033w>k^lez literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..ceda8afc86388cd2ae188513be2fa715ad6ab4c2 GIT binary patch literal 2248 zcmcK5Yfw|^0S4d%Fd^Jx?j!`0lMA_!`~3=p+$02&5HNrQh!t#$D>_c;%2+`TFb-ke zWh0_AvRS(Xwri+6IE>=D7u1n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k4D}mA*6a?bgC|a%63R5Z*8^m(COaLWJ zT=0vN83|_&pO4GBJ?=?mbI{)N7qD1*G|2+9+KFog*pEV|0}VJLi<}G5Xd)t43S>}( zO0qx)K@gM4<#2gSo{+~A04@T7aLtNduLlza_K84s0V_0hBfYo|aG{&_2=%2*$8M-% zC*YzC{H(OJ6mY4ks;a4}0bE*ITH4y$0GFLRcTyO=6kdd3>R~$GPjcY~PD$EkfE7jO zM~c1kphDKT6iqIH@~A%ef$#8{)`53y6JG*4&iDVfMXLY1NC2aup`pWv4}&5Ba|J5o zP~y|*_2uMHo%-q@V5{cl<^UtGRck{97=fVzProtocolIcon + * 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 ProtocolIcon.getSupportedSizes() 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 b6a8b05b5..ac4525fdb 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -91,6 +91,12 @@ public class ProtocolProviderServiceIcqImpl private ProtocolIconIcqImpl icqIcon = new ProtocolIconIcqImpl(); + /** + * The icon corresponding to the aim protocol. + */ + private ProtocolIconAimImpl aimIcon + = new ProtocolIconAimImpl(); + /** * Property whether we are using AIM or ICQ service */ @@ -1038,11 +1044,14 @@ static int convertAuthCodeToReasonCode(AuthFailureInfo afi) } /** - * 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 1f5a05e97..36574bf7f 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 dd0809f16..4da5f84d5 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 000000000..db62d64a7 --- /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. + *

+ * For testing purposes, this class also provides a List 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 0ba2dfe8f..4b7ab8d32 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 a71413880..b5364b418 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