Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] ECF, Skype, and 64-bit systems

Ted,

the patch is attached. You should be able to apply it against the latest com.skype* plugins. Like I said, I moved the win32-dependend code off to the fragment so that the main plugin doesn't need this dependency and is thus free to build against all targets and allows the win32 fragment to build against win32 only. Let me know how it goes. Thanks.

--Peter

Ted Kubaska wrote:
Peter,
We dont have this patch? Is it checked into the repository? I'm
looking through old mail and dont see a reference to it. Am I about to
feel embaressed?
-ted

On Feb 19, 2008 11:12 AM,  <pnehrer@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Ted,

were you able to try it out with the patch I sent to Scott? I don't have
access to it right now so can't resend it, but just ask him if you can. It
basically factors out your dependency on win32 in the main plugin and moves
it entirely into the fragment. Let me know if that did any good. I can't
make it to the conf call today but will be on IRC. Thanks.

--Peter

-------- Original Message --------
Subject: Re: [ecf-dev] ECF, Skype, and 64-bit systems
From: "Ted Kubaska" <ted.kubaska@xxxxxxxxx>
Date: Tue, February 19, 2008 11:18 am
To: "Eclipse Communication Framework (ECF) developer mailing list."
<ecf-dev@xxxxxxxxxxx>

Possibly we are not setting it up correctly on 64bit Linux. The distro
we are using is Ubuntu Gutsy 64-bit. Here is what we did. Will you
attend the phone meeting today?

1.
I downloaded and installed the 64-bit version of Eclipse, 3.4m5. It
works fine. I downloaded the 64-bit version of Java 6 update 4
(jdk-6u4-linux-x64.bin). It works fine with Eclipse. We can write
simple Java programs.

2.
I downloaded Skype from Ubuntu's SPM. It installs and works fine from
its own Skype interface. We can make phone calls and send messages. I
download and install the Skype plugin (the zip file). It does not work
from within Eclipse. In fact, we do not even see the Skype selection
in the ECF dropdown. The provider is installed.

Now if I instead run on a 32-bit Linux Ubuntu, using the 32-bit
Eclipse, 32-bit Java, Skype from Ubuntu's SPM, it works fine. If I run
on 32-bit windows, the Skype plugin does not work, but here is an
important qualification ... if I build Skype on a 32bit Linux system,
it works fine on 32bit windows and 32bit linux. It does not work on
32bit windows, if it is built on 64-bit Linux. That's the difference.
I can modify the resulting Skype plugin as built on 64bit Linux to
work on 32bit Windows by replacing one class file in one of the jars
making up the Skype plugin with the class file as made on a 32-bit
system.

The file I must replace is
com/skype/connector/windows/WindowsConnector$1.class in
com.skype_0.3.0.HEAD.jar. I replace it with the same file built on
32-bit Linux.

Now when we build on 64-bit Linux we have to be careful to copy the
org.eclipse.swt.win32.win32.x86_3.3.0.v3346.jar fragment to the
Eclipse plugins directory so that references are resolved. This jar is
of course not used by Eclipse as it runs on our 64-bit Linux but it is
needed for the Skype build.

Now unfortunately when I tried this out on a 64-bit linux (running not
building) this was down quickly because I did not have the machine for
very long. But two of us tried very hard during a hour or so and could
not get it to work. It's not proactical to use our 64-bit build linux
sysem (Suse 10.2) to run on.

Now when I say a build on 32-linux works and one on 64-bit linux does
not, I really do mean the verys same files. The Skype code is the same
on both systems as are all the build files (the ant scripts and config
files). The different is that the 32bit system has 32-bit eclipse and
32-bit java.

If you have more information about this and can attend our phone
meeting (which I think is today) that's be great. Thanks.
-ted



2008/2/19 Marcelo Mayworm <mayworm@xxxxxxxxx>:
Hello Ted,

I don't know if I understood your point of view.

ECF Skype plugin is dependent of native lib (Skype4Java lib), and we have
one lib for each OS, and one specific lib for Linux 64 e 32. I don't have a
linux 64, just 32, but I tried the ECF Skype plugin on Linux 32 and 64 (with
helps from Roy) and it was working fine. Scott tried it on windows 32 (I
guess). We created diferents fragments for specific OS.
P.S: For while we dont have a fragment for Macos...

Please let me know if helped you.

Cheers
Marcelo


2008/2/19 Ted Kubaska <ted.kubaska@xxxxxxxxx>:



Has anyone run ECF and its provider plugins (specifically Skype) on
64-bit Linux?
As I've stated here before, we build on a 64-bit Linux system and the
resulting build is intended for both Windows and Linux systems. And we've
encountered some difficulties. Consequently, I've stopped the OSU auto
builds. I'm planning to move the OSU builds to a 32-bit Linux system.
Built on 64-bit Linux, ECF works everywhere ... it works on
32-bit/64-bit Window/Linux systems. Congratulations on great protability.
However, the Skype plugin has some issues. Built on 64-bit Linux, it
does not work on 32-bit Windows. It does work on 32-bit Linux. Last Sunday I
tried it out on 64-bit Linux (another person's machine and not a lot of
access time), but it did not (not!) appear to work. This was unexpected. I
have not been able to try it on 64-bit Windows because I don't have access
to a 64-bit Windows machine.
A thank-you to Peter Nehrer is appropriate. His directions for debugging
an already built plugin work fine and provided us with good information. We
now think we understand why the Skype built on 64-bit Linux does not run on
32-bit Windows. Unfortunately, understanding is a long way from fixing.
However, we did expect it to run on 64-bit Linux.
So my question ... who is working with 64-bit machines and what have you
experienced? Specifically can you see ECF and Skype work together on any
64-bit system?
--
-Ted
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



--
-Ted
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev





### Eclipse Workspace Patch 1.0
#P com.skype.win32.win32.x86
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/skype/eclipse/plugins/com.skype.win32.win32.x86/META-INF/MANIFEST.MF,v
retrieving revision 1.7
diff -u -r1.7 MANIFEST.MF
--- META-INF/MANIFEST.MF	17 Oct 2007 18:19:22 -0000	1.7
+++ META-INF/MANIFEST.MF	14 Feb 2008 04:46:09 -0000
@@ -7,3 +7,4 @@
 Bundle-Localization: plugin
 Fragment-Host: com.skype;bundle-version="0.1.0"
 Eclipse-PlatformFilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))
+Require-Bundle: org.eclipse.swt
Index: src/foo.txt
===================================================================
RCS file: src/foo.txt
diff -N src/foo.txt
Index: src/com/skype/connector/windows/WindowsConnector.java
===================================================================
RCS file: src/com/skype/connector/windows/WindowsConnector.java
diff -N src/com/skype/connector/windows/WindowsConnector.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/com/skype/connector/windows/WindowsConnector.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,425 @@
+/*******************************************************************************
+ * Copyright (c) 2006-2007 Koji Hisano <hisano@xxxxxxxxx> - UBION Inc. Developer
+ * Copyright (c) 2006-2007 UBION Inc. <http://www.ubion.co.jp/>
+ * 
+ * Copyright (c) 2006-2007 Skype Technologies S.A. <http://www.skype.com/>
+ * 
+ * Skype4Java is licensed under either the Apache License, Version 2.0 or
+ * the Eclipse Public License v1.0.
+ * You may use it freely in commercial and non-commercial products.
+ * You may obtain a copy of the licenses at
+ *
+ *   the Apache License - http://www.apache.org/licenses/LICENSE-2.0
+ *   the Eclipse Public License - http://www.eclipse.org/legal/epl-v10.html
+ *
+ * If it is possible to cooperate with the publicity of Skype4Java, please add
+ * links to the Skype4Java web site <https://developer.skype.com/wiki/Java_API> 
+ * in your web site or documents.
+ * 
+ * Contributors:
+ * Koji Hisano - initial API and implementation
+ * Kamil Sarelo - modified getInstalledPath() to support installing by an
+ *                administrator account and added javadocs
+ ******************************************************************************/
+package com.skype.connector.windows;
+
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.swt.internal.Callback;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.internal.win32.TCHAR;
+import org.eclipse.swt.internal.win32.WNDCLASS;
+import org.eclipse.swt.widgets.Display;
+
+import com.skype.connector.AbstractConnectorListener;
+import com.skype.connector.Connector;
+import com.skype.connector.ConnectorException;
+import com.skype.connector.ConnectorListener;
+import com.skype.connector.ConnectorStatusEvent;
+
+/**
+ * Implementation of the Windows connector based on the SWT libraries.
+ * Please, use Win32Connector if SWT is not an option for you.
+ */
+@SuppressWarnings("restriction")
+public final class WindowsConnector extends Connector {
+	/**
+	 * The singleton instance of the WindowsConnector class.
+	 */
+	private static class Instance {
+		static WindowsConnector instance = new WindowsConnector();
+	}
+
+	/**
+	 * Gets the singleton instance of the WindowsConnector class.
+	 * 
+	 * @return the singleton instance of the WindowsConnector class
+	 */
+	public static WindowsConnector getInstance() {
+		// Using 'Initialization On Demand Holder' Pattern
+		return Instance.instance;
+	}
+
+	/**
+	 * The attached response type (value is 0).
+	 * <p>
+	 * This response is sent when the client is attached.
+	 * </p>
+	 */
+	private static final int ATTACH_SUCCESS = 0;
+
+	/**
+	 * The pending authorization response type (value is 1).
+	 * <p>
+	 * This response is sent when Skype acknowledges the connection request and
+	 * is waiting for user confirmation. The client is not yet attached and must
+	 * wait for the {@ses #ATTACH_SUCCESS} message.
+	 * </p>
+	 */
+	private static final int ATTACH_PENDING_AUTHORIZATION = 1;
+
+	/**
+	 * The refused response type (value is 2).
+	 * <p>
+	 * This response is sent when the user has explicitly denied the access of
+	 * the client.
+	 * </p>
+	 */
+	private static final int ATTACH_REFUSED = 2;
+
+	/**
+	 * The not available response type (value is 3).
+	 * <p>
+	 * This response is sent when the API is not available at the moment because
+	 * no user is currently logged in. The client must wait for a
+	 * {@see #ATTACH_API_AVAILABLE} broadcast before attempting to connect
+	 * again.
+	 * </p>
+	 */
+	private static final int ATTACH_NOT_AVAILABLE = 3;
+
+	/**
+	 * The available response type (value is 0x8001).
+	 * <p>
+	 * This response is sent when the API becomes available.
+	 */
+	private static final int ATTACH_API_AVAILABLE = 0x8001;
+
+	/**
+	 * The window handle indicating all top-level windows in the system.
+	 * 
+	 * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/sendmessage.asp";>MSDN Library</a>
+	 */
+	private static final int HWND_BROADCAST = 0xffff;
+
+	/**
+	 * The window message type to pass data to another application.
+	 * 
+	 * @see <a href="http://search.msdn.microsoft.com/search/Redirect.aspx?title=WM_COPYDATA+Message&url=http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/dataexchange/datacopy/datacopyreference/datacopymessages/wm_copydata.asp";>MSDN Library</a>
+	 */
+	private static final int WM_COPYDATA = 0x004a;
+
+	/**
+	 * The window message type of the response for initiating communication from Skype.
+	 * 
+	 * @see #DISCOVER_MESSAGE_ID
+	 */
+	private static final int ATTACH_MESSAGE_ID = OS.RegisterWindowMessage(new TCHAR(0, "SkypeControlAPIAttach", true));
+
+	/**
+	 * The window message type of the request to initiate communication with Skype.
+	 * 
+	 * @see #ATTACH_MESSAGE_ID
+	 */
+	private static final int DISCOVER_MESSAGE_ID = OS.RegisterWindowMessage(new TCHAR(0, "SkypeControlAPIDiscover", true));
+
+	/** SWT display instance. */
+	private Display display;
+	/** SWT window instance. */
+	private TCHAR windowClass;
+	/** SWT window handle. */
+	private int windowHandle;
+	/** Skype Client window handle. */
+	private int skypeWindowHandle;
+
+	/**
+	 * Constructor.
+	 */
+	private WindowsConnector() {
+	}
+
+	/**
+	 * Returns the location of Skype.exe file from the MS Windows registry
+	 * (implicit it check if Skype is installed or not). Checks in the registry
+	 * if the key: {HKCU\Software\Skype\Phone, SkypePath} exists; if not, it
+	 * checks again but now for {HKLM\Software\Skype\Phone, SkypePath}; if HKCU
+	 * key does not exist but the HKLM key is present, Skype has been installed
+	 * from an administrator account has but not been used from the current
+	 * account; otherwise there is no Skype installed.
+	 * 
+	 * @return the path to the <code>Skype.exe</code> file if Skype is
+	 *         installed or <code>null</code>.
+	 */
+	@Override
+	public String getInstalledPath() {
+		String result = getRegistryValue(OS.HKEY_CURRENT_USER, "Software\\Skype\\Phone", "SkypePath");
+		if (result == null) {
+			result = getRegistryValue(OS.HKEY_LOCAL_MACHINE, "Software\\Skype\\Phone", "SkypePath");
+		}
+		return result;
+	}
+
+	/**
+	 * Returns the value to which the specified key and data is mapped in the
+	 * Windows registry, or null if the registry contains no mapping for this
+	 * key and/or data.
+	 * 
+	 * @param hKey registry hKey.
+	 * @param keyName registry key name.
+	 * @param dataName registry data name.
+	 * @return the value to which the specified key and data is mapped or
+	 *         <code>null</code>.
+	 */
+	private String getRegistryValue(final int hKey, final String keyName, final String dataName) {
+		final int[] phkResult = new int[1];
+		if (OS.RegOpenKeyEx(hKey, new TCHAR(0, keyName, true), 0, OS.KEY_READ, phkResult) != 0) {
+			return null;
+		}
+		String result = null;
+		final int[] lpcbData = new int[1];
+		if (OS.RegQueryValueEx(phkResult[0], new TCHAR(0, dataName, true), 0, null, (TCHAR) null, lpcbData) == 0) {
+			result = "";
+			int length = lpcbData[0] / TCHAR.sizeof;
+			if (length != 0) {
+				final TCHAR lpData = new TCHAR(0, length);
+				if (OS.RegQueryValueEx(phkResult[0], new TCHAR(0, dataName, true), 0, null, lpData, lpcbData) == 0) {
+					length = Math.max(0, lpData.length() - 1);
+					result = lpData.toString(0, length);
+				}
+			}
+		}
+		if (phkResult[0] != 0) {
+			OS.RegCloseKey(phkResult[0]);
+		}
+		return result;
+	}
+
+	/**
+	 * Initialize the connector.
+	 * @param timeout Maximum amout of time in millieseconds to initialize.
+	 * @throws ConnectorException when initialization cannot be completed.
+	 */
+	@Override
+	protected void initialize() throws ConnectorException {
+		final Object wait = new Object();
+		final String[] errorMessage = new String[1];
+		final Thread thread = new Thread("SkypeEventDispatcher") {
+			@Override
+			public void run() {
+				try {
+					display = new Display();
+					windowClass = new TCHAR(0, "" + System.currentTimeMillis() + (int) (Math.random() * 1000), true);
+					int messageReceived = new Callback(WindowsConnector.this, "messageReceived", 4).getAddress();
+					if (messageReceived == 0) {
+						setErrorMessage("The Windows connector couldn't get a callback resource.");
+						return;
+					}
+					int hHeap = OS.GetProcessHeap();
+					if (hHeap == 0) {
+						setErrorMessage("The Windows connector couldn't get the heap handle.");
+						return;
+					}
+					int hInstance = OS.GetModuleHandle(null);
+					if (hInstance == 0) {
+						setErrorMessage("The Windows connector couldn't get the module handle.");
+						return;
+					}
+					WNDCLASS lpWndClass = new WNDCLASS();
+					lpWndClass.hInstance = hInstance;
+					lpWndClass.lpfnWndProc = messageReceived;
+					lpWndClass.style = OS.CS_BYTEALIGNWINDOW | OS.CS_DBLCLKS;
+					lpWndClass.hCursor = OS.LoadCursor(0, OS.IDC_ARROW);
+					if (lpWndClass.hCursor == 0) {
+						setErrorMessage("The Windows connector couldn't get a cursor handle.");
+						return;
+					}
+					int byteCount = windowClass.length() * TCHAR.sizeof;
+					lpWndClass.lpszClassName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+					if (lpWndClass.lpszClassName == 0) {
+						setErrorMessage("The Windows connector couldn't get a resource.");
+						return;
+					}
+					OS.MoveMemory(lpWndClass.lpszClassName, windowClass, byteCount);
+					if (OS.RegisterClass(lpWndClass) == 0) {
+						setErrorMessage("The Windows connector couldn't register a window class.");
+						return;
+					}
+					windowHandle = OS.CreateWindowEx(0, windowClass, null, OS.WS_OVERLAPPED, 0, 0, 0, 0, 0, 0, hInstance, null);
+					if (windowHandle == 0) {
+						setErrorMessage("The Windows connector couldn't create a window.");
+						return;
+					}
+				} finally {
+					synchronized (wait) {
+						wait.notify();
+					}
+				}
+				while (true) {
+					if (!display.readAndDispatch()) {
+						display.sleep();
+					}
+				}
+			};
+
+			private void setErrorMessage(String message) {
+				errorMessage[0] = message;
+			}
+		};
+		thread.setDaemon(true);
+		synchronized (wait) {
+			try {
+				thread.start();
+				wait.wait();
+				if (errorMessage[0] != null) {
+					throw new ConnectorException(errorMessage[0]);
+				}
+			} catch (final InterruptedException e) {
+				throw new ConnectorException("The Windows connector initialization was interrupted.", e);
+			}
+		}
+	}
+
+	/**
+	 * Implementation of the connect method for this connector.
+	 * @param timeout maximum amout of time to connect.
+	 * @return Status after connecting.
+	 * @throws ConnectorException when connection could not be established.
+	 */
+	protected Status connect(final int timeout) throws ConnectorException {
+		final Object wait = new Object();
+		final ConnectorListener listener = new AbstractConnectorListener() {
+			@Override
+			public void statusChanged(ConnectorStatusEvent event) {
+				synchronized (wait) {
+					wait.notify();
+				}
+			}
+		};
+		addConnectorListener(listener, false);
+		synchronized (wait) {
+			try {
+				while (true) {
+					OS.SendMessage(HWND_BROADCAST, DISCOVER_MESSAGE_ID, windowHandle, 0);
+					final long start = System.currentTimeMillis();
+					wait.wait(timeout);
+					if (timeout <= System.currentTimeMillis() - start) {
+						setStatus(Status.NOT_RUNNING);
+					}
+					final Status status = getStatus();
+					if (status != Status.PENDING_AUTHORIZATION) {
+						return status;
+					}
+					Thread.sleep(1000);
+				}
+			} catch (final InterruptedException e) {
+				throw new ConnectorException("Trying to connect was interrupted.", e);
+			} finally {
+				removeConnectorListener(listener);
+			}
+		}
+	}
+
+	/**
+	 * Send the application name to the Skype Client.
+	 * @param applicationName the new applicationname.
+	 * @throws ConnectorException when connection to Skype client has gone bad.
+	 */
+	protected void sendApplicationName(final String applicationName) throws ConnectorException {
+		final String command = "NAME " + applicationName;
+		execute(command, new String[] {command}, false);
+	}
+
+	/**
+	 * Gets called when a message is received.
+	 * @param hwnd Skype client window handle.
+	 * @param msg The message received.
+	 * @param wParam The window parameter.
+	 * @param lParam The lparam.
+	 * @return Status value.
+	 */
+	@SuppressWarnings("unused")
+	private int messageReceived(final int hwnd, final int msg, final int wParam, final int lParam) {
+		// Using 'if' statement because ATTACH_MESSAGE_ID is not a compile time constant
+		if (msg == ATTACH_MESSAGE_ID) {
+			switch (lParam) {
+				case ATTACH_PENDING_AUTHORIZATION :
+					setStatus(Status.PENDING_AUTHORIZATION);
+					break;
+				case ATTACH_SUCCESS :
+					skypeWindowHandle = wParam;
+					setStatus(Status.ATTACHED);
+					break;
+				case ATTACH_REFUSED :
+					setStatus(Status.REFUSED);
+					break;
+				case ATTACH_NOT_AVAILABLE :
+					setStatus(Status.NOT_AVAILABLE);
+					break;
+				case ATTACH_API_AVAILABLE :
+					setStatus(Status.API_AVAILABLE);
+					break;
+				default :
+					setStatus(Status.NOT_RUNNING);
+					break;
+			}
+			return 1;
+		} else if (msg == WM_COPYDATA) {
+			if (wParam == skypeWindowHandle) {
+				final int[] data = new int[3];
+				OS.MoveMemory(data, lParam, 12);
+				final int cbData = data[1];
+				final int lpData = data[2];
+				final int length = cbData;
+				final byte[] buffer = new byte[length];
+				OS.MoveMemory(buffer, lpData, length);
+				final byte[] string = new byte[buffer.length - 1];
+				System.arraycopy(buffer, 0, string, 0, string.length);
+				try {
+					final String message = new String(string, "UTF-8");
+					fireMessageReceived(message);
+					return 1;
+				} catch (final UnsupportedEncodingException e) {
+				}
+			}
+		}
+		return OS.DefWindowProc(hwnd, msg, wParam, lParam);
+	}
+
+	/**
+	 * Clean up and disconnect.
+	 */
+	protected void disposeImpl() {
+		// TODO WindowsConnector#disposeImpl()
+		throw new UnsupportedOperationException("WindowsConnector#disposeImpl() is not implemented yet.");
+	}
+
+	/**
+	 * Send a command to the Skype client.
+	 * @param command The command to send.
+	 */
+	protected void sendCommand(final String command) {
+		display.asyncExec(new Runnable() {
+			public void run() {
+				try {
+					final byte[] data = (command + "\u0000").getBytes("UTF-8");
+					final int hHeap = OS.GetProcessHeap();
+					final int pMessage = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, data.length);
+					OS.MoveMemory(pMessage, data, data.length);
+					OS.SendMessage(skypeWindowHandle, WM_COPYDATA, windowHandle, new int[] {0, data.length, pMessage});
+					OS.HeapFree(hHeap, 0, pMessage);
+				} catch (final UnsupportedEncodingException e) {
+				}
+			}
+		});
+	}
+}
Index: src/com/skype/connector/win32/package-info.java
===================================================================
RCS file: src/com/skype/connector/win32/package-info.java
diff -N src/com/skype/connector/win32/package-info.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/com/skype/connector/win32/package-info.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,4 @@
+/**
+ * Provides the connector for Windows by JNI
+ */
+package com.skype.connector.win32;
Index: src/com/skype/connector/windows/package-info.java
===================================================================
RCS file: src/com/skype/connector/windows/package-info.java
diff -N src/com/skype/connector/windows/package-info.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/com/skype/connector/windows/package-info.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,4 @@
+/**
+ * Provides the connector for Windows by SWT
+ */
+package com.skype.connector.windows;
Index: src/com/skype/connector/win32/package.html
===================================================================
RCS file: src/com/skype/connector/win32/package.html
diff -N src/com/skype/connector/win32/package.html
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/com/skype/connector/win32/package.html	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ Copyright (c) 2006 Bart Lamot <bart.almot@xxxxxxxxx> 
+ 
+ Copyright (c) 2006 Skype Technologies S.A. <http://www.skype.com/>
+ 
+ This program and the accompanying materials are made available under the
+ terms of the Common Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/cpl-v10.html
+ 
+ Contributors: 
+ Bart Lamot
+ Koji Hisano - initial API and implementation Kamil Sarelo -
+-->
+</head>
+<body bgcolor="white">
+
+##### THIS IS THE TEMPLATE FOR THE PACKAGE DOC COMMENTS. #####
+##### TYPE YOUR PACKAGE COMMENTS HERE.  BEGIN WITH A     #####
+##### ONE-SENTENCE SUMMARY STARTING WITH A VERB LIKE:    #####
+Provides for.... 
+
+
+<h2>Package Specification</h2>
+
+##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
+<ul>
+  <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+  <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
+</ul>
+
+<!-- Put @see and @since tags down here. -->
+
+</body>
+</html>
+
Index: src/com/skype/connector/win32/Win32Connector.java
===================================================================
RCS file: src/com/skype/connector/win32/Win32Connector.java
diff -N src/com/skype/connector/win32/Win32Connector.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/com/skype/connector/win32/Win32Connector.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * Copyright (c) 2006-2007 r-yu/xai
+ *
+ * Copyright (c) 2006-2007 Koji Hisano <hisano@xxxxxxxxx> - UBION Inc. Developer
+ * Copyright (c) 2006-2007 UBION Inc. <http://www.ubion.co.jp/>
+ * 
+ * Copyright (c) 2006-2007 Skype Technologies S.A. <http://www.skype.com/>
+ * 
+ * Skype4Java is licensed under either the Apache License, Version 2.0 or
+ * the Eclipse Public License v1.0.
+ * You may use it freely in commercial and non-commercial products.
+ * You may obtain a copy of the licenses at
+ *
+ *   the Apache License - http://www.apache.org/licenses/LICENSE-2.0
+ *   the Eclipse Public License - http://www.eclipse.org/legal/epl-v10.html
+ *
+ * If it is possible to cooperate with the publicity of Skype4Java, please add
+ * links to the Skype4Java web site <https://developer.skype.com/wiki/Java_API> 
+ * in your web site or documents.
+ * 
+ * Contributors:
+ * r-yu/xai - initial implementation
+ * Koji Hisano - changed Skype event dispatch thread to a deamon thread
+ ******************************************************************************/
+package com.skype.connector.win32;
+
+import com.skype.connector.Connector;
+import com.skype.connector.ConnectorException;
+
+/**
+ * Implementation of a connector for Windows.
+ * This implementation uses a small dll to connect.
+ * The WindowsConnector uses SWT library.
+ * Choose wisely.
+ */
+public final class Win32Connector extends Connector {
+    /** Status ATTACH_SUCCES value. */
+	private static final int ATTACH_SUCCESS = 0;
+	/** Status ATTACH_PENDING_AUTHORISATION value. */
+    private static final int ATTACH_PENDING_AUTHORIZATION = 1;
+    /** Status ATTACH_REFUSED value. */
+    private static final int ATTACH_REFUSED = 2;
+    /** Status ATTACH_NOT_AVAILABLE value. */
+    private static final int ATTACH_NOT_AVAILABLE = 3;
+    /** Status ATTACH_API_AVAILABLE value. */
+    private static final int ATTACH_API_AVAILABLE = 0x8001;
+    
+    /** Singleton instance. */
+    private static Win32Connector myInstance_ = null;
+
+    /**
+     * Get singleton instance.
+     * @return instance.
+     */
+    public static synchronized Connector getInstance() {
+        if(myInstance_ == null) {
+            myInstance_ = new Win32Connector();
+        }
+        return (Connector) myInstance_;
+    }
+
+    /** Thread. */
+    private Thread thread_ = null;
+
+    /**
+     * Constructor.
+     *
+     */
+    private Win32Connector() {
+    }
+
+    /**
+     * Return the path of Skype.exe.
+     * @return absolute path to Skype.exe.
+     */
+    public String getInstalledPath() {
+        return jni_getInstalledPath();
+    }
+
+    /**
+     * Initialize the connector.
+     * @param timeout maximum time in miliseconds to initialize.
+     */
+    protected void initialize() {
+        // Loading DLL
+		System.loadLibrary("JNIConnector");
+
+		// Initializing JNI
+        jni_init();
+
+        // Starting Window Thread
+        thread_ = new Thread(new Runnable() {
+            public void run() {
+                jni_windowProc();
+            }
+        }, "SkypeBridge WindowProc Thread");
+        thread_.setDaemon(true);
+        thread_.start();
+    }
+
+    /**
+     * Connect to Skype client.
+     * @param timeout the maximum time in milliseconds to connect.
+     * @return Status the status after connecting.
+     * @throws ConnectorException when connection can not be established.
+     */
+    protected Status connect(int timeout) throws ConnectorException {
+        try {
+            while(true) {
+                jni_connect();
+                long start = System.currentTimeMillis();
+                if(timeout <= System.currentTimeMillis() - start) {
+                    setStatus(Status.NOT_RUNNING);
+                }
+                Status status = getStatus();
+                if(status != Status.PENDING_AUTHORIZATION && status != Status.NOT_RUNNING) {
+                    return status;
+                }
+                Thread.sleep(1000);
+            }
+        } catch(InterruptedException e) {
+            throw new ConnectorException("Trying to connect was interrupted.", e);
+        }
+    }
+
+    /**
+     * Send applicationname to Skype client.
+     * @param applicationName The new Application name.
+     * @throws ConnectorException when Skype Client connection has gone bad. 
+     */
+    protected void sendApplicationName(final String applicationName) throws ConnectorException {
+        String command = "NAME " + applicationName;
+        execute(command, new String[] {command}, false);
+    }
+
+    /**
+     * Set the connector status.
+     * This method will be called by the native lib.
+     * @param status The new status.
+     */
+    public void jni_onAttach(int status) {
+        switch(status) {
+            case ATTACH_PENDING_AUTHORIZATION:
+                setStatus(Status.PENDING_AUTHORIZATION);
+                break;
+            case ATTACH_SUCCESS:
+                setStatus(Status.ATTACHED);
+                break;
+            case ATTACH_REFUSED:
+                setStatus(Status.REFUSED);
+                break;
+            case ATTACH_NOT_AVAILABLE:
+                setStatus(Status.NOT_AVAILABLE);
+                break;
+            case ATTACH_API_AVAILABLE:
+                setStatus(Status.API_AVAILABLE);
+                break;
+            default:
+                setStatus(Status.NOT_RUNNING);
+                break;
+        }
+    }
+
+    /**
+     * This method gets called when the native lib has a message received.
+     * @param message The received message.
+     */
+    public void jni_onSkypeMessage(String message) {
+        fireMessageReceived(message);
+    }
+
+    /**
+     * Clean up the connector and the native lib.
+     */
+    protected void disposeImpl() {
+        // TODO WindowsConnector#disposeImpl()
+        throw new UnsupportedOperationException("WindowsConnector#disposeImpl() is not implemented yet.");
+    }
+
+    /**
+     * Send a command to the Skype client.
+     * @param command The command to send.
+     */
+    protected void sendCommand(final String command) {
+        jni_sendMessage(command);
+    }
+
+    // for native
+    /**
+     * Native init method.
+     */
+    private native void jni_init();
+    
+    /**
+     * native event loop method.
+     *
+     */
+    private native void jni_windowProc();
+    
+    /**
+     * Native send message method.
+     * @param message The message to send.
+     */
+    private native void jni_sendMessage(String message);
+    
+    /***
+     * The native connect method.
+     *
+     */
+    private native void jni_connect();
+    
+    /**
+     * The native get installed path method.
+     * @return String with the absolute path to Skype.exe.
+     */
+    private native String jni_getInstalledPath();
+}
#P com.skype
Index: src/com/skype/connector/win32/package-info.java
===================================================================
RCS file: src/com/skype/connector/win32/package-info.java
diff -N src/com/skype/connector/win32/package-info.java
--- src/com/skype/connector/win32/package-info.java	5 Apr 2007 04:21:32 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-/**
- * Provides the connector for Windows by JNI
- */
-package com.skype.connector.win32;
Index: src/com/skype/connector/win32/package.html
===================================================================
RCS file: src/com/skype/connector/win32/package.html
diff -N src/com/skype/connector/win32/package.html
--- src/com/skype/connector/win32/package.html	23 Feb 2007 00:00:49 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
- Copyright (c) 2006 Bart Lamot <bart.almot@xxxxxxxxx> 
- 
- Copyright (c) 2006 Skype Technologies S.A. <http://www.skype.com/>
- 
- This program and the accompanying materials are made available under the
- terms of the Common Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/cpl-v10.html
- 
- Contributors: 
- Bart Lamot
- Koji Hisano - initial API and implementation Kamil Sarelo -
--->
-</head>
-<body bgcolor="white">
-
-##### THIS IS THE TEMPLATE FOR THE PACKAGE DOC COMMENTS. #####
-##### TYPE YOUR PACKAGE COMMENTS HERE.  BEGIN WITH A     #####
-##### ONE-SENTENCE SUMMARY STARTING WITH A VERB LIKE:    #####
-Provides for.... 
-
-
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
-  <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-  <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
-
Index: src/com/skype/connector/win32/Win32Connector.java
===================================================================
RCS file: src/com/skype/connector/win32/Win32Connector.java
diff -N src/com/skype/connector/win32/Win32Connector.java
--- src/com/skype/connector/win32/Win32Connector.java	11 Apr 2007 19:59:23 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006-2007 r-yu/xai
- *
- * Copyright (c) 2006-2007 Koji Hisano <hisano@xxxxxxxxx> - UBION Inc. Developer
- * Copyright (c) 2006-2007 UBION Inc. <http://www.ubion.co.jp/>
- * 
- * Copyright (c) 2006-2007 Skype Technologies S.A. <http://www.skype.com/>
- * 
- * Skype4Java is licensed under either the Apache License, Version 2.0 or
- * the Eclipse Public License v1.0.
- * You may use it freely in commercial and non-commercial products.
- * You may obtain a copy of the licenses at
- *
- *   the Apache License - http://www.apache.org/licenses/LICENSE-2.0
- *   the Eclipse Public License - http://www.eclipse.org/legal/epl-v10.html
- *
- * If it is possible to cooperate with the publicity of Skype4Java, please add
- * links to the Skype4Java web site <https://developer.skype.com/wiki/Java_API> 
- * in your web site or documents.
- * 
- * Contributors:
- * r-yu/xai - initial implementation
- * Koji Hisano - changed Skype event dispatch thread to a deamon thread
- ******************************************************************************/
-package com.skype.connector.win32;
-
-import java.io.File;
-
-import com.skype.connector.Connector;
-import com.skype.connector.ConnectorException;
-import com.skype.connector.ConnectorUtils;
-
-/**
- * Implementation of a connector for Windows.
- * This implementation uses a small dll to connect.
- * The WindowsConnector uses SWT library.
- * Choose wisely.
- */
-public final class Win32Connector extends Connector {
-    /** Status ATTACH_SUCCES value. */
-	private static final int ATTACH_SUCCESS = 0;
-	/** Status ATTACH_PENDING_AUTHORISATION value. */
-    private static final int ATTACH_PENDING_AUTHORIZATION = 1;
-    /** Status ATTACH_REFUSED value. */
-    private static final int ATTACH_REFUSED = 2;
-    /** Status ATTACH_NOT_AVAILABLE value. */
-    private static final int ATTACH_NOT_AVAILABLE = 3;
-    /** Status ATTACH_API_AVAILABLE value. */
-    private static final int ATTACH_API_AVAILABLE = 0x8001;
-    /** Filename of the DLL. */
-    private static final String LIBFILENAME = "JNIConnector.dll";
-    
-    /** Singleton instance. */
-    private static Win32Connector myInstance_ = null;
-
-    /**
-     * Get singleton instance.
-     * @return instance.
-     */
-    public static synchronized Connector getInstance() {
-        if(myInstance_ == null) {
-            myInstance_ = new Win32Connector();
-        }
-        return (Connector) myInstance_;
-    }
-
-    /** Thread. */
-    private Thread thread_ = null;
-
-    /**
-     * Constructor.
-     *
-     */
-    private Win32Connector() {
-    }
-
-    /**
-     * Return the path of Skype.exe.
-     * @return absolute path to Skype.exe.
-     */
-    public String getInstalledPath() {
-        return jni_getInstalledPath();
-    }
-
-    /**
-     * Initialize the connector.
-     * @param timeout maximum time in miliseconds to initialize.
-     */
-    protected void initialize() {
-        // Loading DLL
-    	try {
-    		System.loadLibrary("JNIConnector");
-    	} catch (Throwable e) {
-    		if (!ConnectorUtils.checkLibraryInPath(LIBFILENAME)) {
-	    		ConnectorUtils.extractFromJarToTemp(LIBFILENAME);
-                String tmpDir = System.getProperty("java.io.tmpdir");
-                if (! tmpDir.endsWith(""+File.separatorChar)) {
-                    tmpDir = tmpDir+File.separatorChar;
-                }
-	    		System.load(tmpDir+LIBFILENAME);
-			}
-    	}
-        // Initializing JNI
-        jni_init();
-
-        // Starting Window Thread
-        thread_ = new Thread(new Runnable() {
-            public void run() {
-                jni_windowProc();
-            }
-        }, "SkypeBridge WindowProc Thread");
-        thread_.setDaemon(true);
-        thread_.start();
-    }
-
-    /**
-     * Connect to Skype client.
-     * @param timeout the maximum time in milliseconds to connect.
-     * @return Status the status after connecting.
-     * @throws ConnectorException when connection can not be established.
-     */
-    protected Status connect(int timeout) throws ConnectorException {
-        try {
-            while(true) {
-                jni_connect();
-                long start = System.currentTimeMillis();
-                if(timeout <= System.currentTimeMillis() - start) {
-                    setStatus(Status.NOT_RUNNING);
-                }
-                Status status = getStatus();
-                if(status != Status.PENDING_AUTHORIZATION && status != Status.NOT_RUNNING) {
-                    return status;
-                }
-                Thread.sleep(1000);
-            }
-        } catch(InterruptedException e) {
-            throw new ConnectorException("Trying to connect was interrupted.", e);
-        }
-    }
-
-    /**
-     * Send applicationname to Skype client.
-     * @param applicationName The new Application name.
-     * @throws ConnectorException when Skype Client connection has gone bad. 
-     */
-    protected void sendApplicationName(final String applicationName) throws ConnectorException {
-        String command = "NAME " + applicationName;
-        execute(command, new String[] {command}, false);
-    }
-
-    /**
-     * Set the connector status.
-     * This method will be called by the native lib.
-     * @param status The new status.
-     */
-    public void jni_onAttach(int status) {
-        switch(status) {
-            case ATTACH_PENDING_AUTHORIZATION:
-                setStatus(Status.PENDING_AUTHORIZATION);
-                break;
-            case ATTACH_SUCCESS:
-                setStatus(Status.ATTACHED);
-                break;
-            case ATTACH_REFUSED:
-                setStatus(Status.REFUSED);
-                break;
-            case ATTACH_NOT_AVAILABLE:
-                setStatus(Status.NOT_AVAILABLE);
-                break;
-            case ATTACH_API_AVAILABLE:
-                setStatus(Status.API_AVAILABLE);
-                break;
-            default:
-                setStatus(Status.NOT_RUNNING);
-                break;
-        }
-    }
-
-    /**
-     * This method gets called when the native lib has a message received.
-     * @param message The received message.
-     */
-    public void jni_onSkypeMessage(String message) {
-        fireMessageReceived(message);
-    }
-
-    /**
-     * Clean up the connector and the native lib.
-     */
-    protected void disposeImpl() {
-        // TODO WindowsConnector#disposeImpl()
-        throw new UnsupportedOperationException("WindowsConnector#disposeImpl() is not implemented yet.");
-    }
-
-    /**
-     * Send a command to the Skype client.
-     * @param command The command to send.
-     */
-    protected void sendCommand(final String command) {
-        jni_sendMessage(command);
-    }
-
-    // for native
-    /**
-     * Native init method.
-     */
-    private native void jni_init();
-    
-    /**
-     * native event loop method.
-     *
-     */
-    private native void jni_windowProc();
-    
-    /**
-     * Native send message method.
-     * @param message The message to send.
-     */
-    private native void jni_sendMessage(String message);
-    
-    /***
-     * The native connect method.
-     *
-     */
-    private native void jni_connect();
-    
-    /**
-     * The native get installed path method.
-     * @return String with the absolute path to Skype.exe.
-     */
-    private native String jni_getInstalledPath();
-}
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
RCS file: /cvsroot/skype/eclipse/plugins/com.skype/.settings/org.eclipse.jdt.core.prefs,v
retrieving revision 1.4
diff -u -r1.4 org.eclipse.jdt.core.prefs
--- .settings/org.eclipse.jdt.core.prefs	26 Oct 2007 03:26:24 -0000	1.4
+++ .settings/org.eclipse.jdt.core.prefs	14 Feb 2008 04:46:11 -0000
@@ -1,4 +1,4 @@
-#Thu Oct 25 20:25:18 PDT 2007
+#Wed Feb 13 23:36:05 EST 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@@ -61,7 +61,6 @@
 org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
 org.eclipse.jdt.core.compiler.problem.unusedImport=warning
 org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
Index: src/com/skype/connector/windows/package-info.java
===================================================================
RCS file: src/com/skype/connector/windows/package-info.java
diff -N src/com/skype/connector/windows/package-info.java
--- src/com/skype/connector/windows/package-info.java	5 Apr 2007 04:21:32 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-/**
- * Provides the connector for Windows by SWT
- */
-package com.skype.connector.windows;
Index: src/com/skype/connector/windows/WindowsConnector.java
===================================================================
RCS file: src/com/skype/connector/windows/WindowsConnector.java
diff -N src/com/skype/connector/windows/WindowsConnector.java
--- src/com/skype/connector/windows/WindowsConnector.java	31 Jan 2008 22:13:24 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006-2007 Koji Hisano <hisano@xxxxxxxxx> - UBION Inc. Developer
- * Copyright (c) 2006-2007 UBION Inc. <http://www.ubion.co.jp/>
- * 
- * Copyright (c) 2006-2007 Skype Technologies S.A. <http://www.skype.com/>
- * 
- * Skype4Java is licensed under either the Apache License, Version 2.0 or
- * the Eclipse Public License v1.0.
- * You may use it freely in commercial and non-commercial products.
- * You may obtain a copy of the licenses at
- *
- *   the Apache License - http://www.apache.org/licenses/LICENSE-2.0
- *   the Eclipse Public License - http://www.eclipse.org/legal/epl-v10.html
- *
- * If it is possible to cooperate with the publicity of Skype4Java, please add
- * links to the Skype4Java web site <https://developer.skype.com/wiki/Java_API> 
- * in your web site or documents.
- * 
- * Contributors:
- * Koji Hisano - initial API and implementation
- * Kamil Sarelo - modified getInstalledPath() to support installing by an
- *                administrator account and added javadocs
- ******************************************************************************/
-package com.skype.connector.windows;
-
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.swt.internal.Callback;
-import org.eclipse.swt.internal.win32.OS;
-import org.eclipse.swt.internal.win32.TCHAR;
-import org.eclipse.swt.internal.win32.WNDCLASS;
-import org.eclipse.swt.widgets.Display;
-
-import com.skype.connector.AbstractConnectorListener;
-import com.skype.connector.Connector;
-import com.skype.connector.ConnectorException;
-import com.skype.connector.ConnectorListener;
-import com.skype.connector.ConnectorStatusEvent;
-
-/**
- * Implementation of the Windows connector based on the SWT libraries.
- * Please, use Win32Connector if SWT is not an option for you.
- */
-public final class WindowsConnector extends Connector {
-	/**
-	 * The singleton instance of the WindowsConnector class.
-	 */
-	private static class Instance {
-		static WindowsConnector instance = new WindowsConnector();
-	}
-
-	/**
-	 * Gets the singleton instance of the WindowsConnector class.
-	 * 
-	 * @return the singleton instance of the WindowsConnector class
-	 */
-	public static WindowsConnector getInstance() {
-		// Using 'Initialization On Demand Holder' Pattern
-		return Instance.instance;
-	}
-
-	/**
-	 * The attached response type (value is 0).
-	 * <p>
-	 * This response is sent when the client is attached.
-	 * </p>
-	 */
-	private static final int ATTACH_SUCCESS = 0;
-
-	/**
-	 * The pending authorization response type (value is 1).
-	 * <p>
-	 * This response is sent when Skype acknowledges the connection request and
-	 * is waiting for user confirmation. The client is not yet attached and must
-	 * wait for the {@ses #ATTACH_SUCCESS} message.
-	 * </p>
-	 */
-	private static final int ATTACH_PENDING_AUTHORIZATION = 1;
-
-	/**
-	 * The refused response type (value is 2).
-	 * <p>
-	 * This response is sent when the user has explicitly denied the access of
-	 * the client.
-	 * </p>
-	 */
-	private static final int ATTACH_REFUSED = 2;
-
-	/**
-	 * The not available response type (value is 3).
-	 * <p>
-	 * This response is sent when the API is not available at the moment because
-	 * no user is currently logged in. The client must wait for a
-	 * {@see #ATTACH_API_AVAILABLE} broadcast before attempting to connect
-	 * again.
-	 * </p>
-	 */
-	private static final int ATTACH_NOT_AVAILABLE = 3;
-
-	/**
-	 * The available response type (value is 0x8001).
-	 * <p>
-	 * This response is sent when the API becomes available.
-	 */
-	private static final int ATTACH_API_AVAILABLE = 0x8001;
-
-	/**
-	 * The window handle indicating all top-level windows in the system.
-	 * 
-	 * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/sendmessage.asp";>MSDN Library</a>
-	 */
-	private static final int HWND_BROADCAST = 0xffff;
-
-	/**
-	 * The window message type to pass data to another application.
-	 * 
-	 * @see <a href="http://search.msdn.microsoft.com/search/Redirect.aspx?title=WM_COPYDATA+Message&url=http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/dataexchange/datacopy/datacopyreference/datacopymessages/wm_copydata.asp";>MSDN Library</a>
-	 */
-	private static final int WM_COPYDATA = 0x004a;
-
-	/**
-	 * The window message type of the response for initiating communication from Skype.
-	 * 
-	 * @see #DISCOVER_MESSAGE_ID
-	 */
-	private static final int ATTACH_MESSAGE_ID = OS.RegisterWindowMessage(new TCHAR(0, "SkypeControlAPIAttach", true));
-
-	/**
-	 * The window message type of the request to initiate communication with Skype.
-	 * 
-	 * @see #ATTACH_MESSAGE_ID
-	 */
-	private static final int DISCOVER_MESSAGE_ID = OS.RegisterWindowMessage(new TCHAR(0, "SkypeControlAPIDiscover", true));
-
-	/** SWT display instance. */
-	private Display display;
-	/** SWT window instance. */
-	private TCHAR windowClass;
-	/** SWT window handle. */
-	private int windowHandle;
-	/** Skype Client window handle. */
-	private int skypeWindowHandle;
-
-	/**
-	 * Constructor.
-	 */
-	private WindowsConnector() {
-	}
-
-	/**
-	 * Returns the location of Skype.exe file from the MS Windows registry
-	 * (implicit it check if Skype is installed or not). Checks in the registry
-	 * if the key: {HKCU\Software\Skype\Phone, SkypePath} exists; if not, it
-	 * checks again but now for {HKLM\Software\Skype\Phone, SkypePath}; if HKCU
-	 * key does not exist but the HKLM key is present, Skype has been installed
-	 * from an administrator account has but not been used from the current
-	 * account; otherwise there is no Skype installed.
-	 * 
-	 * @return the path to the <code>Skype.exe</code> file if Skype is
-	 *         installed or <code>null</code>.
-	 */
-	@Override
-	public String getInstalledPath() {
-		String result = getRegistryValue(OS.HKEY_CURRENT_USER, "Software\\Skype\\Phone", "SkypePath");
-		if (result == null) {
-			result = getRegistryValue(OS.HKEY_LOCAL_MACHINE, "Software\\Skype\\Phone", "SkypePath");
-		}
-		return result;
-	}
-
-	/**
-	 * Returns the value to which the specified key and data is mapped in the
-	 * Windows registry, or null if the registry contains no mapping for this
-	 * key and/or data.
-	 * 
-	 * @param hKey registry hKey.
-	 * @param keyName registry key name.
-	 * @param dataName registry data name.
-	 * @return the value to which the specified key and data is mapped or
-	 *         <code>null</code>.
-	 */
-	private String getRegistryValue(final int hKey, final String keyName, final String dataName) {
-		final int[] phkResult = new int[1];
-		if (OS.RegOpenKeyEx(hKey, new TCHAR(0, keyName, true), 0, OS.KEY_READ, phkResult) != 0) {
-			return null;
-		}
-		String result = null;
-		final int[] lpcbData = new int[1];
-		if (OS.RegQueryValueEx(phkResult[0], new TCHAR(0, dataName, true), 0, null, (TCHAR) null, lpcbData) == 0) {
-			result = "";
-			int length = lpcbData[0] / TCHAR.sizeof;
-			if (length != 0) {
-				final TCHAR lpData = new TCHAR(0, length);
-				if (OS.RegQueryValueEx(phkResult[0], new TCHAR(0, dataName, true), 0, null, lpData, lpcbData) == 0) {
-					length = Math.max(0, lpData.length() - 1);
-					result = lpData.toString(0, length);
-				}
-			}
-		}
-		if (phkResult[0] != 0) {
-			OS.RegCloseKey(phkResult[0]);
-		}
-		return result;
-	}
-
-	/**
-	 * Initialize the connector.
-	 * @param timeout Maximum amout of time in millieseconds to initialize.
-	 * @throws ConnectorException when initialization cannot be completed.
-	 */
-	@Override
-	protected void initialize() throws ConnectorException {
-		final Object wait = new Object();
-		final String[] errorMessage = new String[1];
-		final Thread thread = new Thread("SkypeEventDispatcher") {
-			@Override
-			public void run() {
-				try {
-					display = new Display();
-					windowClass = new TCHAR(0, "" + System.currentTimeMillis() + (int) (Math.random() * 1000), true);
-					long tmpMessageReceived = new Callback(WindowsConnector.this, "messageReceived", 4).getAddress();
-					int messageReceived = (int) tmpMessageReceived;
-					if (messageReceived == 0) {
-						setErrorMessage("The Windows connector couldn't get a callback resource.");
-						return;
-					}
-					int hHeap = OS.GetProcessHeap();
-					if (hHeap == 0) {
-						setErrorMessage("The Windows connector couldn't get the heap handle.");
-						return;
-					}
-					int hInstance = OS.GetModuleHandle(null);
-					if (hInstance == 0) {
-						setErrorMessage("The Windows connector couldn't get the module handle.");
-						return;
-					}
-					WNDCLASS lpWndClass = new WNDCLASS();
-					lpWndClass.hInstance = hInstance;
-					lpWndClass.lpfnWndProc = messageReceived;
-					lpWndClass.style = OS.CS_BYTEALIGNWINDOW | OS.CS_DBLCLKS;
-					lpWndClass.hCursor = OS.LoadCursor(0, OS.IDC_ARROW);
-					if (lpWndClass.hCursor == 0) {
-						setErrorMessage("The Windows connector couldn't get a cursor handle.");
-						return;
-					}
-					int byteCount = windowClass.length() * TCHAR.sizeof;
-					lpWndClass.lpszClassName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-					if (lpWndClass.lpszClassName == 0) {
-						setErrorMessage("The Windows connector couldn't get a resource.");
-						return;
-					}
-					OS.MoveMemory(lpWndClass.lpszClassName, windowClass, byteCount);
-					if (OS.RegisterClass(lpWndClass) == 0) {
-						setErrorMessage("The Windows connector couldn't register a window class.");
-						return;
-					}
-					windowHandle = OS.CreateWindowEx(0, windowClass, null, OS.WS_OVERLAPPED, 0, 0, 0, 0, 0, 0, hInstance, null);
-					if (windowHandle == 0) {
-						setErrorMessage("The Windows connector couldn't create a window.");
-						return;
-					}
-				} finally {
-					synchronized (wait) {
-						wait.notify();
-					}
-				}
-				while (true) {
-					if (!display.readAndDispatch()) {
-						display.sleep();
-					}
-				}
-			};
-
-			private void setErrorMessage(String message) {
-				errorMessage[0] = message;
-			}
-		};
-		thread.setDaemon(true);
-		synchronized (wait) {
-			try {
-				thread.start();
-				wait.wait();
-				if (errorMessage[0] != null) {
-					throw new ConnectorException(errorMessage[0]);
-				}
-			} catch (final InterruptedException e) {
-				throw new ConnectorException("The Windows connector initialization was interrupted.", e);
-			}
-		}
-	}
-
-	/**
-	 * Implementation of the connect method for this connector.
-	 * @param timeout maximum amout of time to connect.
-	 * @return Status after connecting.
-	 * @throws ConnectorException when connection could not be established.
-	 */
-	protected Status connect(final int timeout) throws ConnectorException {
-		final Object wait = new Object();
-		final ConnectorListener listener = new AbstractConnectorListener() {
-			@Override
-			public void statusChanged(ConnectorStatusEvent event) {
-				synchronized (wait) {
-					wait.notify();
-				}
-			}
-		};
-		addConnectorListener(listener, false);
-		synchronized (wait) {
-			try {
-				while (true) {
-					OS.SendMessage(HWND_BROADCAST, DISCOVER_MESSAGE_ID, windowHandle, 0);
-					final long start = System.currentTimeMillis();
-					wait.wait(timeout);
-					if (timeout <= System.currentTimeMillis() - start) {
-						setStatus(Status.NOT_RUNNING);
-					}
-					final Status status = getStatus();
-					if (status != Status.PENDING_AUTHORIZATION) {
-						return status;
-					}
-					Thread.sleep(1000);
-				}
-			} catch (final InterruptedException e) {
-				throw new ConnectorException("Trying to connect was interrupted.", e);
-			} finally {
-				removeConnectorListener(listener);
-			}
-		}
-	}
-
-	/**
-	 * Send the application name to the Skype Client.
-	 * @param applicationName the new applicationname.
-	 * @throws ConnectorException when connection to Skype client has gone bad.
-	 */
-	protected void sendApplicationName(final String applicationName) throws ConnectorException {
-		final String command = "NAME " + applicationName;
-		execute(command, new String[] {command}, false);
-	}
-
-	/**
-	 * Gets called when a message is received.
-	 * @param hwnd Skype client window handle.
-	 * @param msg The message received.
-	 * @param wParam The window parameter.
-	 * @param lParam The lparam.
-	 * @return Status value.
-	 */
-	private int messageReceived(final int hwnd, final int msg, final int wParam, final int lParam) {
-		// Using 'if' statement because ATTACH_MESSAGE_ID is not a compile time constant
-		if (msg == ATTACH_MESSAGE_ID) {
-			switch (lParam) {
-				case ATTACH_PENDING_AUTHORIZATION :
-					setStatus(Status.PENDING_AUTHORIZATION);
-					break;
-				case ATTACH_SUCCESS :
-					skypeWindowHandle = wParam;
-					setStatus(Status.ATTACHED);
-					break;
-				case ATTACH_REFUSED :
-					setStatus(Status.REFUSED);
-					break;
-				case ATTACH_NOT_AVAILABLE :
-					setStatus(Status.NOT_AVAILABLE);
-					break;
-				case ATTACH_API_AVAILABLE :
-					setStatus(Status.API_AVAILABLE);
-					break;
-				default :
-					setStatus(Status.NOT_RUNNING);
-					break;
-			}
-			return 1;
-		} else if (msg == WM_COPYDATA) {
-			if (wParam == skypeWindowHandle) {
-				final int[] data = new int[3];
-				OS.MoveMemory(data, lParam, 12);
-				final int cbData = data[1];
-				final int lpData = data[2];
-				final int length = cbData;
-				final byte[] buffer = new byte[length];
-				OS.MoveMemory(buffer, lpData, length);
-				final byte[] string = new byte[buffer.length - 1];
-				System.arraycopy(buffer, 0, string, 0, string.length);
-				try {
-					final String message = new String(string, "UTF-8");
-					fireMessageReceived(message);
-					return 1;
-				} catch (final UnsupportedEncodingException e) {
-				}
-			}
-		}
-		return OS.DefWindowProc(hwnd, msg, wParam, lParam);
-	}
-
-	/**
-	 * Clean up and disconnect.
-	 */
-	protected void disposeImpl() {
-		// TODO WindowsConnector#disposeImpl()
-		throw new UnsupportedOperationException("WindowsConnector#disposeImpl() is not implemented yet.");
-	}
-
-	/**
-	 * Send a command to the Skype client.
-	 * @param command The command to send.
-	 */
-	protected void sendCommand(final String command) {
-		display.asyncExec(new Runnable() {
-			public void run() {
-				try {
-					final byte[] data = (command + "\u0000").getBytes("UTF-8");
-					final int hHeap = OS.GetProcessHeap();
-					final int pMessage = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, data.length);
-					OS.MoveMemory(pMessage, data, data.length);
-					OS.SendMessage(skypeWindowHandle, WM_COPYDATA, windowHandle, new int[] {0, data.length, pMessage});
-					OS.HeapFree(hHeap, 0, pMessage);
-				} catch (final UnsupportedEncodingException e) {
-				}
-			}
-		});
-	}
-}
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/skype/eclipse/plugins/com.skype/META-INF/MANIFEST.MF,v
retrieving revision 1.7
diff -u -r1.7 MANIFEST.MF
--- META-INF/MANIFEST.MF	12 Dec 2007 22:11:45 -0000	1.7
+++ META-INF/MANIFEST.MF	14 Feb 2008 04:46:11 -0000
@@ -6,13 +6,8 @@
 Bundle-Version: 0.3.0.qualifier
 Bundle-Activator: com.skype.internal.Activator
 Bundle-Localization: plugin
-Require-Bundle: org.eclipse.swt
 Eclipse-LazyStart: true
 Export-Package: com.skype,
  com.skype.connector,
- com.skype.connector.linux,
- com.skype.connector.osx,
- com.skype.connector.win32,
- com.skype.connector.windows,
  com.skype.internal;x-internal:=true
 Import-Package: org.osgi.framework;version="1.4.0"
Index: src/com/skype/connector/linux/LinuxConnector.java
===================================================================
RCS file: /cvsroot/skype/eclipse/plugins/com.skype/src/com/skype/connector/linux/LinuxConnector.java,v
retrieving revision 1.3
diff -u -r1.3 LinuxConnector.java
--- src/com/skype/connector/linux/LinuxConnector.java	11 Apr 2007 19:59:23 -0000	1.3
+++ src/com/skype/connector/linux/LinuxConnector.java	14 Feb 2008 04:46:11 -0000
@@ -20,17 +20,12 @@
  ******************************************************************************/
 package com.skype.connector.linux;
 
-import java.io.File;
-
 import com.skype.connector.ConnectorException;
-import com.skype.connector.ConnectorUtils;
 /**
  * Implementation of the Linux connector class.
  * Only works for DBus 0.22 not newer DBus or X11 messaging.
  */
 public final class LinuxConnector extends com.skype.connector.Connector {
-    /** Filename of the DLL. */
-    private static final String LIBFILENAME = "libJSA.so";
 
     /** Singleton instance of this connector. */
 	private static LinuxConnector _instance = null;
@@ -40,20 +35,7 @@
 	 * Use getInstance to get an instance.
 	 */
 	private LinuxConnector(){
-		try {
-			System.loadLibrary("JSA");
-		} catch (Throwable e) {
-			try {
-				if (!ConnectorUtils.checkLibraryInPath(LIBFILENAME)) {
-		    		ConnectorUtils.extractFromJarToTemp(LIBFILENAME);   
-		    		
-		    		System.load(System.getProperty("java.io.tmpdir")+File.separatorChar+LIBFILENAME);
-				}
-			} catch (Exception e2) {
-				setStatus(Status.NOT_AVAILABLE);
-                return;
-			}
-		}   
+		System.loadLibrary("JSA");
 		setStatus(Status.PENDING_AUTHORIZATION);
 	}
 

Back to the top