diff --git a/build.xml b/build.xml
index 1f14a7b81..5a8225fbc 100644
--- a/build.xml
+++ b/build.xml
@@ -77,7 +77,7 @@
-
+
@@ -91,16 +91,16 @@
value="${basedir}/${lib}/native/linux:${system.LD_LIBRARY_PATH}">
-
+
-
+
-
+
@@ -114,7 +114,7 @@
-
+
@@ -126,12 +126,12 @@
-
+
-
+
@@ -146,14 +146,14 @@
-
+
-
+
@@ -358,7 +358,7 @@
tofile="${macosx.resrc.dir}/logging.properties"
overwrite="true"/>
@@ -366,9 +366,9 @@
tofile="${macosx.resrc.dir}/felix.client.run.properties"
overwrite="true"/>
- felix.auto.start.70= reference:file:sc-bundles/os-specific/macosx/growlnotification.jar
@@ -433,7 +433,7 @@
value="${macosx.app.name}-tmp.dmg"/>
-
+
@@ -470,7 +470,7 @@
-
+
@@ -694,7 +694,7 @@
fork="true"
failonerror="true"
classpathref="project.class.path">
-
+
@@ -708,7 +708,7 @@
-
+
@@ -1058,9 +1058,11 @@ javax.swing.event, javax.swing.border"/>
manifest="src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf">
-
-
-
+
+
+
+
+
@@ -1071,9 +1073,11 @@ javax.swing.event, javax.swing.border"/>
manifest="test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf">
-
-
-
+
+
+
+
+
@@ -1338,13 +1342,13 @@ javax.swing.event, javax.swing.border"/>
prefix="net/java/sip/communicator/plugin/splashscreen"/>
-
+
+ manifest="src/net/java/sip/communicator/plugin/systray/systray.manifest.mf">
diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties
index 52723d58b..7ab9a0cde 100644
--- a/lib/felix.client.run.properties
+++ b/lib/felix.client.run.properties
@@ -25,6 +25,8 @@ org.osgi.framework.system.packages= org.osgi.framework; \
javax.xml.transform.dom; \
javax.xml.transform.stream; \
sun.security.action; \
+ sun.misc; \
+ javax.net; \
javax.net.ssl; \
javax.naming; \
javax.naming.directory; \
diff --git a/lib/felix.unit.test.properties b/lib/felix.unit.test.properties
index 101eb4306..1d376e9f1 100644
--- a/lib/felix.unit.test.properties
+++ b/lib/felix.unit.test.properties
@@ -9,6 +9,7 @@ org.osgi.framework.system.packages= org.osgi.framework; \
javax.swing.table; \
org.w3c.dom; \
org.xml.sax; \
+ sun.misc; \
sun.security.action; \
javax.xml.parsers;\
org.apache.xml.serializer;\
@@ -21,6 +22,7 @@ org.osgi.framework.system.packages= org.osgi.framework; \
javax.sound.sampled; \
javax.naming; \
javax.naming.directory; \
+ javax.net; \
javax.net.ssl;
#
diff --git a/lib/installer-exclude/joscar-0.9.4-cvs-bin.jar b/lib/installer-exclude/joscar-0.9.4-cvs-bin.jar
deleted file mode 100644
index 464d96e51..000000000
Binary files a/lib/installer-exclude/joscar-0.9.4-cvs-bin.jar and /dev/null differ
diff --git a/lib/installer-exclude/joscar-client.jar b/lib/installer-exclude/joscar-client.jar
new file mode 100644
index 000000000..8be00c9a3
Binary files /dev/null and b/lib/installer-exclude/joscar-client.jar differ
diff --git a/lib/installer-exclude/joscar-common.jar b/lib/installer-exclude/joscar-common.jar
new file mode 100644
index 000000000..d09cf3fd1
Binary files /dev/null and b/lib/installer-exclude/joscar-common.jar differ
diff --git a/lib/installer-exclude/joscar-protocol.jar b/lib/installer-exclude/joscar-protocol.jar
new file mode 100644
index 000000000..50ce8ca47
Binary files /dev/null and b/lib/installer-exclude/joscar-protocol.jar differ
diff --git a/lib/installer-exclude/jsocks-klea.jar b/lib/installer-exclude/jsocks-klea.jar
new file mode 100644
index 000000000..e06166f3f
Binary files /dev/null and b/lib/installer-exclude/jsocks-klea.jar differ
diff --git a/lib/installer-exclude/oscar-aim.jar b/lib/installer-exclude/oscar-aim.jar
deleted file mode 100644
index 477bbf899..000000000
Binary files a/lib/installer-exclude/oscar-aim.jar and /dev/null differ
diff --git a/lib/installer-exclude/retroweaver-rt-2.0Beta2.jar b/lib/installer-exclude/retroweaver-rt-2.0Beta2.jar
new file mode 100644
index 000000000..8b97db615
Binary files /dev/null and b/lib/installer-exclude/retroweaver-rt-2.0Beta2.jar differ
diff --git a/lib/installer-exclude/retroweaver-rt.jar b/lib/installer-exclude/retroweaver-rt.jar
deleted file mode 100644
index 5839d2397..000000000
Binary files a/lib/installer-exclude/retroweaver-rt.jar and /dev/null differ
diff --git a/lib/installer-exclude/retroweaver.jar b/lib/installer-exclude/retroweaver.jar
deleted file mode 100644
index 9909420d5..000000000
Binary files a/lib/installer-exclude/retroweaver.jar and /dev/null differ
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java
index 40d303ccc..0b567605f 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java
@@ -8,11 +8,13 @@
import java.util.*;
-import net.java.sip.communicator.impl.protocol.icq.message.common.*;
-import net.java.sip.communicator.impl.protocol.icq.message.usrinfo.*;
import net.java.sip.communicator.util.*;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.snac.*;
+import net.kano.joustsim.*;
+import net.kano.joscar.snaccmd.icq.*;
+import net.java.sip.communicator.service.protocol.*;
+import java.net.*;
/**
* @author Damian Minkov
@@ -37,6 +39,14 @@ public class InfoRetreiver
// used to generate request id when sending commands for retreiving user info
private static int requestID = 0;
+ /**
+ * As all the Full User Info comes in
+ * sequences of 8 packets acording to the
+ * requestID we keep the stored Info so far.
+ */
+ private static Hashtable retreivedInfo = new Hashtable();
+
+
protected InfoRetreiver
(ProtocolProviderServiceIcqImpl icqProvider, String ownerUin)
{
@@ -107,34 +117,23 @@ protected List getContactDetails(String uin)
if(result == null)
{
+ int reqID = requestID++;
+
//retreive the details
long toICQUin = Long.parseLong(uin);
- FullInfoRequest infoRequest = new FullInfoRequest(toICQUin);
-
- int reqID = requestID++;
+ MetaFullInfoRequest infoRequest =
+ new MetaFullInfoRequest(
+ Long.parseLong(ownerUin),
+ reqID,
+ toICQUin);
UserInfoResponseRetriever responseRetriever =
new UserInfoResponseRetriever(reqID);
- SnacCommand cmd = new ToIcqCmd(
- Long.parseLong(ownerUin),
- infoRequest.getType(),
- reqID,
- infoRequest);
+ icqProvider.getAimConnection().getInfoService().getOscarConnection()
+ .sendSnacRequest(infoRequest, responseRetriever);
- icqProvider.getAimConnection().getInfoService()
- .sendSnacRequest(cmd, responseRetriever);
-
- synchronized(responseRetriever)
- {
- try{
- responseRetriever.wait(10000);
- }
- catch (InterruptedException ex)
- {
- //we don't care
- }
- }
+ responseRetriever.waitForLastInfo(10000);
result = responseRetriever.result;
retreivedDetails.put(uin, result);
@@ -160,20 +159,60 @@ public void handleResponse(SnacResponseEvent e)
{
SnacCommand snac = e.getSnacCommand();
- if (snac instanceof FullInfoCmd)
+ if (snac instanceof MetaBasicInfoCmd)
+ {
+ readBasicUserInfo((MetaBasicInfoCmd)snac);
+ }
+ else if (snac instanceof MetaMoreInfoCmd)
+ {
+ readMoreUserInfo((MetaMoreInfoCmd)snac);
+ }
+ else if (snac instanceof MetaEmailInfoCmd)
+ {
+ readEmailUserInfo((MetaEmailInfoCmd)snac);
+ }
+ else if (snac instanceof MetaHomepageCategoryInfoCmd)
+ {
+ readHomePageUserInfo((MetaHomepageCategoryInfoCmd)snac);
+ }
+ else if (snac instanceof MetaWorkInfoCmd)
+ {
+ readWorkUserInfo((MetaWorkInfoCmd)snac);
+ }
+ else if (snac instanceof MetaNotesInfoCmd)
+ {
+ readUserAboutInfo((MetaNotesInfoCmd)snac);
+ }
+ else if (snac instanceof MetaInterestsInfoCmd)
+ {
+ readInterestsUserInfo((MetaInterestsInfoCmd)snac);
+ }
+ else if (snac instanceof MetaAffiliationsInfoCmd)
{
- FullInfoCmd infoSnac = (FullInfoCmd)snac;
+ readAffilationsUserInfo((MetaAffiliationsInfoCmd)snac);
- if(infoSnac.isLastOfSequences() &&
- infoSnac.getRequestID() == requestID)
- {
- //get the result
- result = infoSnac.getInfo();
+ result =
+ getInfoForRequest(((MetaAffiliationsInfoCmd)snac).getId());
+ // this is the last packet
+ synchronized(this){this.notifyAll();}
+ }
+ }
- synchronized(this){this.notifyAll();}
+ public void waitForLastInfo(long waitFor)
+ {
+ synchronized(this)
+ {
+ try{
+ wait(waitFor);
+ }
+ catch (InterruptedException ex)
+ {
+ logger.debug(
+ "Interrupted while waiting for a subscription evt", ex);
}
}
}
+
}
/**
@@ -222,16 +261,11 @@ public String getNickName(String uin)
new ShortInfoResponseRetriever();
long longUin = Long.parseLong(uin);
- MetaShortInfoRequest req = new MetaShortInfoRequest(longUin);
+ MetaShortInfoRequest req =
+ new MetaShortInfoRequest(Long.parseLong(ownerUin), 2, longUin);
- SnacCommand cmd = new ToIcqCmd(
- Long.parseLong(ownerUin),
- req.getType(),
- 2,
- req);
-
- icqProvider.getAimConnection().getInfoService()
- .sendSnacRequest(cmd, responseRetriever);
+ icqProvider.getAimConnection().getInfoService().getOscarConnection()
+ .sendSnacRequest(req, responseRetriever);
synchronized(responseRetriever)
{
@@ -246,4 +280,301 @@ public String getNickName(String uin)
return responseRetriever.nickname;
}
+
+ /**
+ * Metods retrieving data and storing it
+ */
+ /**
+ * Returns the stored info so far on the specified request
+ *
+ * @param requestID int
+ * @return List
+ */
+ private List getInfoForRequest(int requestID)
+ {
+ List res = (List) retreivedInfo.get(new Integer(requestID));
+
+ if (res == null)
+ {
+ // this indicates that the info data
+ // doesn't exists, so this is the first packet
+ // from the sequence (basic info)
+
+ res = new LinkedList();
+ retreivedInfo.put(new Integer(requestID), res);
+ }
+
+ return res;
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in MetaBasicInfoCmd command
+ * @param cmd MetaBasicInfoCmd
+ */
+ private void readBasicUserInfo(MetaBasicInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ Locale countryCodeLocale =
+ OperationSetServerStoredAccountInfoIcqImpl.getCountry(cmd.getCountryCode());
+ if (countryCodeLocale != null)
+ infoData.add(new ServerStoredDetails.CountryDetail(
+ countryCodeLocale));
+
+ // the following are not used
+ // cmd.getGmtOffset()
+ // cmd.isAuthorization()
+ // cmd.isWebAware()
+ // cmd.isPublishPrimaryEmail()
+
+ // everything is read lets store it
+ String tmp = null;
+ if ((tmp = cmd.getNickname()) != null)
+ infoData.add(new ServerStoredDetails.NicknameDetail(tmp));
+ if ((tmp = cmd.getFirstName()) != null)
+ infoData.add(new ServerStoredDetails.FirstNameDetail(tmp));
+ if ((tmp = cmd.getLastName()) != null)
+ infoData.add(new ServerStoredDetails.LastNameDetail(tmp));
+ if ((tmp = cmd.getEmail()) != null)
+ infoData.add(new ServerStoredDetails.EmailAddressDetail(tmp));
+ if ((tmp = cmd.getHomeCity()) != null)
+ infoData.add(new ServerStoredDetails.CityDetail(tmp));
+ if ((tmp = cmd.getHomeState()) != null)
+ infoData.add(new ServerStoredDetails.ProvinceDetail(tmp));
+ if ((tmp = cmd.getHomePhone()) != null)
+ infoData.add(new ServerStoredDetails.PhoneNumberDetail(tmp));
+ if ((tmp = cmd.getHomeFax()) != null)
+ infoData.add(new ServerStoredDetails.FaxDetail(tmp));
+ if ((tmp = cmd.getHomeAddress()) != null)
+ infoData.add(new ServerStoredDetails.AddressDetail(tmp));
+ if ((tmp = cmd.getCellPhone()) != null)
+ infoData.add(new ServerStoredDetails.MobilePhoneDetail(tmp));
+ if ((tmp = cmd.getHomeZip()) != null)
+ infoData.add(new ServerStoredDetails.PostalCodeDetail(tmp));
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in MoreUserInfo command
+ * @param cmd MetaMoreInfoCmd
+ */
+ private void readMoreUserInfo(MetaMoreInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ ServerStoredDetails.GenderDetail gender =
+ OperationSetServerStoredAccountInfoIcqImpl.genders[cmd.getGender()];
+ if(gender != null)
+ infoData.add(gender);
+
+ String tmp = null;
+
+ try
+ {
+ if((tmp = cmd.getHomepage()) != null)
+ infoData.add(new ServerStoredDetails.WebPageDetail(new URL(tmp)));
+ }
+ catch (MalformedURLException ex)
+ {}
+
+ Calendar birthDate = Calendar.getInstance();
+ birthDate.setTime(cmd.getBirthDate());
+ infoData.add(new ServerStoredDetails.BirthDateDetail(birthDate));
+
+ Locale spokenLanguage1 =
+ OperationSetServerStoredAccountInfoIcqImpl.
+ getSpokenLanguage(cmd.getSpeakingLanguages()[0]);
+ if(spokenLanguage1 != null)
+ infoData.add(
+ new ServerStoredDetails.SpokenLanguageDetail(spokenLanguage1));
+
+ Locale spokenLanguage2 =
+ OperationSetServerStoredAccountInfoIcqImpl.
+ getSpokenLanguage(cmd.getSpeakingLanguages()[1]);
+ if(spokenLanguage2 != null)
+ infoData.add(
+ new ServerStoredDetails.SpokenLanguageDetail(spokenLanguage2));
+
+ Locale spokenLanguage3 =
+ OperationSetServerStoredAccountInfoIcqImpl.
+ getSpokenLanguage(cmd.getSpeakingLanguages()[2]);
+ if(spokenLanguage3 != null)
+ infoData.add(
+ new ServerStoredDetails.SpokenLanguageDetail(spokenLanguage3));
+
+ if((tmp = cmd.getOriginalCity()) != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.OriginCityDetail(tmp));
+
+ if((tmp = cmd.getOriginalState()) != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.OriginProvinceDetail(tmp));
+
+ Locale originCountryLocale =
+ OperationSetServerStoredAccountInfoIcqImpl.getCountry(cmd.getOriginalCountryCode());
+ if(originCountryLocale != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.
+ OriginCountryDetail(originCountryLocale));
+
+
+ int userGMTOffset = cmd.getTimeZone();
+ TimeZone userTimeZone = null;
+ if(userGMTOffset >= 0)
+ userTimeZone = TimeZone.getTimeZone("GMT+" + userGMTOffset);
+ else
+ userTimeZone = TimeZone.getTimeZone("GMT" + userGMTOffset);
+
+ infoData.add(new ServerStoredDetails.TimeZoneDetail("GMT Offest", userTimeZone));
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in EmailUserInfo command
+ * @param cmd MetaEmailInfoCmd
+ */
+ private void readEmailUserInfo(MetaEmailInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ String emails[] = cmd.getEmails();
+
+ if(emails == null)
+ return;
+
+ for (int i = 0; i < emails.length; i++)
+ {
+ infoData.add(new ServerStoredDetails.EmailAddressDetail(emails[i]));
+ }
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in HomePageUserInfo command
+ * @param cmd MetaHomepageCategoryInfoCmd
+ */
+ private void readHomePageUserInfo(MetaHomepageCategoryInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ String tmp = null;
+
+ try
+ {
+ if ((tmp = cmd.getKeywords()) != null)
+ infoData.add(new ServerStoredDetails.WebPageDetail(new URL(tmp)));
+ }
+ catch (MalformedURLException ex)
+ {}
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in WorkUserInfo command
+ * @param cmd MetaWorkInfoCmd
+ */
+ private void readWorkUserInfo(MetaWorkInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ String tmp = null;
+ if ((tmp = cmd.getWorkCity()) != null)
+ infoData.add(new ServerStoredDetails.WorkCityDetail(tmp));
+ if ((tmp = cmd.getWorkState()) != null)
+ infoData.add(new ServerStoredDetails.WorkProvinceDetail(tmp));
+ if ((tmp = cmd.getWorkPhone()) != null)
+ infoData.add(new ServerStoredDetails.WorkPhoneDetail(tmp));
+ if ((tmp = cmd.getWorkFax()) != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.WorkFaxDetail(tmp));
+ if ((tmp = cmd.getWorkAddress()) != null)
+ infoData.add(new ServerStoredDetails.WorkAddressDetail(tmp));
+ if ((tmp = cmd.getWorkZipCode()) != null)
+ infoData.add(new ServerStoredDetails.WorkPostalCodeDetail(tmp));
+
+ Locale workCountry =
+ OperationSetServerStoredAccountInfoIcqImpl.getCountry(cmd.getWorkCountryCode());
+ if (workCountry != null)
+ infoData.add(new ServerStoredDetails.WorkCountryDetail(workCountry));
+
+ if ((tmp = cmd.getWorkCompany()) != null)
+ infoData.add(new ServerStoredDetails.WorkOrganizationNameDetail(tmp));
+ if ((tmp = cmd.getWorkDepartment()) != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.WorkDepartmentNameDetail(tmp));
+ if ((tmp = cmd.getWorkPosition()) != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.WorkPositionNameDetail(tmp));
+
+ int workOccupationCode = cmd.getWorkOccupationCode();
+ if (workOccupationCode == 99)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.
+ WorkOcupationDetail(OperationSetServerStoredAccountInfoIcqImpl.
+ occupations[OperationSetServerStoredAccountInfoIcqImpl.occupations.length - 1]));
+ else
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.
+ WorkOcupationDetail(
+ OperationSetServerStoredAccountInfoIcqImpl.occupations[workOccupationCode]));
+
+ try
+ {
+ if ((tmp = cmd.getWorkWebPage()) != null)
+ infoData.add(new ServerStoredDetails.WorkPageDetail(new URL(tmp)));
+ }
+ catch (MalformedURLException ex)
+ {}
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in UserAboutInfo command
+ * @param cmd MetaNotesInfoCmd
+ */
+ private void readUserAboutInfo(MetaNotesInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ if (cmd.getNotes() != null)
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.NotesDetail(cmd.getNotes()));
+ }
+
+ /**
+ * Method for parsing incoming data
+ * Read data in InterestsUserInfo command
+ * @param cmd MetaInterestsInfoCmd
+ */
+ private void readInterestsUserInfo(MetaInterestsInfoCmd cmd)
+ {
+ List infoData = getInfoForRequest(cmd.getId());
+
+ int[] categories = cmd.getCategories();
+ String[] interests = cmd.getInterests();
+ for (int i = 0; i < interests.length; i++)
+ {
+ int category = categories[i];
+ if (category != 0)
+ {
+ // as the categories are between 100 and 150 we shift them
+ // because their string representations are stored in array
+ category = category - 99;
+ }
+ infoData.add(
+ new OperationSetServerStoredAccountInfoIcqImpl.InterestDetail(
+ interests[i],
+ OperationSetServerStoredAccountInfoIcqImpl.interestsCategories[category]));
+ }
+ }
+
+ /**
+ * Not used for now
+ * @param cmd MetaAffiliationsInfoCmd
+ */
+ private void readAffilationsUserInfo(MetaAffiliationsInfoCmd cmd)
+ {
+// Vector infoData = getInfoForRequest(cmd.getId());
+ }
}
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 81c765a98..0d0ae136f 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
@@ -8,9 +8,6 @@
import java.util.*;
-import net.java.sip.communicator.impl.protocol.icq.message.common.*;
-import net.java.sip.communicator.impl.protocol.icq.message.imicbm.*;
-import net.java.sip.communicator.impl.protocol.icq.message.offline.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.Message;
import net.java.sip.communicator.service.protocol.event.*;
@@ -19,10 +16,12 @@
import net.kano.joscar.snac.*;
import net.kano.joscar.snaccmd.error.*;
import net.kano.joscar.snaccmd.icbm.*;
+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.*;
+
/**
* A straightforward implementation of the basic instant messaging operation
* set.
@@ -72,14 +71,6 @@ public class OperationSetBasicInstantMessagingIcqImpl
*/
private OperationSetPersistentPresenceIcqImpl opSetPersPresence = null;
- /**
- * Incoming messages has channels.
- * joscar and joustsim handle only channel one and two.
- * This is patch to handle and fourth one.
- */
- private ChannelFourCmdFactory channelFourCmdFactory
- = new ChannelFourCmdFactory();
-
/**
* I do not why but we sometimes receive messages with a date in the future.
* I've decided to ignore such messages. I draw the line on
@@ -126,9 +117,6 @@ public class OperationSetBasicInstantMessagingIcqImpl
{
this.icqProvider = icqProvider;
icqProvider.addRegistrationStateChangeListener(providerRegListener);
-
- channelFourCmdFactory.addCommandHandler
- (IcbmChannelFourCommand.MTYPE_PLAIN, new PlainMessageHandler());
}
/**
@@ -207,21 +195,23 @@ public void sendInstantMessage(Contact to, Message message)
{
assertConnected();
- if (to.getPresenceStatus().isOnline())
- {
- ImConversation imConversation =
+ ImConversation imConversation =
icqProvider.getAimConnection().getIcbmService().
getImConversation(
new Screenname(to.getAddress()));
+
+ if (to.getPresenceStatus().isOnline())
+ {
+
+
//do not add the conversation listener in here. we'll add it
//inside the icbm listener
imConversation.sendMessage(new SimpleMessage(message.getContent()));
}
else
- icqProvider.getAimConnection().getIcbmService().
- sendSnac(new SendOfflineIm(to.getAddress(), message.getContent()));
+ imConversation.sendMessage(new SimpleMessage(message.getContent()), true);
//temporarily and uglity fire the sent event here.
/** @todo move elsewhaere */
@@ -242,20 +232,20 @@ public void sendInstantMessage(Contact to, Message message)
private static int offlineMessageRequestID = 0;
private void retreiveOfflineMessages()
{
- OfflineMsgRequest offlineMsgsReq = new OfflineMsgRequest();
int requestID = offlineMessageRequestID++;
- SnacCommand cmd = new ToIcqCmd(
- Long.parseLong(
- icqProvider.getAimSession().getScreenname().getNormal()),
- offlineMsgsReq.getType(),
- requestID,
- offlineMsgsReq);
+ OfflineMsgIcqRequest offlineMsgsReq =
+ new OfflineMsgIcqRequest(
+ Long.parseLong(
+ icqProvider.getAimSession().getScreenname().getNormal()),
+ requestID
+ );
OfflineMessagesRetriever responseRetriever =
new OfflineMessagesRetriever(requestID);
- SnacRequest snReq = new SnacRequest(cmd, responseRetriever);
+ SnacRequest snReq = new SnacRequest(offlineMsgsReq, responseRetriever);
- icqProvider.getAimConnection().getInfoService().sendSnacRequest(snReq);
+ icqProvider.getAimConnection().getInfoService().
+ getOscarConnection().sendSnacRequest(snReq);
}
private class OfflineMessagesRetriever
@@ -274,12 +264,14 @@ public void handleResponse(SnacResponseEvent evt)
logger.debug("Received a response to our offline message request: " +
snac);
- if (snac instanceof OfflineMsgCmd)
+ if (snac instanceof OfflineMsgIcqCmd)
{
- OfflineMsgCmd offlineMsgCmd = (OfflineMsgCmd) snac;
- if (!offlineMsgCmd.isEndOfOfflineMessages())
+ OfflineMsgIcqCmd offlineMsgCmd = (OfflineMsgIcqCmd) snac;
+
+ if (!offlineMsgCmd.getType().
+ equals(AbstractIcqCmd.CMD_OFFLINE_MSG_DONE))
{
- String contactUIN = String.valueOf(offlineMsgCmd.getUin());
+ String contactUIN = String.valueOf(offlineMsgCmd.getFromUIN());
Contact sourceContact =
opSetPersPresence.findContactByID(contactUIN);
if (sourceContact == null)
@@ -315,18 +307,15 @@ public void handleResponse(SnacResponseEvent evt)
{
logger.debug("send ack to delete offline messages");
- OfflineMsgDeleteRequest offlineMsgDeleteReq = new
- OfflineMsgDeleteRequest();
- SnacCommand cmd = new ToIcqCmd(
- Long.parseLong(
+ OfflineMsgIcqAckCmd offlineMsgDeleteReq = new
+ OfflineMsgIcqAckCmd(
+ Long.parseLong(
icqProvider.getAimSession().getScreenname().
getNormal()),
- offlineMsgDeleteReq.getType(),
- requestID,
- offlineMsgDeleteReq);
-
- icqProvider.getAimConnection().getInfoService().sendSnac(
- cmd);
+ requestID
+ );
+ icqProvider.getAimConnection().getInfoService().
+ getOscarConnection().sendSnac(offlineMsgDeleteReq);
}
}
else
@@ -356,17 +345,6 @@ private void assertConnected() throws IllegalStateException
+"being able to communicate.");
}
- /**
- * This method is used to provide the factory instance so
- * othe operations can add their handlers in it, for certain commands.
- *
- * @return ChannelFourCmdFactory the factory instance
- */
- public ChannelFourCmdFactory getChannelFourFactory()
- {
- return channelFourCmdFactory;
- }
-
/**
* Determines wheter the protocol provider (or the protocol itself) support
* sending and receiving offline messages. Most often this method would
@@ -386,29 +364,6 @@ public boolean isOfflineMessagingSupported()
return true;
}
- /**
- * Fix of issue 142
- * Some clients send messages through channel 4
- */
- private class PlainMessageHandler
- implements ChFourPacketHandler
- {
- public SnacCommand handle(IcbmChannelFourCommand cmd)
- {
- return new RecvImIcbm(
- cmd.getRequestID(),
- cmd.getUserInfo(),
- new InstantMessage(cmd.getReason()),
- cmd.isAutoResponse(),
- cmd.senderWantsIcon(),
- cmd.getIconInfo(),
- null,
- cmd.getFeaturesBlock(),
- true);
- }
-
- }
-
/**
* Our listener that will tell us when we're registered to icq and joust
* sim is ready to accept us as a listener.
@@ -438,11 +393,6 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
icqProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
- // registers the factory handling channel 4 messages
- icqProvider.getAimConnection().getIcbmService().
- getOscarConnection().getSnacProcessor().getCmdFactoryMgr().
- getDefaultFactoryList().registerAll(channelFourCmdFactory);
-
retreiveOfflineMessages();
// run keepalive thread
@@ -537,6 +487,14 @@ public void buddyInfoUpdated(IcbmService service, Screenname buddy,
+ " new info is: " + info);
}
+ public void sendAutomaticallyFailed(
+ IcbmService service,
+ net.kano.joustsim.oscar.oscar.service.icbm.Message message,
+ Set triedConversations)
+ {
+ logger.debug("sendAutomaticallyFailed message : " + message);
+ }
+
}
/**
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 c0be682c5..73f1ea016 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
@@ -9,11 +9,10 @@
import java.beans.*;
import java.util.*;
-import net.java.sip.communicator.impl.protocol.icq.message.auth.*;
-import net.java.sip.communicator.impl.protocol.icq.message.imicbm.*;
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.AuthorizationResponse.*;
import net.java.sip.communicator.util.*;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.snac.*;
@@ -27,6 +26,7 @@
import net.kano.joustsim.oscar.oscar.service.buddy.*;
import net.kano.joustsim.oscar.oscar.service.ssi.*;
+
/**
* The ICQ implementation of a Persistent Presence Operation set. This class
* manages our own presence status as well as subscriptions for the presence
@@ -115,6 +115,9 @@ public class OperationSetPersistentPresenceIcqImpl
*/
private long currentIcqStatus = -1;
+ private AuthorizationHandler authorizationHandler = null;
+ private AuthListener authListener = new AuthListener();
+
/**
* The array list we use when returning from the getSupportedStatusSet()
* method.
@@ -276,7 +279,7 @@ public PresenceStatus queryContactStatus(String contactIdentifier)
GetInfoCmd getInfoCmd =
new GetInfoCmd(GetInfoCmd.CMD_USER_INFO, contactIdentifier);
- icqProvider.getAimConnection().getInfoService()
+ icqProvider.getAimConnection().getInfoService().getOscarConnection()
.sendSnacRequest(getInfoCmd, responseRetriever);
synchronized(responseRetriever)
@@ -628,7 +631,7 @@ public void publishPresenceStatus(PresenceStatus status,
MainBosService bosService
= icqProvider.getAimConnection().getBosService();
- bosService.sendSnac(new SetExtraInfoCmd(icqStatus));
+ bosService.getOscarConnection().sendSnac(new SetExtraInfoCmd(icqStatus));
bosService.setStatusMessage(statusMessage);
//so that everyone sees the change.
@@ -810,35 +813,10 @@ public void setAuthorizationHandler(AuthorizationHandler handler)
* provider so that there could be only one.
*
**/
- ClientSnacProcessor snacProcessor = icqProvider.getAimConnection().
- getInfoService().getOscarConnection().
- getSnacProcessor();
-
- AuthCmdFactory authCmdFactory =
- new AuthCmdFactory(icqProvider, icqProvider.getAimConnection(), handler);
-
- SsiCmdFactory ssiCmdFactory =
- new SsiCmdFactory(icqProvider, icqProvider.getAimConnection(), handler);
-
- ChannelFourCmdFactory channelFourFactory =
- ((OperationSetBasicInstantMessagingIcqImpl)
- icqProvider.getSupportedOperationSets()
- .get(OperationSetBasicInstantMessaging.class.getName())).
- getChannelFourFactory();
-
- channelFourFactory.addCommandHandler(
- IcbmChannelFourCommand.MTYPE_AUTHREQ, authCmdFactory);
- channelFourFactory.addCommandHandler(
- IcbmChannelFourCommand.MTYPE_AUTHDENY, authCmdFactory);
- channelFourFactory.addCommandHandler(
- IcbmChannelFourCommand.MTYPE_AUTHOK, authCmdFactory);
-
- snacProcessor.addGlobalResponseListener(authCmdFactory);
- snacProcessor.getCmdFactoryMgr().getDefaultFactoryList().
- registerAll(ssiCmdFactory);
-
- // incoming future authorization commands
- // facList.registerAll(new AuthFutureCmdFactory());
+ this.authorizationHandler = handler;
+
+ icqProvider.getAimConnection().getSsiService().
+ addBuddyAuthorizationListener(authListener);
}
/**
@@ -1491,6 +1469,92 @@ public void receivedStatusUpdate(BuddyInfoManager manager,
}
}
-}
+ private class AuthListener
+ implements BuddyAuthorizationListener
+ {
+ public void authorizationDenied(Screenname screenname, String reason)
+ {
+ logger.trace("authorizationDenied from " + screenname);
+ Contact srcContact = findContactByID(screenname.getFormatted());
+
+ authorizationHandler.processAuthorizationResponse(
+ new AuthorizationResponse(AuthorizationResponse.REJECT, reason),
+ srcContact);
+ }
+
+ public void authorizationAccepted(Screenname screenname, String reason)
+ {
+ logger.trace("authorizationAccepted from " + screenname);
+ Contact srcContact = findContactByID(screenname.getFormatted());
+
+ authorizationHandler.processAuthorizationResponse(
+ new AuthorizationResponse(AuthorizationResponse.REJECT, reason),
+ srcContact);
+ }
+
+ public void authorizationRequestReceived(Screenname screenname,
+ String reason)
+ {
+ logger.trace("authorizationRequestReceived from " + screenname);
+ Contact srcContact = findContactByID(screenname.getFormatted());
+
+ if(srcContact == null)
+ srcContact = createVolatileContact(screenname.getFormatted());
+
+ AuthorizationRequest authRequest = new AuthorizationRequest();
+ authRequest.setReason(reason);
+
+ AuthorizationResponse authResponse =
+ authorizationHandler.processAuthorisationRequest(
+ authRequest, srcContact);
+
+
+ if (authResponse.getResponseCode() == AuthorizationResponse.IGNORE)
+ return;
+ icqProvider.getAimConnection().getSsiService().
+ replyBuddyAuthorization(
+ screenname,
+ authResponse.getResponseCode() == AuthorizationResponse.ACCEPT,
+ authResponse.getReason());
+ }
+
+ public boolean authorizationRequired(Screenname screenname)
+ {
+ logger.trace("authorizationRequired from " + screenname);
+
+ logger.trace("finding buddy : " + screenname);
+ Contact srcContact = findContactByID(screenname.getFormatted());
+
+ if(srcContact == null)
+ srcContact = createVolatileContact(screenname.getFormatted());
+
+ AuthorizationRequest authRequest =
+ authorizationHandler.createAuthorizationRequest(
+ srcContact);
+
+ if(authRequest == null)
+ return false;
+
+ icqProvider.getAimConnection().getSsiService().
+ sendFutureBuddyAuthorization(screenname, authRequest.getReason());
+
+ icqProvider.getAimConnection().getSsiService().
+ requestBuddyAuthorization(screenname, authRequest.getReason());
+
+ return true;
+ }
+
+ public void futureAuthorizationGranted(Screenname screenname,
+ String reason)
+ {
+ logger.trace("futureAuthorizationGranted from " + screenname);
+ }
+
+ public void youWereAdded(Screenname screenname)
+ {
+ logger.trace("youWereAdded from " + screenname);
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java
index 6e09d266d..7055f622d 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java
@@ -1,3 +1,5 @@
+
+
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
@@ -8,11 +10,13 @@
import java.util.*;
-import net.java.sip.communicator.impl.protocol.icq.message.usrinfo.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.*;
import net.java.sip.communicator.util.*;
import net.kano.joscar.snac.*;
+import net.kano.joscar.snaccmd.icq.*;
+import net.kano.joscar.*;
+import java.io.*;
/**
* @author Damian Minkov
@@ -31,6 +35,52 @@ public class OperationSetServerStoredAccountInfoIcqImpl
*/
private ProtocolProviderServiceIcqImpl icqProvider = null;
+// public static final IcqType CMD_SET_FULLINFO = new IcqType(0x07D0, 0x0c3a);
+
+ private int reqID = 0;
+
+ // the value is int[]
+ // int[0] - the max count of this detail
+ // the Tlv type for this detail
+ public static Hashtable supportedTypes = new Hashtable();
+ static {
+ supportedTypes.put(ServerStoredDetails.CountryDetail.class, new int[]{1, 0x01A4});
+ supportedTypes.put(ServerStoredDetails.NicknameDetail.class, new int[]{1, 0x0154});
+ supportedTypes.put(ServerStoredDetails.FirstNameDetail.class, new int[]{1, 0x0140});
+ supportedTypes.put(ServerStoredDetails.LastNameDetail.class, new int[]{1, 0x014A});
+ supportedTypes.put(ServerStoredDetails.EmailAddressDetail.class, new int[]{5, 0x015E});
+ supportedTypes.put(ServerStoredDetails.CityDetail.class, new int[]{1, 0x0190});
+ supportedTypes.put(ServerStoredDetails.ProvinceDetail.class, new int[]{1, 0x019A});
+ supportedTypes.put(ServerStoredDetails.PhoneNumberDetail.class, new int[]{1, 0x0276});
+ supportedTypes.put(ServerStoredDetails.FaxDetail.class, new int[]{1, 0x0280});
+ supportedTypes.put(ServerStoredDetails.AddressDetail.class, new int[]{1, 0x0262});
+ supportedTypes.put(ServerStoredDetails.MobilePhoneDetail.class, new int[]{1, 0x028A});
+ supportedTypes.put(ServerStoredDetails.PostalCodeDetail.class, new int[]{1, 0x026C});
+ supportedTypes.put(ServerStoredDetails.GenderDetail.class, new int[]{1, 0x017C});
+ supportedTypes.put(ServerStoredDetails.WebPageDetail.class, new int[]{1, 0x0213});
+ supportedTypes.put(ServerStoredDetails.BirthDateDetail.class, new int[]{1, 0x023A});
+ supportedTypes.put(ServerStoredDetails.SpokenLanguageDetail.class, new int[]{3, 0x0186});
+ supportedTypes.put(OriginCityDetail.class, new int[]{1, 0x0320});
+ supportedTypes.put(OriginProvinceDetail.class, new int[]{1, 0x032A});
+ supportedTypes.put(OriginCountryDetail.class, new int[]{1, 0x0334});
+ supportedTypes.put(ServerStoredDetails.WorkCityDetail.class, new int[]{1, 0x029E});
+ supportedTypes.put(ServerStoredDetails.WorkProvinceDetail.class, new int[]{1, 0x02A8});
+ supportedTypes.put(ServerStoredDetails.WorkPhoneDetail.class, new int[]{1, 0x02C6});
+ supportedTypes.put(WorkFaxDetail.class, new int[]{1, 0x02D0});
+ supportedTypes.put(ServerStoredDetails.WorkAddressDetail.class, new int[]{1, 0x0294});
+ supportedTypes.put(ServerStoredDetails.WorkPostalCodeDetail.class, new int[]{1, 0x02BC});
+ supportedTypes.put(ServerStoredDetails.WorkCountryDetail.class, new int[]{1, 0x02B2});
+ supportedTypes.put(ServerStoredDetails.WorkOrganizationNameDetail.class, new int[]{1, 0x01AE});
+ supportedTypes.put(WorkDepartmentNameDetail.class, new int[]{1, 0x01B8});
+ supportedTypes.put(WorkPositionNameDetail.class, new int[]{1, 0x01C2});
+ supportedTypes.put(WorkOcupationDetail.class, new int[]{1, 0x01CC});
+ supportedTypes.put(ServerStoredDetails.WorkPageDetail.class, new int[]{1, 0x02DA});
+ supportedTypes.put(NotesDetail.class, new int[]{1, 0x0258});
+ supportedTypes.put(InterestDetail.class, new int[]{10, 0x01EA});
+ supportedTypes.put(ServerStoredDetails.TimeZoneDetail.class, new int[]{1, 0x0316});
+ }
+
+
public OperationSetServerStoredAccountInfoIcqImpl
(InfoRetreiver infoRetreiver, String uin,
@@ -91,7 +141,7 @@ public Iterator getDetailsAndDescendants(Class detailClass)
*/
public int getMaxDetailInstances(Class detailClass)
{
- return ((int[])FullInfoCmd.supportedTypes.get(detailClass))[0];
+ return ((int[])supportedTypes.get(detailClass))[0];
}
/**
@@ -103,7 +153,7 @@ public int getMaxDetailInstances(Class detailClass)
*/
public Iterator getSupportedDetailTypes()
{
- return FullInfoCmd.supportedTypes.keySet().iterator();
+ return supportedTypes.keySet().iterator();
}
/**
@@ -117,7 +167,7 @@ public Iterator getSupportedDetailTypes()
*/
public boolean isDetailClassSupported(Class detailClass)
{
- return FullInfoCmd.supportedTypes.get(detailClass) != null;
+ return supportedTypes.get(detailClass) != null;
}
/**
@@ -164,8 +214,100 @@ public void addDetail(GenericDetail detail) throws IllegalArgumentException,
alreadySetDetails.add(detail);
SuccessResponseListener responseListener = new SuccessResponseListener();
- icqProvider.getAimConnection().getInfoService().
- sendSnacRequest(new FullInfoCmd(uin, alreadySetDetails, null), responseListener);
+
+ MetaFullInfoSetCmd cmd =
+ new MetaFullInfoSetCmd(Integer.parseInt(uin), reqID++);
+
+ int typeOfDetail =
+ ((int[])supportedTypes.get(detail.getClass()))[1];
+
+ try
+ {
+ switch(typeOfDetail)
+ {
+ case 0x01A4 : cmd.setCountry(getCountryCode(((CountryDetail)detail).getLocale())); break;
+ case 0x0154 : cmd.setNickName(((StringDetail)detail).getString()); break;
+ case 0x0140 : cmd.setFirstName(((StringDetail)detail).getString()); break;
+ case 0x014A : cmd.setLastName(((StringDetail)detail).getString()); break;
+ case 0x015E : cmd.setEmail(((StringDetail)detail).getString(), false); break;
+ case 0x0190 : cmd.setHomeCity(((StringDetail)detail).getString()); break;
+ case 0x019A : cmd.setHomeState(((StringDetail)detail).getString()); break;
+ case 0x0276 : cmd.setHomePhone(((StringDetail)detail).getString()); break;
+ case 0x0280 : cmd.setHomeFax(((StringDetail)detail).getString()); break;
+ case 0x0262 : cmd.setAddress(((StringDetail)detail).getString()); break;
+ case 0x028A : cmd.setCellPhone(((StringDetail)detail).getString()); break;
+ case 0x026C : cmd.setHomeZip(((StringDetail)detail).getString()); break;
+ case 0x017C :
+ if(detail.equals(ServerStoredDetails.GenderDetail.FEMALE))
+ cmd.setGender(1);
+ else if(detail.equals(ServerStoredDetails.GenderDetail.MALE))
+ cmd.setGender(2);
+ else
+ cmd.setGender(0); break;
+ case 0x0213 : cmd.setHomePage(((StringDetail)detail).getString()); break;
+ case 0x023A : cmd.setBirthDay(((BirthDateDetail)detail).getCalendar().getTime()); break;
+ case 0x0186 :
+ int[] langs = new int[3];
+ Arrays.fill(langs, -1);
+ int count = 0;
+ Iterator i = getDetails(SpokenLanguageDetail.class);
+ while (i.hasNext())
+ {
+ Object item = (Object) i.next();
+ langs[count++] = getLanguageCode(((SpokenLanguageDetail)item).getLocale());
+ }
+ langs[count] = getLanguageCode(((SpokenLanguageDetail)detail).getLocale());
+ cmd.setLanguages(langs[0], langs[1], langs[2]);
+ break;
+ case 0x0320 : cmd.setOriginCity(((StringDetail)detail).getString()); break;
+ case 0x032A : cmd.setOriginState(((StringDetail)detail).getString()); break;
+ case 0x0334 : cmd.setOriginCountry(getCountryCode(((CountryDetail)detail).getLocale())); break;
+ case 0x029E : cmd.setWorkCity(((StringDetail)detail).getString()); break;
+ case 0x02A8 : cmd.setWorkState(((StringDetail)detail).getString()); break;
+ case 0x02C6 : cmd.setWorkPhone(((StringDetail)detail).getString()); break;
+ case 0x02D0 : cmd.setWorkFax(((StringDetail)detail).getString()); break;
+ case 0x0294 : cmd.setWorkAddress(((StringDetail)detail).getString()); break;
+ case 0x02BC : cmd.setWorkZip(((StringDetail)detail).getString()); break;
+ case 0x02B2 : cmd.setWorkCountry(getCountryCode(((CountryDetail)detail).getLocale())); break;
+ case 0x01AE : cmd.setWorkCompany(((StringDetail)detail).getString()); break;
+ case 0x01B8 : cmd.setWorkDepartment(((StringDetail)detail).getString()); break;
+ case 0x01C2 : cmd.setWorkPosition(((StringDetail)detail).getString()); break;
+ case 0x01CC :
+ cmd.setWorkOccupationCode(getOccupationCode(((StringDetail)detail).getString())); break;
+ case 0x02DA : cmd.setWorkWebPage(((StringDetail)detail).getString()); break;
+ case 0x0258 : cmd.setNotes(((StringDetail)detail).getString()); break;
+ case 0x01EA :
+ ArrayList interests = new ArrayList();
+ Iterator intIter = getDetails(InterestDetail.class);
+ while (intIter.hasNext())
+ {
+ InterestDetail item = (InterestDetail) intIter.next();
+ interests.add(item);
+ }
+ InterestDetail[] interestsArr = (InterestDetail[])interests.toArray();
+ int[] interestsCategories = new int[interestsArr.length];
+ String[] interestsStr = new String[interestsArr.length];
+ for (int k = 0; k < interestsArr.length; k++)
+ {
+ interestsStr[k] = interestsArr[k].getInterest();
+ interestsCategories[k] = getInterestCode(interestsStr[k]);
+ }
+ cmd.setInterests(interestsCategories, interestsStr);
+ break;
+ case 0x0316 :
+ int offset = ((ServerStoredDetails.TimeZoneDetail)detail).
+ getTimeZone().getRawOffset()/(60*60*1000);
+ cmd.setTimeZone(offset);
+ break;
+ }
+ }
+ catch(IOException ex)
+ {
+ throw new OperationFailedException("Cannot add Detail!",
+ OperationFailedException.NETWORK_FAILURE);
+ }
+ icqProvider.getAimConnection().getInfoService().getOscarConnection().
+ sendSnacRequest(cmd, responseListener);
responseListener.waitForEvent(5000);
@@ -220,22 +362,80 @@ public boolean removeDetail(GenericDetail detail) throws
removeValues.add(detail);
SuccessResponseListener responseListener = new SuccessResponseListener();
- icqProvider.getAimConnection().getInfoService().
- sendSnacRequest(new FullInfoCmd(uin, foundValues, removeValues), responseListener);
- responseListener.waitForEvent(5000);
+ MetaFullInfoSetCmd cmd =
+ new MetaFullInfoSetCmd(Integer.parseInt(uin), reqID++);
- if(!responseListener.success && responseListener.timeout)
- throw new OperationFailedException("Replacing Detail Failed!",
- OperationFailedException.NETWORK_FAILURE);
+ int typeOfDetail =
+ ((int[])supportedTypes.get(detail.getClass()))[1];
- if(responseListener.success)
- {
- infoRetreiver.detailsChanged(uin);
- return true;
- }
- else
- return false;
+ try
+ {
+ switch(typeOfDetail)
+ {
+ case 0x01A4 : cmd.setCountry(-1); break;
+ case 0x0154 : cmd.setNickName(null); break;
+ case 0x0140 : cmd.setFirstName(null); break;
+ case 0x014A : cmd.setLastName(null); break;
+ case 0x015E : cmd.setEmail(null, false); break;
+ case 0x0190 : cmd.setHomeCity(null); break;
+ case 0x019A : cmd.setHomeState(null); break;
+ case 0x0276 : cmd.setHomePhone(null); break;
+ case 0x0280 : cmd.setHomeFax(null); break;
+ case 0x0262 : cmd.setAddress(null); break;
+ case 0x028A : cmd.setCellPhone(null); break;
+ case 0x026C : cmd.setHomeZip(null); break;
+ case 0x017C : cmd.setGender(0);break;
+ case 0x0213 : cmd.setHomePage(null); break;
+ case 0x023A : cmd.setBirthDay(null); break;
+ case 0x0186 :
+ int[] langs = new int[3];
+ Arrays.fill(langs, -1);
+ cmd.setLanguages(langs[0], langs[1], langs[2]);
+ break;
+ case 0x0320 : cmd.setOriginCity(null); break;
+ case 0x032A : cmd.setOriginState(null); break;
+ case 0x0334 : cmd.setOriginCountry(-1); break;
+ case 0x029E : cmd.setWorkCity(null); break;
+ case 0x02A8 : cmd.setWorkState(null); break;
+ case 0x02C6 : cmd.setWorkPhone(null); break;
+ case 0x02D0 : cmd.setWorkFax(null); break;
+ case 0x0294 : cmd.setWorkAddress(null); break;
+ case 0x02BC : cmd.setWorkZip(null); break;
+ case 0x02B2 : cmd.setWorkCountry(-1); break;
+ case 0x01AE : cmd.setWorkCompany(null); break;
+ case 0x01B8 : cmd.setWorkDepartment(null); break;
+ case 0x01C2 : cmd.setWorkPosition(null); break;
+ case 0x01CC : cmd.setWorkOccupationCode(0);break;
+ case 0x02DA : cmd.setWorkWebPage(null); break;
+ case 0x0258 : cmd.setNotes(null); break;
+ case 0x01EA : cmd.setInterests(new int[]{0}, new String[]{""}); break;
+ case 0x0316 : cmd.setTimeZone(0); break;
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new OperationFailedException("Cannot add Detail!",
+ OperationFailedException.NETWORK_FAILURE);
+ }
+
+ icqProvider.getAimConnection().getInfoService().getOscarConnection().
+ sendSnacRequest(cmd, responseListener);
+
+ responseListener.waitForEvent(5000);
+
+ if (!responseListener.success && responseListener.timeout)
+ throw new OperationFailedException("Replacing Detail Failed!",
+ OperationFailedException.
+ NETWORK_FAILURE);
+
+ if (responseListener.success)
+ {
+ infoRetreiver.detailsChanged(uin);
+ return true;
+ }
+ else
+ return false;
}
/**
@@ -273,6 +473,7 @@ public boolean replaceDetail(GenericDetail currentDetailValue,
// most of the multiple details require saving at one time, like Spoken Language
// we are placing it at the right place. replacing the old one
alreadySetDetails.add(newDetailValue);
+ logger.info("ooooooooooooo found old " + item);
}
else
alreadySetDetails.add(item);
@@ -282,9 +483,151 @@ public boolean replaceDetail(GenericDetail currentDetailValue,
return false;
SuccessResponseListener responseListener = new SuccessResponseListener();
- icqProvider.getAimConnection().getInfoService().
+
+// // if toBeCleared == null. make it empty one
+// if(toBeCleared == null)
+// toBeCleared = new ArrayList();
+//
+// // fix the spoken languages must be 3
+// int lastSpokenIndex = -1;
+// int countOfLanguages = 0;
+// boolean isLanguageFound = false;
+// for(int i = 0; i < changedData.size(); i++)
+// {
+// Object item = changedData.get(i);
+// if(item instanceof ServerStoredDetails.SpokenLanguageDetail)
+// {
+// isLanguageFound = true;
+// lastSpokenIndex = i;
+// countOfLanguages++;
+// }
+// }
+//
+// if(isLanguageFound)
+// {
+// for (int i = countOfLanguages; i < 3; i++)
+// {
+// lastSpokenIndex++;
+// changedData.add(lastSpokenIndex,
+// new ServerStoredDetails.SpokenLanguageDetail(null));
+// }
+// }
+//
+// Iterator iter = changedData.iterator();
+// while(iter.hasNext())
+// {
+// ServerStoredDetails.GenericDetail item =
+// (ServerStoredDetails.GenericDetail)iter.next();
+//
+// if(toBeCleared.contains(item))
+// changeDataTlvs.add(getClearTlv(item));
+// else
+// changeDataTlvs.add(getTlvForChange(item));
+// }
+
+
+
+ MetaFullInfoSetCmd cmd =
+ new MetaFullInfoSetCmd(Integer.parseInt(uin), reqID++);
+
+ int typeOfDetail =
+ ((int[])supportedTypes.get(newDetailValue.getClass()))[1];
+
+ try
+ {
+ switch(typeOfDetail)
+ {
+ case 0x01A4 : cmd.setCountry(getCountryCode(((CountryDetail)newDetailValue).getLocale())); break;
+ case 0x0154 : cmd.setNickName(((StringDetail)newDetailValue).getString()); break;
+ case 0x0140 : cmd.setFirstName(((StringDetail)newDetailValue).getString()); break;
+ case 0x014A :
+ logger.info("ooooo replacing last name " + ((StringDetail)newDetailValue).getString());
+ cmd.setLastName(((StringDetail)newDetailValue).getString()); break;
+ case 0x015E : cmd.setEmail(((StringDetail)newDetailValue).getString(), false); break;
+ case 0x0190 : cmd.setHomeCity(((StringDetail)newDetailValue).getString()); break;
+ case 0x019A : cmd.setHomeState(((StringDetail)newDetailValue).getString()); break;
+ case 0x0276 : cmd.setHomePhone(((StringDetail)newDetailValue).getString()); break;
+ case 0x0280 : cmd.setHomeFax(((StringDetail)newDetailValue).getString()); break;
+ case 0x0262 : cmd.setAddress(((StringDetail)newDetailValue).getString()); break;
+ case 0x028A : cmd.setCellPhone(((StringDetail)newDetailValue).getString()); break;
+ case 0x026C : cmd.setHomeZip(((StringDetail)newDetailValue).getString()); break;
+ case 0x017C :
+ if(newDetailValue.equals(ServerStoredDetails.GenderDetail.FEMALE))
+ cmd.setGender(1);
+ else if(newDetailValue.equals(ServerStoredDetails.GenderDetail.MALE))
+ cmd.setGender(2);
+ else
+ cmd.setGender(0); break;
+ case 0x0213 : cmd.setHomePage(((StringDetail)newDetailValue).getString()); break;
+ case 0x023A : cmd.setBirthDay(((BirthDateDetail)newDetailValue).getCalendar().getTime()); break;
+ case 0x0186 :
+ int[] langs = new int[3];
+ Arrays.fill(langs, -1);
+ int count = 0;
+ Iterator i = getDetails(SpokenLanguageDetail.class);
+ while (i.hasNext())
+ {
+ Object item = (Object) i.next();
+ if(item.equals(currentDetailValue))
+ langs[count++] = getLanguageCode(((SpokenLanguageDetail)newDetailValue).getLocale());
+ else
+ langs[count++] = getLanguageCode(((SpokenLanguageDetail)item).getLocale());
+ }
+ cmd.setLanguages(langs[0], langs[1], langs[2]);
+ break;
+ case 0x0320 : cmd.setOriginCity(((StringDetail)newDetailValue).getString()); break;
+ case 0x032A : cmd.setOriginState(((StringDetail)newDetailValue).getString()); break;
+ case 0x0334 : cmd.setOriginCountry(getCountryCode(((CountryDetail)newDetailValue).getLocale())); break;
+ case 0x029E : cmd.setWorkCity(((StringDetail)newDetailValue).getString()); break;
+ case 0x02A8 : cmd.setWorkState(((StringDetail)newDetailValue).getString()); break;
+ case 0x02C6 : cmd.setWorkPhone(((StringDetail)newDetailValue).getString()); break;
+ case 0x02D0 : cmd.setWorkFax(((StringDetail)newDetailValue).getString()); break;
+ case 0x0294 : cmd.setWorkAddress(((StringDetail)newDetailValue).getString()); break;
+ case 0x02BC : cmd.setWorkZip(((StringDetail)newDetailValue).getString()); break;
+ case 0x02B2 : cmd.setWorkCountry(getCountryCode(((CountryDetail)newDetailValue).getLocale())); break;
+ case 0x01AE : cmd.setWorkCompany(((StringDetail)newDetailValue).getString()); break;
+ case 0x01B8 : cmd.setWorkDepartment(((StringDetail)newDetailValue).getString()); break;
+ case 0x01C2 : cmd.setWorkPosition(((StringDetail)newDetailValue).getString()); break;
+ case 0x01CC :
+ cmd.setWorkOccupationCode(getOccupationCode(((StringDetail)newDetailValue).getString())); break;
+ case 0x02DA : cmd.setWorkWebPage(((StringDetail)newDetailValue).getString()); break;
+ case 0x0258 : cmd.setNotes(((StringDetail)newDetailValue).getString()); break;
+ case 0x01EA :
+ ArrayList interests = new ArrayList();
+ Iterator intIter = getDetails(InterestDetail.class);
+ while (intIter.hasNext())
+ {
+ InterestDetail item = (InterestDetail) intIter.next();
+ if(item.equals(currentDetailValue))
+ interests.add(newDetailValue);
+ else
+ interests.add(item);
+ }
+ InterestDetail[] interestsArr = (InterestDetail[])interests.toArray();
+ int[] interestsCategories = new int[interestsArr.length];
+ String[] interestsStr = new String[interestsArr.length];
+ for (int k = 0; k < interestsArr.length; k++)
+ {
+ interestsStr[k] = interestsArr[k].getInterest();
+ interestsCategories[k] = getInterestCode(interestsStr[k]);
+ }
+ cmd.setInterests(interestsCategories, interestsStr);
+ break;
+ case 0x0316 :
+ int offset = ((ServerStoredDetails.TimeZoneDetail)newDetailValue).
+ getTimeZone().getRawOffset()/(60*60*1000);
+ cmd.setTimeZone(offset);
+ break;
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new OperationFailedException("Cannot add Detail!",
+ OperationFailedException.NETWORK_FAILURE);
+ }
+ icqProvider.getAimConnection().getInfoService().getOscarConnection().
sendSnacRequest(
- new FullInfoCmd(uin, alreadySetDetails, null), responseListener);
+ cmd, responseListener);
responseListener.waitForEvent(5000);
@@ -340,13 +683,11 @@ public void handleResponse(SnacResponseEvent evt)
if (ran)
return;
ran = true;
- if (evt.getSnacCommand() instanceof FullInfoAck)
+ if (evt.getSnacCommand() instanceof MetaFullInfoAckCmd)
{
- FullInfoAck cmd = (FullInfoAck) evt.getSnacCommand();
+ MetaFullInfoAckCmd cmd = (MetaFullInfoAckCmd) evt.getSnacCommand();
if (cmd.isCommandSuccesful())
- {
success = true;
- }
}
waitingForResponseLock.notifyAll();
}
@@ -370,4 +711,1069 @@ public void waitForEvent(int milliseconds)
}
}
}
+
+ /**
+ * Our format data
+ */
+ /**
+ * Returns the Locale corresponding the index coming from icq server
+ *
+ * @param code int
+ * @return Locale
+ */
+ static Locale getCountry(int code)
+ {
+ if (code == 0 || code == 9999) // not specified or other
+ return null;
+
+ String cryStr = (String) countryIndexToLocaleString.get(new Integer(
+ code));
+
+ // if no such country
+ if (cryStr == null)
+ return null;
+
+ return new Locale("", cryStr);
+ }
+
+ /**
+ * Returns the index stored on the server corresponding the given locale
+ * @param cLocale Locale
+ * @return int
+ */
+ static int getCountryCode(Locale cLocale)
+ {
+ if (cLocale == null)
+ return 0; // not specified
+
+ Iterator iter = countryIndexToLocaleString.keySet().iterator();
+ while (iter.hasNext())
+ {
+ Integer key = (Integer) iter.next();
+
+ String countryString = ( (String) countryIndexToLocaleString.get(
+ key)).toUpperCase();
+ if (countryString.equals(cLocale.getCountry()))
+ return key.intValue();
+ }
+
+ return 0; // not specified
+ }
+
+ /**
+ * Returns the Locale corresponding the index coming from icq server
+ * @param code int
+ * @return Locale
+ */
+ static Locale getSpokenLanguage(int code)
+ {
+ if (code == 0 || code == 255) // not specified or other
+ return null;
+
+ return spokenLanguages[code];
+ }
+ /**
+ * Returns the index stored on the server corresponding the given locale
+ * @param locale Locale
+ * @return int
+ */
+ static int getLanguageCode(Locale locale)
+ {
+ for (int i = 1; i < spokenLanguages.length; i++)
+ {
+ if (spokenLanguages[i].equals(locale))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * @param occupationStr String
+ * @return int
+ */
+ static int getOccupationCode(String occupationStr)
+ {
+ for(int i = 0; i < occupations.length; i++)
+ {
+ if(occupations[i].equals(occupationStr))
+ return i;
+ }
+ return 0;
+ }
+
+ /**
+ * @param value String
+ * @return int
+ */
+ static int getInterestCode(String value)
+ {
+ for (int i = 0; i < occupations.length; i++)
+ {
+ if (occupations[i].equals(value))
+ return i;
+ }
+ return 0;
+ }
+
+
+ /**
+ * Origin City of user
+ */
+ public static class OriginCityDetail
+ extends ServerStoredDetails.CityDetail
+ {
+ public OriginCityDetail(String cityName)
+ {
+ super(cityName);
+ }
+ }
+
+ /**
+ * Origin Province of User
+ */
+ public static class OriginProvinceDetail
+ extends ServerStoredDetails.ProvinceDetail
+ {
+ public OriginProvinceDetail(String workProvince)
+ {
+ super(workProvince);
+ }
+ }
+
+ /**
+ * Origin Postal Code of user
+ */
+ public static class OriginPostalCodeDetail
+ extends ServerStoredDetails.PostalCodeDetail
+ {
+ public OriginPostalCodeDetail(String postalCode)
+ {
+ super(postalCode);
+ }
+ }
+
+ /**
+ * Fax at work
+ */
+ public static class WorkFaxDetail
+ extends ServerStoredDetails.PhoneNumberDetail
+ {
+ public WorkFaxDetail(String number)
+ {
+ super(number);
+ super.detailDisplayName = "WorkFax";
+ }
+ }
+
+ /**
+ * Work department
+ */
+ public static class WorkDepartmentNameDetail
+ extends ServerStoredDetails.NameDetail
+ {
+ public WorkDepartmentNameDetail(String workDepartmentName)
+ {
+ super("Work Department Name", workDepartmentName);
+ }
+ }
+
+ /**
+ * User position name at work
+ */
+ public static class WorkPositionNameDetail
+ extends ServerStoredDetails.StringDetail
+ {
+ public WorkPositionNameDetail(String workPos)
+ {
+ super("Work Position", workPos);
+ }
+ }
+
+ /**
+ * User ocupation at work
+ */
+ public static class WorkOcupationDetail
+ extends ServerStoredDetails.StringDetail
+ {
+ public WorkOcupationDetail(String value)
+ {
+ super("Work Ocupation", value);
+ }
+ }
+
+ /**
+ * User notes
+ */
+ public static class NotesDetail
+ extends ServerStoredDetails.StringDetail
+ {
+ public NotesDetail(String value)
+ {
+ super("Notes", value);
+ }
+ }
+
+ /**
+ * User interests
+ */
+ public static class InterestDetail
+ extends ServerStoredDetails.InterestDetail
+ {
+ private String category = null;
+
+ public InterestDetail(String value, String category)
+ {
+ super(value);
+ this.category = category;
+ }
+
+ public String getCategory()
+ {
+ return category;
+ }
+ }
+
+ /**
+ * Origin country Code of user
+ */
+ public static class OriginCountryDetail
+ extends ServerStoredDetails.CountryDetail
+ {
+ public OriginCountryDetail(Locale locale)
+ {
+ super(locale);
+ }
+ }
+
+// String corresponding to type indexes
+ static ServerStoredDetails.GenderDetail[] genders =
+ new ServerStoredDetails.GenderDetail[]
+ {
+ null,
+ ServerStoredDetails.GenderDetail.FEMALE,
+ ServerStoredDetails.GenderDetail.MALE
+ };
+
+// this can be more simple
+// just to init the strings in the sppec indexes
+ private static Locale spokenLanguages[] =
+ new Locale[]
+ {
+ null, // not specified
+ new Locale("ar"), // Arabic
+ new Locale("bh"), // LC_BHOJPURI Bhojpuri
+ new Locale("bg"), // LC_BULGARIAN Bulgarian
+ new Locale("my"), // LC_BURMESE Burmese
+ new Locale("zh", "hk"), // LC_CONTONESE Cantonese official in Hong Kong SAR and Macau SAR
+ new Locale("ca"), // LC_CATALAN Catalan
+ Locale.CHINA, // LC_CHINESE Chinese zh
+ new Locale("hr"), // LC_CROATIAN Croatian
+ new Locale("cs"), // LC_CZECH Czech
+ new Locale("da"), // LC_DANISH Danish
+ new Locale("nl"), // LC_DUTCH Dutch
+ new Locale("en"), // LC_ENGLISH English
+ new Locale("eo"), // LC_ESPERANTO Esperanto
+ new Locale("et"), // LC_ESTONIAN Estonian
+ new Locale("fa"), // LC_FARSI Farsi
+ new Locale("fi"), // LC_FINNISH Finnish
+ new Locale("fr"), // LC_FRENCH French
+ new Locale("gd"), // LC_GAELIC Gaelic
+ new Locale("de"), // LC_GERMAN German
+ new Locale("el"), // LC_GREEK Greek
+ new Locale("he"), // LC_HEBREW Hebrew
+ new Locale("hi"), // LC_HINDI Hindi
+ new Locale("hu"), // LC_HUNGARIAN Hungarian
+ new Locale("is"), // LC_ICELANDIC Icelandic
+ new Locale("id"), // LC_INDONESIAN Indonesian
+ new Locale("it"), // LC_ITALIAN Italian
+ new Locale("ja"), // LC_JAPANESE Japanese
+ new Locale("km"), // LC_KHMER Khmer
+ new Locale("ko"), // LC_KOREAN Korean
+ new Locale("lo"), // LC_LAO Lao
+ new Locale("lv"), // LC_LATVIAN Latvian
+ new Locale("lt"), // LC_LITHUANIAN Lithuanian
+ new Locale("ms"), // LC_MALAY Malay
+ new Locale("no"), // LC_NORWEGIAN Norwegian
+ new Locale("pl"), // LC_POLISH Polish
+ new Locale("pt"), // LC_PORTUGUESE Portuguese
+ new Locale("ro"), // LC_ROMANIAN Romanian
+ new Locale("ru"), // LC_RUSSIAN Russian
+ new Locale("sr"), // LC_SERBIAN Serbian
+ new Locale("sk"), // LC_SLOVAK Slovak
+ new Locale("sl"), // LC_SLOVENIAN Slovenian
+ new Locale("so"), // LC_SOMALI Somali
+ new Locale("es"), // LC_SPANISH Spanish
+ new Locale("sw"), // LC_SWAHILI Swahili
+ new Locale("sv"), // LC_SWEDISH Swedish
+ new Locale("tl"), // LC_TAGALOG Tagalog
+ new Locale("tt"), // LC_TATAR Tatar
+ new Locale("th"), // LC_THAI Thau
+ new Locale("tr"), // LC_TURKISH Turkish
+ new Locale("uk"), // LC_UKRAINIAN Ukarinian
+ new Locale("ur"), // LC_URDU Urdu
+ new Locale("vi"), // LC_VIETNAMESE Vietnamese
+ new Locale("yi"), // LC_YIDDISH Yiddish
+ new Locale("yo"), // LC_YORUBA Yoruba
+ new Locale("af"), // LC_AFRIKAANS Afriaans
+ new Locale("bs"), // LC_BOSNIAN Bosnian
+ new Locale("fa"), // LC_PERSIAN Persian
+ new Locale("sq"), // LC_ALBANIAN Albanian
+ new Locale("hy"), // LC_ARMENIAN Armenian
+ new Locale("pa"), // LC_PUNJABI Punjabi
+ new Locale("ch"), // LC_CHAMORRO Chamorro
+ new Locale("mn"), // LC_MONGOLIAN Mongolian
+ new Locale("zh"), // LC_MANDARIN Mandarin ???
+ Locale.TAIWAN, // LC_TAIWANESE Taiwanese ??? zh
+ new Locale("mk"), // LC_MACEDONIAN Macedonian
+ new Locale("sd"), // LC_SINDHI Sindhi
+ new Locale("cy"), // LC_WELSH Welsh
+ new Locale("az"), // LC_AZERBAIJANI Azerbaijani
+ new Locale("ku"), // LC_KURDISH Kurdish
+ new Locale("gu"), // LC_GUJARATI Gujarati
+ new Locale("ta"), // LC_TAMIL Tamil
+ new Locale("be"), // LC_BELORUSSIAN Belorussian
+ null // LC_OTHER 255 other
+ };
+
+ static String[] occupations = new String[]
+ {
+ "not specified",
+ "academic",
+ "administrative",
+ "art/entertainment",
+ "college student",
+ "computers",
+ "community & social",
+ "education",
+ "engineering",
+ "financial services",
+ "government",
+ "high school student",
+ "home",
+ "ICQ - providing help",
+ "law",
+ "managerial",
+ "manufacturing",
+ "medical/health",
+ "military",
+ "non-government organization",
+ "professional",
+ "retail",
+ "retired",
+ "science & research",
+ "sports",
+ "technical",
+ "university student",
+ "web building",
+ "other services"
+ };
+
+ static String[] interestsCategories = new String[]
+ {
+ "not specified",
+ "art",
+ "cars",
+ "celebrity fans",
+ "collections",
+ "computers",
+ "culture",
+ "fitness",
+ "games",
+ "hobbies",
+ "ICQ - help",
+ "internet",
+ "lifestyle",
+ "movies",
+ "music",
+ "outdoors",
+ "parenting",
+ "pets and animals",
+ "religion",
+ "science",
+ "skills",
+ "sports",
+ "web design",
+ "ecology",
+ "news and media",
+ "government",
+ "business",
+ "mystics",
+ "travel",
+ "astronomy",
+ "space",
+ "clothing",
+ "parties",
+ "women",
+ "social science",
+ "60's",
+ "70's",
+ "40's",
+ "50's",
+ "finance and corporate",
+ "entertainment",
+ "consumer electronics",
+ "retail stores",
+ "health and beauty",
+ "media",
+ "household products",
+ "mail order catalogue",
+ "business services",
+ "audio and visual",
+ "sporting and athletic",
+ "publishing",
+ "home automation"
+ };
+
+// Hashtable holding the country index
+// corresponding to the country locale string
+ private static Hashtable countryIndexToLocaleString = new Hashtable();
+ static
+ {
+// countryIndexToLocaleString.put(new Integer(0),""); //not specified
+ countryIndexToLocaleString.put(new Integer(1), "us"); //USA
+ countryIndexToLocaleString.put(new Integer(101), "ai"); //Anguilla
+ countryIndexToLocaleString.put(new Integer(102), "ag"); //Antigua
+ countryIndexToLocaleString.put(new Integer(1021), "ag"); //Antigua & Barbuda
+ countryIndexToLocaleString.put(new Integer(103), "bs"); //Bahamas
+ countryIndexToLocaleString.put(new Integer(104), "bb"); //Barbados
+ countryIndexToLocaleString.put(new Integer(105), "bm"); //Bermuda
+ countryIndexToLocaleString.put(new Integer(106), "vg"); //British Virgin Islands
+ countryIndexToLocaleString.put(new Integer(107), "ca"); //Canada
+ countryIndexToLocaleString.put(new Integer(108), "ky"); //Cayman Islands
+ countryIndexToLocaleString.put(new Integer(109), "dm"); //Dominica
+ countryIndexToLocaleString.put(new Integer(110), "do"); //Dominican Republic
+ countryIndexToLocaleString.put(new Integer(111), "gd"); //Grenada
+ countryIndexToLocaleString.put(new Integer(112), "jm"); //Jamaica
+ countryIndexToLocaleString.put(new Integer(113), "ms"); //Montserrat
+ countryIndexToLocaleString.put(new Integer(114), "kn"); //Nevis
+ countryIndexToLocaleString.put(new Integer(1141), "kn"); //Saint Kitts and Nevis
+ countryIndexToLocaleString.put(new Integer(115), "kn"); //St. Kitts
+ countryIndexToLocaleString.put(new Integer(116), "vc"); //St. Vincent & the Grenadines
+ countryIndexToLocaleString.put(new Integer(117), "tt"); //Trinidad & Tobago
+ countryIndexToLocaleString.put(new Integer(118), "tc"); //Turks & Caicos Islands
+ countryIndexToLocaleString.put(new Integer(120), "ag"); //Barbuda
+ countryIndexToLocaleString.put(new Integer(121), "pr"); //Puerto Rico
+ countryIndexToLocaleString.put(new Integer(122), "lc"); //Saint Lucia
+ countryIndexToLocaleString.put(new Integer(123), "vi"); //Virgin Islands (USA)
+ countryIndexToLocaleString.put(new Integer(178), "es"); //Canary Islands ???
+ countryIndexToLocaleString.put(new Integer(20), "eg"); //Egypt
+ countryIndexToLocaleString.put(new Integer(212), "ma"); //Morocco
+ countryIndexToLocaleString.put(new Integer(213), "dz"); //Algeria
+ countryIndexToLocaleString.put(new Integer(216), "tn"); //Tunisia
+ countryIndexToLocaleString.put(new Integer(218), "ly"); //Libyan Arab Jamahiriya
+ countryIndexToLocaleString.put(new Integer(220), "gm"); //Gambia
+ countryIndexToLocaleString.put(new Integer(221), "sn"); //Senegal
+ countryIndexToLocaleString.put(new Integer(222), "mr"); //Mauritania
+ countryIndexToLocaleString.put(new Integer(223), "ml"); //Mali
+ countryIndexToLocaleString.put(new Integer(224), "pg"); //Guinea
+ countryIndexToLocaleString.put(new Integer(225), "ci"); //Cote d'Ivoire
+ countryIndexToLocaleString.put(new Integer(226), "bf"); //Burkina Faso
+ countryIndexToLocaleString.put(new Integer(227), "ne"); //Niger
+ countryIndexToLocaleString.put(new Integer(228), "tg"); //Togo
+ countryIndexToLocaleString.put(new Integer(229), "bj"); //Benin
+ countryIndexToLocaleString.put(new Integer(230), "mu"); //Mauritius
+ countryIndexToLocaleString.put(new Integer(231), "lr"); //Liberia
+ countryIndexToLocaleString.put(new Integer(232), "sl"); //Sierra Leone
+ countryIndexToLocaleString.put(new Integer(233), "gh"); //Ghana
+ countryIndexToLocaleString.put(new Integer(234), "ng"); //Nigeria
+ countryIndexToLocaleString.put(new Integer(235), "td"); //Chad
+ countryIndexToLocaleString.put(new Integer(236), "cf"); //Central African Republic
+ countryIndexToLocaleString.put(new Integer(237), "cm"); //Cameroon
+ countryIndexToLocaleString.put(new Integer(238), "cv"); //Cape Verde Islands
+ countryIndexToLocaleString.put(new Integer(239), "st"); //Sao Tome & Principe
+ countryIndexToLocaleString.put(new Integer(240), "gq"); //Equatorial Guinea
+ countryIndexToLocaleString.put(new Integer(241), "ga"); //Gabon
+ countryIndexToLocaleString.put(new Integer(242), "cg"); //Congo, (Rep. of the)
+ countryIndexToLocaleString.put(new Integer(243), "cd"); //Congo, Democratic Republic of
+ countryIndexToLocaleString.put(new Integer(244), "ao"); //Angola
+ countryIndexToLocaleString.put(new Integer(245), "gw"); //Guinea-Bissau
+// countryIndexToLocaleString.put(new Integer(246),""); //Diego Garcia ???
+// countryIndexToLocaleString.put(new Integer(247),""); //Ascension Island ???
+ countryIndexToLocaleString.put(new Integer(248), "sc"); //Seychelles
+ countryIndexToLocaleString.put(new Integer(249), "sd"); //Sudan
+ countryIndexToLocaleString.put(new Integer(250), "rw"); //Rwanda
+ countryIndexToLocaleString.put(new Integer(251), "et"); //Ethiopia
+ countryIndexToLocaleString.put(new Integer(252), "so"); //Somalia
+ countryIndexToLocaleString.put(new Integer(253), "dj"); //Djibouti
+ countryIndexToLocaleString.put(new Integer(254), "ke"); //Kenya
+ countryIndexToLocaleString.put(new Integer(255), "tz"); //Tanzania
+ countryIndexToLocaleString.put(new Integer(256), "ug"); //Uganda
+ countryIndexToLocaleString.put(new Integer(257), "bi"); //Burundi
+ countryIndexToLocaleString.put(new Integer(258), "mz"); //Mozambique
+ countryIndexToLocaleString.put(new Integer(260), "zm"); //Zambia
+ countryIndexToLocaleString.put(new Integer(261), "mg"); //Madagascar
+// countryIndexToLocaleString.put(new Integer(262),""); //Reunion Island ???
+ countryIndexToLocaleString.put(new Integer(263), "zw"); //Zimbabwe
+ countryIndexToLocaleString.put(new Integer(264), "na"); //Namibia
+ countryIndexToLocaleString.put(new Integer(265), "mw"); //Malawi
+ countryIndexToLocaleString.put(new Integer(266), "ls"); //Lesotho
+ countryIndexToLocaleString.put(new Integer(267), "bw"); //Botswana
+ countryIndexToLocaleString.put(new Integer(268), "sz"); //Swaziland
+ countryIndexToLocaleString.put(new Integer(269), "yt"); //Mayotte Island
+ countryIndexToLocaleString.put(new Integer(2691), "km"); //Comoros
+ countryIndexToLocaleString.put(new Integer(27), "za"); //South Africa
+ countryIndexToLocaleString.put(new Integer(290), "sh"); //St. Helena
+ countryIndexToLocaleString.put(new Integer(291), "er"); //Eritrea
+ countryIndexToLocaleString.put(new Integer(297), "aw"); //Aruba
+// countryIndexToLocaleString.put(new Integer(298),""); //Faeroe Islands ???
+ countryIndexToLocaleString.put(new Integer(299), "gl"); //Greenland
+ countryIndexToLocaleString.put(new Integer(30), "gr"); //Greece
+ countryIndexToLocaleString.put(new Integer(31), "nl"); //Netherlands
+ countryIndexToLocaleString.put(new Integer(32), "be"); //Belgium
+ countryIndexToLocaleString.put(new Integer(33), "fr"); //France
+ countryIndexToLocaleString.put(new Integer(34), "es"); //Spain
+ countryIndexToLocaleString.put(new Integer(350), "gi"); //Gibraltar
+ countryIndexToLocaleString.put(new Integer(351), "pt"); //Portugal
+ countryIndexToLocaleString.put(new Integer(352), "lu"); //Luxembourg
+ countryIndexToLocaleString.put(new Integer(353), "ie"); //Ireland
+ countryIndexToLocaleString.put(new Integer(354), "is"); //Iceland
+ countryIndexToLocaleString.put(new Integer(355), "al"); //Albania
+ countryIndexToLocaleString.put(new Integer(356), "mt"); //Malta
+ countryIndexToLocaleString.put(new Integer(357), "cy"); //Cyprus
+ countryIndexToLocaleString.put(new Integer(358), "fi"); //Finland
+ countryIndexToLocaleString.put(new Integer(359), "bg"); //Bulgaria
+ countryIndexToLocaleString.put(new Integer(36), "hu"); //Hungary
+ countryIndexToLocaleString.put(new Integer(370), "lt"); //Lithuania
+ countryIndexToLocaleString.put(new Integer(371), "lv"); //Latvia
+ countryIndexToLocaleString.put(new Integer(372), "ee"); //Estonia
+ countryIndexToLocaleString.put(new Integer(373), "md"); //Moldova, Republic of
+ countryIndexToLocaleString.put(new Integer(374), "am"); //Armenia
+ countryIndexToLocaleString.put(new Integer(375), "by"); //Belarus
+ countryIndexToLocaleString.put(new Integer(376), "ad"); //Andorra
+ countryIndexToLocaleString.put(new Integer(377), "mc"); //Monaco
+ countryIndexToLocaleString.put(new Integer(378), "sm"); //San Marino
+ countryIndexToLocaleString.put(new Integer(379), "va"); //Vatican City
+ countryIndexToLocaleString.put(new Integer(380), "ua"); //Ukraine
+// countryIndexToLocaleString.put(new Integer(381),""); //Yugoslavia ???
+ countryIndexToLocaleString.put(new Integer(3811), "cs"); //Yugoslavia - Serbia
+ countryIndexToLocaleString.put(new Integer(382), "cs"); //Yugoslavia - Montenegro
+ countryIndexToLocaleString.put(new Integer(385), "hr"); //Croatia
+ countryIndexToLocaleString.put(new Integer(386), "si"); //Slovenia
+ countryIndexToLocaleString.put(new Integer(387), "ba"); //Bosnia & Herzegovina
+ countryIndexToLocaleString.put(new Integer(389), "mk"); //Macedonia (F.Y.R.O.M.)
+ countryIndexToLocaleString.put(new Integer(39), "it"); //Italy
+ countryIndexToLocaleString.put(new Integer(40), "ro"); //Romania
+ countryIndexToLocaleString.put(new Integer(41), "ch"); //Switzerland
+ countryIndexToLocaleString.put(new Integer(4101), "li"); //Liechtenstein
+ countryIndexToLocaleString.put(new Integer(42), "cz"); //Czech Republic
+ countryIndexToLocaleString.put(new Integer(4201), "sk"); //Slovakia
+ countryIndexToLocaleString.put(new Integer(43), "at"); //Austria
+ countryIndexToLocaleString.put(new Integer(44), "gb"); //United Kingdom
+// countryIndexToLocaleString.put(new Integer(441),""); //Wales ???
+// countryIndexToLocaleString.put(new Integer(442),""); //Scotland ???
+ countryIndexToLocaleString.put(new Integer(45), "dk"); //Denmark
+ countryIndexToLocaleString.put(new Integer(46), "se"); //Sweden
+ countryIndexToLocaleString.put(new Integer(47), "no"); //Norway
+ countryIndexToLocaleString.put(new Integer(48), "pl"); //Poland
+ countryIndexToLocaleString.put(new Integer(49), "de"); //Germany
+// countryIndexToLocaleString.put(new Integer(500),""); //Falkland Islands ???
+ countryIndexToLocaleString.put(new Integer(501), "bz"); //Belize
+ countryIndexToLocaleString.put(new Integer(502), "gt"); //Guatemala
+ countryIndexToLocaleString.put(new Integer(503), "sv"); //El Salvador
+ countryIndexToLocaleString.put(new Integer(504), "hn"); //Honduras
+ countryIndexToLocaleString.put(new Integer(505), "ni"); //Nicaragua
+ countryIndexToLocaleString.put(new Integer(506), "cr"); //Costa Rica
+ countryIndexToLocaleString.put(new Integer(507), "pa"); //Panama
+ countryIndexToLocaleString.put(new Integer(508), "pm"); //St. Pierre & Miquelon
+ countryIndexToLocaleString.put(new Integer(509), "ht"); //Haiti
+ countryIndexToLocaleString.put(new Integer(51), "pe"); //Peru
+ countryIndexToLocaleString.put(new Integer(52), "mx"); //Mexico
+ countryIndexToLocaleString.put(new Integer(53), "cu"); //Cuba
+ countryIndexToLocaleString.put(new Integer(54), "ar"); //Argentina
+ countryIndexToLocaleString.put(new Integer(55), "br"); //Brazil
+ countryIndexToLocaleString.put(new Integer(56), "cl"); //Chile, Republic of
+ countryIndexToLocaleString.put(new Integer(57), "co"); //Colombia
+ countryIndexToLocaleString.put(new Integer(58), "ve"); //Venezuela
+ countryIndexToLocaleString.put(new Integer(590), "gp"); //Guadeloupe
+ countryIndexToLocaleString.put(new Integer(5901), "an"); //French Antilles
+ countryIndexToLocaleString.put(new Integer(5902), "an"); //Antilles
+ countryIndexToLocaleString.put(new Integer(591), "bo"); //Bolivia
+ countryIndexToLocaleString.put(new Integer(592), "gy"); //Guyana
+ countryIndexToLocaleString.put(new Integer(593), "ec"); //Ecuador
+ countryIndexToLocaleString.put(new Integer(594), "gy"); //French Guyana
+ countryIndexToLocaleString.put(new Integer(595), "py"); //Paraguay
+ countryIndexToLocaleString.put(new Integer(596), "mq"); //Martinique
+ countryIndexToLocaleString.put(new Integer(597), "sr"); //Suriname
+ countryIndexToLocaleString.put(new Integer(598), "uy"); //Uruguay
+ countryIndexToLocaleString.put(new Integer(599), "an"); //Netherlands Antilles
+ countryIndexToLocaleString.put(new Integer(60), "my"); //Malaysia
+ countryIndexToLocaleString.put(new Integer(61), "au"); //Australia
+ countryIndexToLocaleString.put(new Integer(6101), "cc"); //Cocos-Keeling Islands
+ countryIndexToLocaleString.put(new Integer(6102), "cc"); //Cocos (Keeling) Islands
+ countryIndexToLocaleString.put(new Integer(62), "id"); //Indonesia
+ countryIndexToLocaleString.put(new Integer(63), "ph"); //Philippines
+ countryIndexToLocaleString.put(new Integer(64), "nz"); //New Zealand
+ countryIndexToLocaleString.put(new Integer(65), "sg"); //Singapore
+ countryIndexToLocaleString.put(new Integer(66), "th"); //Thailand
+// countryIndexToLocaleString.put(new Integer(670),""); //Saipan Island ???
+// countryIndexToLocaleString.put(new Integer(6701),""); //Rota Island ???
+// countryIndexToLocaleString.put(new Integer(6702),""); //Tinian Island ???
+ countryIndexToLocaleString.put(new Integer(671), "gu"); //Guam, US Territory of
+ countryIndexToLocaleString.put(new Integer(672), "cx"); //Christmas Island
+ countryIndexToLocaleString.put(new Integer(6722), "nf"); //Norfolk Island
+ countryIndexToLocaleString.put(new Integer(673), "bn"); //Brunei
+ countryIndexToLocaleString.put(new Integer(674), "nr"); //Nauru
+ countryIndexToLocaleString.put(new Integer(675), "pg"); //Papua New Guinea
+ countryIndexToLocaleString.put(new Integer(676), "to"); //Tonga
+ countryIndexToLocaleString.put(new Integer(677), "sb"); //Solomon Islands
+ countryIndexToLocaleString.put(new Integer(678), "vu"); //Vanuatu
+ countryIndexToLocaleString.put(new Integer(679), "fj"); //Fiji
+ countryIndexToLocaleString.put(new Integer(680), "pw"); //Palau
+ countryIndexToLocaleString.put(new Integer(681), "wf"); //Wallis & Futuna Islands
+ countryIndexToLocaleString.put(new Integer(682), "ck"); //Cook Islands
+ countryIndexToLocaleString.put(new Integer(683), "nu"); //Niue
+ countryIndexToLocaleString.put(new Integer(684), "as"); //American Samoa
+ countryIndexToLocaleString.put(new Integer(685), "ws"); //Western Samoa
+ countryIndexToLocaleString.put(new Integer(686), "ki"); //Kiribati
+ countryIndexToLocaleString.put(new Integer(687), "nc"); //New Caledonia
+ countryIndexToLocaleString.put(new Integer(688), "tv"); //Tuvalu
+ countryIndexToLocaleString.put(new Integer(689), "pf"); //French Polynesia
+ countryIndexToLocaleString.put(new Integer(690), "tk"); //Tokelau
+ countryIndexToLocaleString.put(new Integer(691), "fm"); //Micronesia, Federated States of
+ countryIndexToLocaleString.put(new Integer(692), "mh"); //Marshall Islands
+ countryIndexToLocaleString.put(new Integer(7), "ru"); //Russia
+ countryIndexToLocaleString.put(new Integer(705), "kz"); //Kazakhstan
+ countryIndexToLocaleString.put(new Integer(706), "kg"); //Kyrgyzstan
+ countryIndexToLocaleString.put(new Integer(708), "tj"); //Tajikistan
+ countryIndexToLocaleString.put(new Integer(709), "tm"); //Turkmenistan
+ countryIndexToLocaleString.put(new Integer(711), "uz"); //Uzbekistan
+ countryIndexToLocaleString.put(new Integer(81), "jp"); //Japan
+ countryIndexToLocaleString.put(new Integer(82), "kr"); //Korea, South
+ countryIndexToLocaleString.put(new Integer(84), "vn"); //Viet Nam
+ countryIndexToLocaleString.put(new Integer(850), "kp"); //Korea, North
+ countryIndexToLocaleString.put(new Integer(852), "hk"); //Hong Kong
+ countryIndexToLocaleString.put(new Integer(853), "mo"); //Macau
+ countryIndexToLocaleString.put(new Integer(855), "kh"); //Cambodia
+ countryIndexToLocaleString.put(new Integer(856), "la"); //Laos
+ countryIndexToLocaleString.put(new Integer(86), "cn"); //China
+ countryIndexToLocaleString.put(new Integer(880), "bd"); //Bangladesh
+ countryIndexToLocaleString.put(new Integer(886), "tw"); //Taiwan
+ countryIndexToLocaleString.put(new Integer(90), "tr"); //Turkey
+ countryIndexToLocaleString.put(new Integer(91), "in"); //India
+ countryIndexToLocaleString.put(new Integer(92), "pk"); //Pakistan
+ countryIndexToLocaleString.put(new Integer(93), "af"); //Afghanistan
+ countryIndexToLocaleString.put(new Integer(94), "lk"); //Sri Lanka
+ countryIndexToLocaleString.put(new Integer(95), "mm"); //Myanmar
+ countryIndexToLocaleString.put(new Integer(960), "mv"); //Maldives
+ countryIndexToLocaleString.put(new Integer(961), "lb"); //Lebanon
+ countryIndexToLocaleString.put(new Integer(962), "jo"); //Jordan
+ countryIndexToLocaleString.put(new Integer(963), "sy"); //Syrian Arab Republic
+ countryIndexToLocaleString.put(new Integer(964), "iq"); //Iraq
+ countryIndexToLocaleString.put(new Integer(965), "kw"); //Kuwait
+ countryIndexToLocaleString.put(new Integer(966), "sa"); //Saudi Arabia
+ countryIndexToLocaleString.put(new Integer(967), "ye"); //Yemen
+ countryIndexToLocaleString.put(new Integer(968), "om"); //Oman
+ countryIndexToLocaleString.put(new Integer(971), "ae"); //United Arabian Emirates
+ countryIndexToLocaleString.put(new Integer(972), "il"); //Israel
+ countryIndexToLocaleString.put(new Integer(973), "bh"); //Bahrain
+ countryIndexToLocaleString.put(new Integer(974), "qa"); //Qatar
+ countryIndexToLocaleString.put(new Integer(975), "bt"); //Bhutan
+ countryIndexToLocaleString.put(new Integer(976), "mn"); //Mongolia
+ countryIndexToLocaleString.put(new Integer(977), "np"); //Nepal
+ countryIndexToLocaleString.put(new Integer(98), "ir"); //Iran (Islamic Republic of)
+ countryIndexToLocaleString.put(new Integer(994), "az"); //Azerbaijan
+ countryIndexToLocaleString.put(new Integer(995), "ge"); //Georgia
+// countryIndexToLocaleString.put(new Integer(9999),""); //other
+ }
+
+ /**
+ *
+ */
+// private class ChangeDetailInfoCmd extends ToIcqCmd
+// {
+// // used when semding this command for changeg details stored on the server
+// private String senderUin = null;
+// private List changeDataTlvs = new LinkedList();
+//
+// /**
+// * Constructs command send to server
+// * @param senderUin String the uin of the sender
+// * @param changedData List the data to be changed
+// * @param toBeCleared List the data to be cleared,
+// * if no such data null can be passed
+// */
+// public ChangeDetailInfoCmd(String senderUin, List changedData,
+// List toBeCleared)
+// {
+// super(Long.parseLong(senderUin), CMD_SET_FULLINFO, 2);
+// this.senderUin = senderUin;
+//
+// // if toBeCleared == null. make it empty one
+// if (toBeCleared == null)
+// toBeCleared = new ArrayList();
+//
+// // fix the spoken languages must be 3
+// int lastSpokenIndex = -1;
+// int countOfLanguages = 0;
+// boolean isLanguageFound = false;
+// for (int i = 0; i < changedData.size(); i++)
+// {
+// Object item = changedData.get(i);
+// if (item instanceof ServerStoredDetails.SpokenLanguageDetail)
+// {
+// isLanguageFound = true;
+// lastSpokenIndex = i;
+// countOfLanguages++;
+// }
+// }
+//
+// if (isLanguageFound)
+// {
+// for (int i = countOfLanguages; i < 3; i++)
+// {
+// lastSpokenIndex++;
+// changedData.add(lastSpokenIndex,
+// new ServerStoredDetails.SpokenLanguageDetail(null));
+// }
+// }
+//
+// Iterator iter = changedData.iterator();
+// while (iter.hasNext())
+// {
+// ServerStoredDetails.GenericDetail item =
+// (ServerStoredDetails.GenericDetail) iter.next();
+//
+// if (toBeCleared.contains(item))
+// changeDataTlvs.add(getClearTlv(item));
+// else
+// changeDataTlvs.add(getTlvForChange(item));
+// }
+// }
+//
+// public void writeIcqData(OutputStream out)
+// throws IOException
+// {
+// // write tlvs with data here
+// Iterator iter = changeDataTlvs.iterator();
+// while (iter.hasNext())
+// {
+// DetailTlv item = (DetailTlv) iter.next();
+// item.write(out);
+// }
+//
+// }
+//
+// /**
+// * Correspondig the type of ServerStoredDetails returns empty Tlv or Tlv
+// * with default value
+// * @param detail GenericDetail
+// * @return DetailTlv
+// */
+// private DetailTlv getClearTlv(ServerStoredDetails.GenericDetail detail)
+// {
+// int typeOfDetail = ( (int[]) supportedTypes.get(detail.getClass()))[1];
+//
+// DetailTlv result = new DetailTlv( ( (int[]) supportedTypes.get(detail.
+// getClass()))[1]);
+//
+// switch (typeOfDetail)
+// {
+// case 0x01A4: //CountryDetail
+// case 0x0334: //OriginCountryDetail
+// case 0x02B2: //WorkCountryDetail
+// result.writeUShort(0);
+// break;
+//
+// case 0x0186: //SpokenLanguageDetail
+// logger.trace("write lang 0");
+// result.writeUShort(0);
+// case 0x017C: //GenderDetail
+// result.writeUByte(0);
+// case 0x023A: //BirthDateDetail
+// result.writeUShort(0);
+// result.writeUShort(0);
+// result.writeUShort(0);
+// case 0x01CC: //WorkOcupationDetail
+// result.writeUShort(0);
+// case 0x01EA: //InterestDetail
+// result.writeUShort(0);
+// result.writeString("");
+// case 0x0316:
+// result.writeUByte(0);
+// default:
+// result.writeString("");
+// }
+//
+// return result;
+// }
+//
+// /**
+// * Converts ServerStoredDetails to Tlv which later is converted to bytes
+// * and send to server
+// * @param detail GenericDetail the detail
+// * @return DetailTlv
+// */
+// private DetailTlv getTlvForChange(ServerStoredDetails.GenericDetail detail)
+// {
+// int typeOfDetail = ( (int[]) supportedTypes.get(detail.getClass()))[1];
+//
+// DetailTlv result = new DetailTlv(typeOfDetail);
+//
+// switch (typeOfDetail)
+// {
+// case 0x01A4: //CountryDetail
+// case 0x0334: //OriginCountryDetail
+// case 0x02B2: //WorkCountryDetail
+// result.writeUShort(getCountryCode( ( (ServerStoredDetails.
+// LocaleDetail) detail).getLocale()));
+// break;
+//
+// case 0x0186: //SpokenLanguageDetail
+// writeLanguageCode( (ServerStoredDetails.LocaleDetail) detail,
+// result);
+// break;
+// case 0x017C: //GenderDetail
+// writeGenderCode( (ServerStoredDetails.GenderDetail) detail,
+// result);
+// break;
+// case 0x023A: //BirthDateDetail
+// writeCalendarCode( (ServerStoredDetails.CalendarDetail) detail,
+// result);
+// break;
+// case 0x01CC: //WorkOcupationDetail
+// writeOccupationCode( (WorkOcupationDetail) detail, result);
+// break;
+// case 0x01EA: //InterestDetail
+// writeInterestCode( (InterestDetail) detail, result);
+// break;
+// default:
+// writeGenericDetail(detail, result);
+// }
+//
+// return result;
+// }
+//
+// /**
+// * Writes the corresponding index for Language from ServerStoredDetails to the tlv
+// * @param detail LocaleDetail
+// * @param tlv DetailTlv
+// */
+// private void writeLanguageCode(ServerStoredDetails.LocaleDetail detail,
+// DetailTlv tlv)
+// {
+// Locale newLang = detail.getLocale();
+// if (newLang == null)
+// {
+// // this indicates that we must set language as not specified
+// tlv.writeUShort(0);
+// logger.trace("write lang 0");
+// }
+// else
+// {
+// for (int i = 1; i < spokenLanguages.length; i++)
+// {
+// // indicating that language is not set
+// if (getSpokenLanguage(i).equals(newLang))
+// {
+// logger.trace("write lang " + i);
+// tlv.writeUShort(i);
+// return;
+// }
+// }
+// }
+// }
+//
+// /**
+// * Writes the corresponding index for Gender from ServerStoredDetails to the tlv
+// * @param detail GenderDetail
+// * @param tlv DetailTlv
+// */
+// private void writeGenderCode(ServerStoredDetails.GenderDetail detail,
+// DetailTlv tlv)
+// {
+// int gender = 0;
+//
+// if (detail.equals(ServerStoredDetails.GenderDetail.FEMALE))
+// gender = 1;
+// else if (detail.equals(ServerStoredDetails.GenderDetail.MALE))
+// gender = 2;
+//
+// tlv.writeUByte(gender);
+// }
+//
+// /**
+// * Writes the corresponding index for Calendar(BirthDate) from ServerStoredDetails to the tlv
+// * @param detail CalendarDetail
+// * @param tlv DetailTlv
+// */
+// private void writeCalendarCode(ServerStoredDetails.CalendarDetail detail,
+// DetailTlv tlv)
+// {
+// Calendar calendar = detail.getCalendar();
+//
+// tlv.writeUShort(calendar.get(Calendar.YEAR));
+// tlv.writeUShort(calendar.get(Calendar.MONTH));
+// tlv.writeUShort(calendar.get(Calendar.DAY_OF_MONTH));
+// }
+//
+// /**
+// * Writes the corresponding index for Occupation from ServerStoredDetails to the tlv
+// * @param detail WorkOcupationDetail
+// * @param tlv DetailTlv
+// */
+// private void writeOccupationCode(WorkOcupationDetail detail, DetailTlv tlv)
+// {
+// for (int i = 0; i < occupations.length; i++)
+// {
+// if (occupations[i].equals(detail.getDetailValue()))
+// tlv.writeUShort(i);
+// }
+// }
+//
+// /**
+// * Writes the corresponding index for Interests from ServerStoredDetails to the tlv
+// * @param detail InterestDetail
+// * @param tlv DetailTlv
+// */
+// private void writeInterestCode(InterestDetail detail, DetailTlv tlv)
+// {
+// String category = detail.getCategory();
+// int categoryInt = 0;
+// for (int i = 0; i < interestsCategories.length; i++)
+// {
+// if (interestsCategories[i].equals(category))
+// {
+// if (i != 0)
+// categoryInt = i + 99;
+// else
+// categoryInt = 0;
+//
+// break;
+// }
+// }
+//
+// tlv.writeUShort(categoryInt);
+// tlv.writeString(detail.getInterest());
+// }
+//
+// /**
+// * Writes the corresponding value for ServerStoredDetails to the tlv
+// * @param detail GenericDetail
+// * @param tlv DetailTlv
+// */
+// private void writeGenericDetail(ServerStoredDetails.GenericDetail detail,
+// DetailTlv tlv)
+// {
+// if (detail instanceof ServerStoredDetails.StringDetail)
+// {
+// tlv.writeString( ( (ServerStoredDetails.StringDetail) detail).
+// getString());
+// }
+// else
+// if (detail instanceof ServerStoredDetails.TimeZoneDetail)
+// {
+// int offset = ( (ServerStoredDetails.TimeZoneDetail) detail).
+// getTimeZone().getRawOffset() / (60 * 60 * 1000);
+// tlv.writeUByte(offset);
+// }
+// }
+//
+// }
+//
+// /**
+// * Tlv set in command for changis user account info stored on server
+// * @author Damian Minkov
+// */
+// public class DetailTlv
+// implements Writable
+// {
+// private byte[] data = new byte[0];
+// private int type;
+//
+// public DetailTlv(int type)
+// {
+// this.type = type;
+// }
+//
+// public void write(OutputStream out) throws IOException
+// {
+// LEBinaryTools.writeUShort(out, type);
+// LEBinaryTools.writeUShort(out, data.length);
+// out.write(data);
+// }
+//
+// public long getWritableLength()
+// {
+// return 4 + data.length;
+// }
+//
+// public void writeUInt(long number)
+// {
+// byte[] tmp = LEBinaryTools.getUInt(number);
+// byte[] newData = new byte[data.length + tmp.length];
+//
+// System.arraycopy(data, 0, newData, 0, data.length);
+// System.arraycopy(tmp, 0, newData, data.length, tmp.length);
+//
+// data = newData;
+// }
+//
+// public void writeUShort(int number)
+// {
+// byte[] tmp = LEBinaryTools.getUShort(number);
+// byte[] newData = new byte[data.length + tmp.length];
+//
+// System.arraycopy(data, 0, newData, 0, data.length);
+// System.arraycopy(tmp, 0, newData, data.length, tmp.length);
+//
+// data = newData;
+// }
+//
+// public void writeUByte(int number)
+// {
+// byte[] tmp = LEBinaryTools.getUByte(number);
+// byte[] newData = new byte[data.length + tmp.length];
+//
+// System.arraycopy(data, 0, newData, 0, data.length);
+// System.arraycopy(tmp, 0, newData, data.length, tmp.length);
+//
+// data = newData;
+// }
+//
+// public void writeString(String str)
+// {
+// if (str == null)
+// str = ""; // empty string so length will be 0 and nothing to be writen
+//
+// byte[] tmp = BinaryTools.getAsciiBytes(str);
+//
+// // save the string length before we process the string bytes
+// writeUShort(tmp.length);
+//
+// byte[] newData = new byte[data.length + tmp.length];
+//
+// System.arraycopy(data, 0, newData, 0, data.length);
+// System.arraycopy(tmp, 0, newData, data.length, tmp.length);
+//
+// data = newData;
+// }
+//
+// public String toString()
+// {
+// StringBuffer result = new StringBuffer();
+// ByteArrayOutputStream out = new ByteArrayOutputStream();
+//
+// try
+// {
+// write(out);
+// }
+// catch (IOException ex)
+// {
+// ex.printStackTrace();
+// return null;
+// }
+//
+// byte[] arrOut = out.toByteArray();
+// for (int i = 0; i < arrOut.length; i++)
+// {
+// byte temp = arrOut[i];
+// result.append(Integer.toHexString(temp & 0xFF)).append(' ');
+// }
+//
+// return result.toString();
+// }
+// }
+//
+
+
}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java
index 1cbceb29f..97a017437 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java
@@ -272,6 +272,13 @@ public void buddyInfoUpdated(IcbmService service, Screenname buddy,
logger.debug("buddyInfoUpdated for:"+buddy+" info: " +info);
}
+ public void sendAutomaticallyFailed(
+ IcbmService service,
+ net.kano.joustsim.oscar.oscar.service.icbm.Message message,
+ Set triedConversations)
+ {
+ }
+
}
/**
@@ -314,5 +321,12 @@ public void canSendMessageChanged(Conversation conv, boolean canSend){}
public void conversationOpened(Conversation conv){}
public void newConversation(IcbmService service, Conversation conv){}
public void sentMessage(Conversation conv, MessageInfo minfo){}
+
+ public void sendAutomaticallyFailed(IcbmService service,
+ net.kano.joustsim.oscar.oscar.
+ service.icbm.Message message,
+ Set triedConversations)
+ {
+ }
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java
index 5e622783a..424f47086 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java
@@ -870,13 +870,11 @@ public void buddyAdded(BuddyList list, Group joustSimGroup, List oldItems,
+ joustSimGroup + " found for buddy: " + buddy);
return;
}
-
+
if(newContact == null)
{
newContact = new ContactIcqImpl(
buddy, ServerStoredContactListIcqImpl.this, true, true);
-
- parentGroup.addContact(newContact);
}
else
{
@@ -893,6 +891,8 @@ public void buddyAdded(BuddyList list, Group joustSimGroup, List oldItems,
}
}
+ parentGroup.addContact(newContact);
+
int index = parentGroup.findContactIndex(newContact);
//register a listener for name changes of this buddy
@@ -1146,6 +1146,16 @@ public void buddyCommentChanged(Buddy buddy, String oldComment,
logger.debug("/** @todo implement buddyCommentChanged() */");
}
+ public void awaitingAuthChanged(Buddy simpleBuddy,
+ boolean oldAwaitingAuth,
+ boolean newAwaitingAuth)
+ {
+ /** @todo */
+ logger.debug("awaitingAuthChanged for " + simpleBuddy
+ + " oldAwaitingAuth: " + oldAwaitingAuth
+ + " newAwaitingAuth: " + newAwaitingAuth);
+ }
+
}
/**
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 22294d5bd..1f5a05e97 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
@@ -4,6 +4,8 @@ Bundle-Description: An ICQ/AIM implementation of the Protocol Provider Service.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Import-Package: org.osgi.framework,
+ javax.net,
+ sun.misc,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration.event,
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
index 7722e3460..c307cc5f9 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
@@ -95,6 +95,20 @@ public abstract class ProtocolProviderFactory
*/
public static final String PROXY_TYPE = "PROXY_TYPE";
+ /**
+ * The name of the property under which we store the the username for the proxy
+ * stored against the PROXY_ADDRESS property.
+ */
+ public static final String PROXY_USERNAME = "PROXY_USERNAME";
+
+ /**
+ * The name of the property under which we store the password for the proxy
+ * stored against the PROXY_ADDRESS property.
+ */
+ public static final String PROXY_PASSWORD = "PROXY_PASSWORD";
+
+
+
/**
* The name of the property under which we store the name of the transport
diff --git a/src/net/java/sip/communicator/util/ScLogFormatter.java b/src/net/java/sip/communicator/util/ScLogFormatter.java
index 5664617ac..2971c10cc 100644
--- a/src/net/java/sip/communicator/util/ScLogFormatter.java
+++ b/src/net/java/sip/communicator/util/ScLogFormatter.java
@@ -56,6 +56,10 @@ public synchronized String format(LogRecord record)
//caller method
inferCaller(record);
String loggerName = record.getLoggerName();
+
+ if(loggerName == null)
+ loggerName = record.getSourceClassName();
+
if(loggerName.startsWith("net.java.sip.communicator."))
{
sb.append(loggerName.substring("net.java.sip.communicator."
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java
index 6b1cf3840..41dc5a579 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java
@@ -431,7 +431,7 @@ public IcqStatusEnum getBuddyStatus(String screenname)
new Screenname(screenname).getFormatted());
- conn.getInfoService()
+ conn.getInfoService().getOscarConnection()
.sendSnacRequest(getInfoCmd, responseRetriever);
synchronized(responseRetriever.waitingForResponseLock)
@@ -619,7 +619,7 @@ public boolean enterStatus(long icqStatus)
//do the state switch
synchronized(bosEventNotifier.infoLock ){
- conn.getBosService().sendSnac(new SetExtraInfoCmd(icqStatus));
+ conn.getBosService().getOscarConnection().sendSnac(new SetExtraInfoCmd(icqStatus));
try{bosEventNotifier.infoLock.wait(10000);}
catch (InterruptedException ex){logger.debug("Strange!");}
@@ -1432,7 +1432,7 @@ public void handleResponse(SnacResponseEvent e)
LayoutEventCollector evtCollector = new LayoutEventCollector();
joustSimBuddyList.addLayoutListener(evtCollector);
- conn.getSsiService().sendSnac(addCMD);
+ conn.getSsiService().getOscarConnection().sendSnac(addCMD);
evtCollector.waitForANewBuddy(20000);
joustSimBuddyList.removeLayoutListener(evtCollector);
@@ -1440,7 +1440,7 @@ public void handleResponse(SnacResponseEvent e)
logger.trace("Finished - Adding buddy as awaiting authorization");
//SNAC(13,18) send authorization request
- conn.getSsiService().sendSnac(
+ conn.getSsiService().getOscarConnection().sendSnac(
new RequestAuthCmd(
uinToAskForAuth,
requestReasonStr));
@@ -1508,14 +1508,14 @@ public void setAuthorizationRequired()
FullUserInfoCmd cmd = new FullUserInfoCmd(getIcqUIN());
cmd.writeOutByte(0x030c, 0); // 0x030C User authorization permissions
cmd.writeOutByte(0x02F8, 0); // 0x02F8 User 'show web status' permissions
- conn.getSsiService().sendSnac(cmd);
+ conn.getSsiService().getOscarConnection().sendSnac(cmd);
}
public Hashtable getUserInfo(String uin)
{
UserInfoResponse response = new UserInfoResponse();
- conn.getInfoService().sendSnacRequest(
+ conn.getInfoService().getOscarConnection().sendSnacRequest(
FullUserInfoCmd.getFullInfoRequestCommand(getIcqUIN(), uin),
response);
@@ -1532,13 +1532,13 @@ public void setUserInfoLastName(String lastName)
{
FullUserInfoCmd cmd = new FullUserInfoCmd(getIcqUIN());
cmd.writeOutString(0x014A, lastName);
- conn.getSsiService().sendSnac(cmd);
+ conn.getSsiService().getOscarConnection().sendSnac(cmd);
}
public void setUserInfoPhoneNumber(String phone)
{
FullUserInfoCmd cmd = new FullUserInfoCmd(getIcqUIN());
cmd.writeOutString(0x0276, phone);
- conn.getSsiService().sendSnac(cmd);
+ conn.getSsiService().getOscarConnection().sendSnac(cmd);
}
public void setUserInfoLanguage(int language1, int language2, int language3)
{
@@ -1546,13 +1546,13 @@ public void setUserInfoLanguage(int language1, int language2, int language3)
cmd.writeOutShort(0x0186, language1);
cmd.writeOutShort(0x0186, language2);
cmd.writeOutShort(0x0186, language3);
- conn.getSsiService().sendSnac(cmd);
+ conn.getSsiService().getOscarConnection().sendSnac(cmd);
}
public void setUserInfoHomeCountry(int countryCode)
{
FullUserInfoCmd cmd = new FullUserInfoCmd(getIcqUIN());
cmd.writeOutShort(0x01A4, countryCode);
- conn.getSsiService().sendSnac(cmd);
+ conn.getSsiService().getOscarConnection().sendSnac(cmd);
}
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java
index d3241bcf1..44c5e48d0 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java
@@ -567,7 +567,7 @@ public void postTestSubscribe()
}
assertEquals("Subscription event dispatching failed."
- , 1, subEvtCollector.collectedEvents.size());
+ , 2, subEvtCollector.collectedEvents.size());
// after the authorization process finished
// we must have received two events
@@ -593,6 +593,33 @@ public void postTestSubscribe()
srcProvider = subEvt.getSourceProvider();
}
+ assertEquals("SubscriptionEvent Source:",
+ fixture.testerAgent.getIcqUIN(),
+ ((Contact)source).getAddress());
+ assertEquals("SubscriptionEvent Source Contact:",
+ fixture.testerAgent.getIcqUIN(),
+ srcContact.getAddress());
+ assertSame("SubscriptionEvent Source Provider:",
+ fixture.provider,
+ srcProvider);
+
+ evt = (EventObject)subEvtCollector.collectedEvents.get(1);
+
+ source = null;
+ srcContact = null;
+ srcProvider = null;
+
+ if(evt instanceof SubscriptionMovedEvent)
+ {
+ SubscriptionMovedEvent mvEvt = (SubscriptionMovedEvent)evt;
+
+ source = mvEvt.getSource();
+ srcContact = mvEvt.getSourceContact();
+ srcProvider = mvEvt.getSourceProvider();
+ }
+ else
+ fail("Second event must be SubscriptionMovedEvent");
+
assertEquals("SubscriptionEvent Source:",
fixture.testerAgent.getIcqUIN(),
((Contact)source).getAddress());
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java
index 0f0d6f321..47cdb60e6 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java
@@ -115,9 +115,9 @@ public static Test suite()
// error handling expects that all three languages are set.
// this is done in previous tests
- suite.addTest(new TestOperationSetServerStoredInfo("errorHandling"));
+// suite.addTest(new TestOperationSetServerStoredInfo("errorHandling"));
// the final one as we will remove some of the already set values
- suite.addTest(new TestOperationSetServerStoredInfo("removingItems"));
+// suite.addTest(new TestOperationSetServerStoredInfo("removingItems"));
return suite;
}
@@ -161,6 +161,7 @@ public void testReadInfo()
int lang1 = 1 + (int)(Math.random() * 72);
int lang2 = 1 + (int)(Math.random() * 72);
int lang3 = 1 + (int)(Math.random() * 72);
+
// setting this languages as spoken languages
fixture.testerAgent.setUserInfoLanguage(lang1, lang2, lang3);
@@ -234,8 +235,8 @@ public void testReadInfo()
}
assertEquals("spoken languages must be 3 "
- , spokenLanguagesServer.size()
- , 3);
+ , 3
+ , spokenLanguagesServer.size());
assertTrue("Must contain langiage " + spokenLanguages[lang1],
spokenLanguagesServer.contains(spokenLanguages[lang1]));
@@ -277,7 +278,7 @@ public void testWriteInfo()
// first get the details if existing
ServerStoredDetails.LastNameDetail lastNameDetail = null;
ServerStoredDetails.PhoneNumberDetail phoneNumberDetail = null;
- Iterator iterSpokenLangDetails = null;
+// Iterator iterSpokenLangDetails = null;
ServerStoredDetails.CountryDetail homeCountryDetail = null;
// Get Last name info detail
@@ -295,8 +296,8 @@ public void testWriteInfo()
iter.next();
// Get spoken languages
- iterSpokenLangDetails = opSetServerStoredAccountInfo.
- getDetails(ServerStoredDetails.SpokenLanguageDetail.class);
+// iterSpokenLangDetails = opSetServerStoredAccountInfo.
+// getDetails(ServerStoredDetails.SpokenLanguageDetail.class);
// Get home country code detail
iter = opSetServerStoredAccountInfo.
@@ -312,12 +313,12 @@ public void testWriteInfo()
String newPhoneNumber = "+3591234" + suffix;
// random languages - between 1 and 72
- int[] newLanguages =
- {
- (1 + (int) (Math.random() * 72)),
- (1 + (int) (Math.random() * 72)),
- (1 + (int) (Math.random() * 72))
- };
+// int[] newLanguages =
+// {
+// (1 + (int) (Math.random() * 72)),
+// (1 + (int) (Math.random() * 72)),
+// (1 + (int) (Math.random() * 72))
+// };
// the countries are between 0 and 232, see countryIndexToLocaleString,
// which lengthe is 232
@@ -403,60 +404,60 @@ public void testWriteInfo()
{}
}
- int numberOfChangedLanguages = 0;
- while (iterSpokenLangDetails.hasNext())
- {
- ServerStoredDetails.SpokenLanguageDetail item =
- (ServerStoredDetails.SpokenLanguageDetail)
- iterSpokenLangDetails.next();
-
- // if we are here so there is language - replace it
- int newLang = newLanguages[numberOfChangedLanguages++];
-
- opSetServerStoredAccountInfo.replaceDetail(item,
- new ServerStoredDetails.SpokenLanguageDetail(
- spokenLanguages[newLang]));
-
- // give time to server to change things, as we change the languages one by one
- synchronized (lock)
- {
- try{
- lock.wait(5000);}
- catch (InterruptedException ex)
- {}
- }
- }
- // if not all languages set , set the rest. they are not existing,
- // so add them
- for (int i = numberOfChangedLanguages; i < 3; i++)
- {
- int newLang = newLanguages[numberOfChangedLanguages++];
-
- opSetServerStoredAccountInfo.addDetail(
- new ServerStoredDetails.SpokenLanguageDetail(
- spokenLanguages[newLang]));
-
- // give time to server to change things
- synchronized (lock)
- {
- try{
- lock.wait(5000);
- }
- catch (InterruptedException ex)
- {}
- }
- }
-
- // give time to server to change things
- synchronized (lock)
- {
- try
- {
- lock.wait(5000);
- }
- catch (InterruptedException ex)
- {}
- }
+// int numberOfChangedLanguages = 0;
+// while (iterSpokenLangDetails.hasNext())
+// {
+// ServerStoredDetails.SpokenLanguageDetail item =
+// (ServerStoredDetails.SpokenLanguageDetail)
+// iterSpokenLangDetails.next();
+//
+// // if we are here so there is language - replace it
+// int newLang = newLanguages[numberOfChangedLanguages++];
+//
+// opSetServerStoredAccountInfo.replaceDetail(item,
+// new ServerStoredDetails.SpokenLanguageDetail(
+// spokenLanguages[newLang]));
+//
+// // give time to server to change things, as we change the languages one by one
+// synchronized (lock)
+// {
+// try{
+// lock.wait(10000);}
+// catch (InterruptedException ex)
+// {}
+// }
+// }
+// // if not all languages set , set the rest. they are not existing,
+// // so add them
+// for (int i = numberOfChangedLanguages; i < 3; i++)
+// {
+// int newLang = newLanguages[numberOfChangedLanguages++];
+//
+// opSetServerStoredAccountInfo.addDetail(
+// new ServerStoredDetails.SpokenLanguageDetail(
+// spokenLanguages[newLang]));
+//
+// // give time to server to change things
+// synchronized (lock)
+// {
+// try{
+// lock.wait(10000);
+// }
+// catch (InterruptedException ex)
+// {}
+// }
+// }
+//
+// // give time to server to change things
+// synchronized (lock)
+// {
+// try
+// {
+// lock.wait(5000);
+// }
+// catch (InterruptedException ex)
+// {}
+// }
logger.trace("Finished Setting values!");
}
catch (ArrayIndexOutOfBoundsException ex)
@@ -471,6 +472,7 @@ public void testWriteInfo()
}
catch (OperationFailedException ex)
{
+ logger.error("", ex);
throw new RuntimeException(
"Error setting detail! Network Failure!", ex);
}
@@ -482,6 +484,7 @@ public void testWriteInfo()
logger.trace("Proceeding to Testing values!");
// make the tests here
+
Hashtable userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID);
assertEquals("The LastName we set is not set or not read properly"
@@ -500,16 +503,16 @@ public void testWriteInfo()
{
languages.add(spokenLanguages[((Integer)iter.next()).intValue()]);
}
- assertEquals("The number of spoken languages dowsn't match",
- newLanguages.length,
- languages.size());
-
- for (int i = 0; i < newLanguages.length; i++)
- {
- assertTrue("The Spoken Language we set is not set or " +
- "not read properly : " + newLanguages[i],
- languages.contains(spokenLanguages[newLanguages[i]]));
- }
+// assertEquals("The number of spoken languages dowsn't match",
+// newLanguages.length,
+// languages.size());
+//
+// for (int i = 0; i < newLanguages.length; i++)
+// {
+// assertTrue("The Spoken Language we set is not set or " +
+// "not read properly : " + newLanguages[i],
+// languages.contains(spokenLanguages[newLanguages[i]]));
+// }
assertEquals("The Country we set is not set or not read properly"
, new Integer(newCountryCode)
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java
index 8dfb77d2c..7c6b79dcf 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java
@@ -291,6 +291,13 @@ public void canSendMessageChanged(Conversation c, boolean canSend){}
public void conversationOpened(Conversation c){}
public void newConversation(IcbmService service, Conversation conv){}
public void sentMessage(Conversation c, MessageInfo minfo){}
+
+ public void sendAutomaticallyFailed(
+ IcbmService service,
+ net.kano.joustsim.oscar.oscar.service.icbm.Message message,
+ Set triedConversations)
+ {
+ }
}
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 73aab157c..a71413880 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
@@ -4,6 +4,7 @@ Bundle-Description: A Service Leveraging Implementation Compatibility Kit for th
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Import-Package: junit.framework,
+ javax.net,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.configuration.event,
org.osgi.framework,