From a21bdf26b03b7187359e080f4d4ee3e96d63e635 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Thu, 8 Feb 2007 14:54:41 +0000 Subject: [PATCH] Replace joustim libs with the latest svn version Add option to set proxy,proxy type, proxy username and proxy password --- .../icq/ProtocolProviderServiceIcqImpl.java | 73 +++++++++++++++++-- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java index df6ef79d5..a6beb3acf 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -8,7 +8,6 @@ import java.util.*; -import net.java.sip.communicator.impl.protocol.icq.message.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -21,6 +20,7 @@ import net.kano.joustsim.oscar.oscar.loginstatus.*; import net.kano.joustsim.oscar.oscar.service.*; import net.kano.joustsim.oscar.oscar.service.icbm.*; +import net.kano.joustsim.oscar.proxy.*; /** * An implementation of the protocol provider service over the AIM/ICQ protocol @@ -176,8 +176,13 @@ else if (joustSimConnState == State.FAILED) * @param authority the security authority that will be used for resolving * any security challenges that may be returned during the * registration or at any moment while wer're registered. + * + * @throws OperationFailedException with the corresponding code it the + * registration fails for some reason (e.g. a networking error or an + * implementation problem). */ public void register(SecurityAuthority authority) + throws OperationFailedException { if(authority == null) throw new IllegalArgumentException( @@ -237,6 +242,54 @@ public void register(SecurityAuthority authority) new Screenname(getAccountID().getUserID()) , password)); + String proxyAddress = + (String)getAccountID().getAccountProperties().get( + ProtocolProviderFactory.PROXY_ADDRESS); + if(proxyAddress != null && proxyAddress.length() > 0) + { + String proxyPortStr = + (String)getAccountID().getAccountProperties().get( + ProtocolProviderFactory.PROXY_PORT); + int proxyPort; + try + { + proxyPort = Integer.parseInt(proxyPortStr); + } + catch (NumberFormatException ex) + { + throw new OperationFailedException("Wrong port", + OperationFailedException.INVALID_ACCOUNT_PROPERTIES, ex); + } + + String proxyType = + (String)getAccountID().getAccountProperties().get( + ProtocolProviderFactory.PROXY_TYPE); + + if(proxyType == null) + throw new OperationFailedException("Missing proxy type", + OperationFailedException.INVALID_ACCOUNT_PROPERTIES); + + String proxyUsername = + (String)getAccountID().getAccountProperties().get( + ProtocolProviderFactory.PROXY_USERNAME); + String proxyPassword = + (String)getAccountID().getAccountProperties().get( + ProtocolProviderFactory.PROXY_PASSWORD); + + if(proxyType.equals("http")) + aimConnection.setProxy( + AimProxyInfo.forHttp(proxyAddress, proxyPort, + proxyUsername, proxyPassword)); + else if(proxyType.equals("socks4")) + aimConnection.setProxy( + AimProxyInfo.forSocks4(proxyAddress, proxyPort, + proxyUsername)); + else if(proxyType.equals("socks5")) + aimConnection.setProxy( + AimProxyInfo.forSocks5(proxyAddress, proxyPort, + proxyUsername, proxyPassword)); + } + aimConnStateListener = new AimConnStateListener(); aimConnection.addStateListener(aimConnStateListener); @@ -607,10 +660,12 @@ public void handleStateChange(StateEvent event) //set our own cmd factory as we'd like some extra control on //outgoing commands. - conn.getInfoService(). - getOscarConnection().getSnacProcessor(). - getCmdFactoryMgr().getDefaultFactoryList(). - registerAll(new DefaultCmdFactory()); + + /** @todo */ +// conn.getInfoService(). +// getOscarConnection().getSnacProcessor(). +// getCmdFactoryMgr().getDefaultFactoryList(). +// registerAll(new DefaultCmdFactory()); conn.getInfoService(). getOscarConnection().getSnacProcessor(). @@ -697,6 +752,14 @@ public void buddyInfoUpdated(IcbmService service, Screenname buddy, { logger.debug("Got a BuddINFO event"); } + + public void sendAutomaticallyFailed( + IcbmService service, + net.kano.joustsim.oscar.oscar.service.icbm.Message message, + Set triedConversations) + { + + } } public class AimConversationListener implements ConversationListener{