Hi,
After a long hiatus, I finally got back to work on some fixes to skype api. The new 1.3 version includes fixes for the following bugs:
- A bug that would crash the library under Ubuntu linux 11.04 (some NPEs)
- The mac version was not firing the notification to listeners when a new message was received
- Two applications using skype-java-api would crash under windows because the dynamic libraries were extracted directly under temp directory under windows. Now, each instance use their own directoies
- Skype.addCallListener would add a listener even if the connection could not be made
- Skype.removeCallListener throws NPE if no listeners were not registered
- Added a README to explain how to use the library in your maven project
- Windows libraries are now statically linked. This UnsatisfiedLink problems if a system does not have vc90 library
If you find any problems, please, feel free to report in the project's github issue page:
https://github.com/taksan/skype-java-api/issues
Thanks!
Here I report some of my experiences developing Skype2Gmail and improving Skype4Java api
Thursday, December 22, 2011
Monday, May 23, 2011
Java Tray Icon Transparency Under Linux
Well, like many people before me, I had problems with my tray icons under linux. The JDK implementation has a bug that renders tray icons with transparency with an ugly gray background instead of the transparent background.
This is really annoying to me and I really don't like the idea of providing an application that looks half-assed. So, I actually got around this problem creating a small native library that implements the tray icon using gtk.
So, if you end up having tray icon problems, you may use my little artifact. The source code is here. I also deployed in the central, you can use it putting the following dependency:
<groupId>com.github.taksan</groupId>
<artifactId>native-tray-adapter</artifactId>
<version>1.1</version>
The usage is very simple:
Enjoy!
This is really annoying to me and I really don't like the idea of providing an application that looks half-assed. So, I actually got around this problem creating a small native library that implements the tray icon using gtk.
So, if you end up having tray icon problems, you may use my little artifact. The source code is here. I also deployed in the central, you can use it putting the following dependency:
<groupId>com.github.taksan</groupId>
<artifactId>native-tray-adapter</artifactId>
<version>1.1</version>
The usage is very simple:
SystemTrayAdapter trayAdapter = SystemTrayProvider.getSystemTray();
URL imageUrl = getClass().getResource("myImage.svg");
String tooltip = "I'm transparent under linux!";
PopupMenu popup = produceMyPopupMenu();
TrayIconAdapter trayIconAdapter = trayAdapter.createAndAddTrayIcon(
imageUrl,
tooltip,
popup);
Enjoy!
Friday, May 6, 2011
First run bug
I just uploaded a new version fixing a bug that would make the application crash the first time you run against a non-synchronized account.
I didn't notice this bug because I was testing against an account that already had the "Skype-Chats" label (shame on me =).
See ya.
I didn't notice this bug because I was testing against an account that already had the "Skype-Chats" label (shame on me =).
See ya.
Monday, May 2, 2011
Alpha version available
I'm glad to announce that I have an alpha version that does mostly everything. You can grab it from here or just use the panel in the side frame.
To use it, just do:
java - jar skype2gmail-1.0.jar --mail
It will ask whatever it needs to synchronize. And you can also use as the following:
java - jar skype2gmail.jar --disk
It will dump all your messages to directory in the user home ($HOME/.skype2gmail/history).
Feel free to report any bugs or send any feature requests!
Enjoy!
To use it, just do:
java - jar skype2gmail-1.0.jar --mail
It will ask whatever it needs to synchronize. And you can also use as the following:
java - jar skype2gmail.jar --disk
It will dump all your messages to directory in the user home ($HOME/.skype2gmail/history).
Feel free to report any bugs or send any feature requests!
Enjoy!
It is hard to trash messages from gmail..
I found out that it is very hard to remove a message from gmail using the LDAP api. At first, I just tried doing the following:
This should work for common ldap accounts, but it doesn't work properly in gmail. It just removes the message from the "folder", which is actually mapped as a gmail label. The message will remain under "All messages". Next, I found that I should move the message to the trash folder:
Well, it did work... kinda. A problem still remained: if you send a new message with the same sender and subject, the "deleted" message gets resurrected.
I couldn't figure out how to remove it permanently. I got around the problem changing the subject, when need...
((Message)message).setFlag(Flags.Flag.DELETED, true); ... folder.close(true)
This should work for common ldap accounts, but it doesn't work properly in gmail. It just removes the message from the "folder", which is actually mapped as a gmail label. The message will remain under "All messages". Next, I found that I should move the message to the trash folder:
Folder skypeFolder = mailStore.getFolder("Skype-Chats"); Folder trash = mailStore.getFolder("[Gmail]/Trash"); Message[] messagesToRemove = new Message[]{messageToRemove}; skypeFolder.copyMessages(messagesToRemove, trash); // and just to make sure mimeMessage.setFlag(Flags.Flag.DELETED, true);
Well, it did work... kinda. A problem still remained: if you send a new message with the same sender and subject, the "deleted" message gets resurrected.
I couldn't figure out how to remove it permanently. I got around the problem changing the subject, when need...
Sunday, April 24, 2011
Skype4Java Mavenized API released!
I'm glad to announce that I have released the first version of the mavenized skype api to the maven central repo:
http://repo2.maven.org/maven2/com/github/taksan/skype-java-api/
First version is 1.1 (err, don't wanna talk about 1.0 :P), please enjoy!
I actually thought I would have more trouble to release the project in the central repo, but it was actually quite easy. Ok, there are several requirements, but they are easy to meet. The only "tricky" one was that I needed a valid domain to use as groupId. At first, I thought I would have to pay for a domain and keep it forever, but then I found out that I could use github's domain for this purpose (as you will notice if you read the pom).
I would like to thank Koji Hisano, I got in touch with him by mail to ask whether he would be okay with this move, since I mostly copied his project, and I got full support from him.
Now, all of you who'd like to use Skype4Java / Skype Java Api, please enjoy and feel free to talk back.
This version should support:
- Windows 32 and 64 bit
- Linux 32 and 64 bit
- Mac OS 32 bit
It is possible to run under MacOS 64 bit with compatibility mode (java -d32).
See ya!
http://repo2.maven.org/maven2/com/github/taksan/skype-java-api/
First version is 1.1 (err, don't wanna talk about 1.0 :P), please enjoy!
I actually thought I would have more trouble to release the project in the central repo, but it was actually quite easy. Ok, there are several requirements, but they are easy to meet. The only "tricky" one was that I needed a valid domain to use as groupId. At first, I thought I would have to pay for a domain and keep it forever, but then I found out that I could use github's domain for this purpose (as you will notice if you read the pom).
I would like to thank Koji Hisano, I got in touch with him by mail to ask whether he would be okay with this move, since I mostly copied his project, and I got full support from him.
Now, all of you who'd like to use Skype4Java / Skype Java Api, please enjoy and feel free to talk back.
This version should support:
- Windows 32 and 64 bit
- Linux 32 and 64 bit
- Mac OS 32 bit
It is possible to run under MacOS 64 bit with compatibility mode (java -d32).
See ya!
Sunday, April 17, 2011
Removed SWT support and XCode build files
In the end, the API will be released without support for using the SWT version of the Windows API. I got it working pretty well using the DLLs, so it will never be an option to use the SWT version ever again.
Besides the obvious reason for not having to support and waste time a redundant alternative, I have a much more important reason to give up on SWT: the fact that it is not available as a maven dependency in the central repo. That would prevent me from deploying the project in the central.
The next thing I removed completely: any sort of support for XCode. There are just a makefile to handle the whole process, so the build is straight forward: make<enter> from the command line! The make file just requires g++4.2 installed, so it already uses only free and simple tools to build.
The windows DLLs are also buildable from the command line now, but it still requires Visual Studio's installation. In the future, I'll try to build it using mingw to build the DLLs, but I'll certainly leave that for the next version.
Anyway, this sort of stuff is only needed for those wishing to rebuild the native libraries.
Besides the obvious reason for not having to support and waste time a redundant alternative, I have a much more important reason to give up on SWT: the fact that it is not available as a maven dependency in the central repo. That would prevent me from deploying the project in the central.
The next thing I removed completely: any sort of support for XCode. There are just a makefile to handle the whole process, so the build is straight forward: make<enter> from the command line! The make file just requires g++4.2 installed, so it already uses only free and simple tools to build.
The windows DLLs are also buildable from the command line now, but it still requires Visual Studio's installation. In the future, I'll try to build it using mingw to build the DLLs, but I'll certainly leave that for the next version.
Anyway, this sort of stuff is only needed for those wishing to rebuild the native libraries.
Release is closer than ever... again
Well, since my last post, I actually didn't thought about Mac. Then, I decided to make sure the API was working on Mac and it was a hell of work to get it even compiling.
The first problem was how to start testing. I don't own a mac and I sure wouldn't buy one just to code a few lines. I found a virtualbox image on torrent and tried to start it. The first problem, it wouldn't kick in, because the image requires VT-x and I was not pleased to find out that my Vaio didn't have the option to enable it in the BIOs. In the end, I found out that my model had a BIOs update at Sony's site that enables the hardware virtualization option.
Ok, image up and running, I tried to run skype2gmail... and it obviously didn't work. It complained on the native library, that it was not build for my OS archtecture (64bit).
Ok, next problem, how to compile the native code? I never programmed for Mac, so I had some trouble finding out that I needed XCode to build it. Ok, I got it (XCode 3.x) and the next problem: it required another Leopard version. Actually, I just had to download 4Gb of updates or so to get it to accept XCode.
After so long, I got it working and tried to build the project, just to find out that it wouldn't because of deprecated jam targets (then I found the project was originally made for Project Builder, the XCode predecessor).
Well, I was so pissed that XCode completely refused to upgrade the jam targets and did not provided any clue on how to redo it, that I almost gave up on mac support. But I finally cooled off, and tried to understand the project's text file to find out what it was trying to do. I figured it out eventually and remade the build files, to use ANT, MAKE and NO xcode at all. HA! Take that damn xcode! :P
The next problem was to the Skype.framork shared library. It required to install the damn thing in a fixed relative place. I didn't want to force the user to install anything in his OS to run skype2gmail. So I decided that the framework should be inside the jar somehow, but this left some problems: first, I would have to extract it at runtime and I would have change its install name. I tried to change the install name using install_name_tool, but it didn't work at all. I ended opening the binary with a hex tool and changed the path inside the binary by hand. It worked like a charm and know I have the library working without any external dependency,
The last problem was that the library wasn't working at all. I found out that mac's Skype did not replied the GET CHATMESSAGE appropriately, starting the reply with CHATMESSAGE. It insisted in replying with "MESSAGE" instead. Obviously, the API was not prepared for that and didn't recognize the reply. I fixed in the native library to prepend the "CHAT" part if the reply started with "MESSAGE".
In the end, I got it working. Still, the mac api version, like the first linux api version, is not very consistent. Sometimes, skype just doesn't reply the CHATMESSAGE reply. I noticed that sometimes, Mac's Skype was very slow to reply. I may improve stability just by increasing the timeouts.
Anyway, I now have that nice feeling of overcoming a hard challenge, since it works ;)
The first problem was how to start testing. I don't own a mac and I sure wouldn't buy one just to code a few lines. I found a virtualbox image on torrent and tried to start it. The first problem, it wouldn't kick in, because the image requires VT-x and I was not pleased to find out that my Vaio didn't have the option to enable it in the BIOs. In the end, I found out that my model had a BIOs update at Sony's site that enables the hardware virtualization option.
Ok, image up and running, I tried to run skype2gmail... and it obviously didn't work. It complained on the native library, that it was not build for my OS archtecture (64bit).
Ok, next problem, how to compile the native code? I never programmed for Mac, so I had some trouble finding out that I needed XCode to build it. Ok, I got it (XCode 3.x) and the next problem: it required another Leopard version. Actually, I just had to download 4Gb of updates or so to get it to accept XCode.
After so long, I got it working and tried to build the project, just to find out that it wouldn't because of deprecated jam targets (then I found the project was originally made for Project Builder, the XCode predecessor).
Well, I was so pissed that XCode completely refused to upgrade the jam targets and did not provided any clue on how to redo it, that I almost gave up on mac support. But I finally cooled off, and tried to understand the project's text file to find out what it was trying to do. I figured it out eventually and remade the build files, to use ANT, MAKE and NO xcode at all. HA! Take that damn xcode! :P
The next problem was to the Skype.framork shared library. It required to install the damn thing in a fixed relative place. I didn't want to force the user to install anything in his OS to run skype2gmail. So I decided that the framework should be inside the jar somehow, but this left some problems: first, I would have to extract it at runtime and I would have change its install name. I tried to change the install name using install_name_tool, but it didn't work at all. I ended opening the binary with a hex tool and changed the path inside the binary by hand. It worked like a charm and know I have the library working without any external dependency,
The last problem was that the library wasn't working at all. I found out that mac's Skype did not replied the GET CHATMESSAGE appropriately, starting the reply with CHATMESSAGE. It insisted in replying with "MESSAGE" instead. Obviously, the API was not prepared for that and didn't recognize the reply. I fixed in the native library to prepend the "CHAT" part if the reply started with "MESSAGE".
In the end, I got it working. Still, the mac api version, like the first linux api version, is not very consistent. Sometimes, skype just doesn't reply the CHATMESSAGE reply. I noticed that sometimes, Mac's Skype was very slow to reply. I may improve stability just by increasing the timeouts.
Anyway, I now have that nice feeling of overcoming a hard challenge, since it works ;)
Tuesday, March 22, 2011
Version 1.0 is in the horizon...
As of now I have a working application that can either write the chats to the disk or upload the chat messages to a gmail account! Woohoo!
I believe I finally stabilized on a format, for messages and signatures (used to validate and merge chats) and I believe I won't diverge much from the current format now.
Some interesting things I learned from uploading messages to gmail:
- It is not enough to set the "Date" header in the mime message, you need to set the sent date as well to make sure the messages are sorted correctly
- After uploading messages, when the messages are retrieved by the application, I found that all line breaks in the message body were converted to CRLF (instead of the LF that were in the messages when I uploaded).
- It is essential to user MimeUtilty encode/decode when setting mail header values, specially if they have accents.
Well, as I expected, implementing the first version that could upload to gmail wasn't hard after all the work I have done implementing the disk version.
I still have to do some tests running the application from two different computers running the same account. Also, even tough I tested chat merging against the disk history, I still didn't test against the mail messages.
As for the next step in the development: I must make it work under windows and linux 32bit. I just found the other day that my mavenized skype4java isn't working under windows.. I won't release the first version before making sure everything works under windows and linux at least. I can't guarantee OSX, since I can't test it, but I'll make an effort.
That is for now. See ya.
I believe I finally stabilized on a format, for messages and signatures (used to validate and merge chats) and I believe I won't diverge much from the current format now.
Some interesting things I learned from uploading messages to gmail:
- It is not enough to set the "Date" header in the mime message, you need to set the sent date as well to make sure the messages are sorted correctly
- After uploading messages, when the messages are retrieved by the application, I found that all line breaks in the message body were converted to CRLF (instead of the LF that were in the messages when I uploaded).
- It is essential to user MimeUtilty encode/decode when setting mail header values, specially if they have accents.
Well, as I expected, implementing the first version that could upload to gmail wasn't hard after all the work I have done implementing the disk version.
I still have to do some tests running the application from two different computers running the same account. Also, even tough I tested chat merging against the disk history, I still didn't test against the mail messages.
As for the next step in the development: I must make it work under windows and linux 32bit. I just found the other day that my mavenized skype4java isn't working under windows.. I won't release the first version before making sure everything works under windows and linux at least. I can't guarantee OSX, since I can't test it, but I'll make an effort.
That is for now. See ya.
Thursday, March 17, 2011
Skype 2 Disk
As of now I managed to get everything I need to save the history to the disk and update the files, merging when needed.
It is now possible to take a history from another computer, for example, and run skype2gmail to update the files, consolidating without duplications. Implementing this feature enabled me to develop all the concepts I need to send the messages to gmail and update them, also without duplication. I just need to develop few classes that make the connection and edit gmail using ldap.
I already made some simple concept tests that are capable of sending mail, so I believe the first working version will soon be out. The first version will need to be ran from the command line once and will require an external mean to keep running once in a while. Also, there are a lot of optimizations that will be left for the next version.
So, I'm planning the following features:
- can store the chat history in a directory in the filesystem
- can store the chat history in a gmail or google apps mail account
- in both cases, it will be able to consolidate the chats, which means there won't be duplicate messages
- it will be "parallel" safe, that is, running two instances in different machines won't conflict when updating gmail at the same time.
- will run under linux (both 32-bit and 64-bit) and windows
Limitations:
- will always fetch the entire history to update the storage (gmail/disk)
- won't send store voice chats (I don't know whether I'll ever do that)
- won't regurlarly automatically
- will require the user to provide the mail credentials in a file in the .skype2gmail directory or ask every run
- created mail messages won't have the sender actual mail, only his skype name
- might not work under OS-X (I don't have means to test it under OS-X)
Some features I'm planning for the future:
- use a mechanism to detect whether the last update was in less than 24 hours in the giving machine; if so, I can use only the recent chat history to update the storage, which is A LOT faster (almost a minute vs less than 2 seconds)
- create indexes to speedup storage update (instead of looking all entries, it will use the index to learn which entries need to be updated just by checking the index)
- run in the system tray regularly, with configurable schedule
- since it may keep running, it may only ask gmail credentials when starting and store in the memory (don't need to ask again in the next update)
- will keep allowing the user to save the credentials in the filesystem
- integrate with gnome-keyring to store credentials
- will be more robust (this depends on skype4java fixes)
- will allow the user to specify, for each skype name, a mail address, so the chat messages will in gmail will have the correct mail address
This is only what I'm able to remember now. I'll certainly take requests from the community once the application is at least implementing the above features (heck, I might take good suggestions anytime) =)
It is now possible to take a history from another computer, for example, and run skype2gmail to update the files, consolidating without duplications. Implementing this feature enabled me to develop all the concepts I need to send the messages to gmail and update them, also without duplication. I just need to develop few classes that make the connection and edit gmail using ldap.
I already made some simple concept tests that are capable of sending mail, so I believe the first working version will soon be out. The first version will need to be ran from the command line once and will require an external mean to keep running once in a while. Also, there are a lot of optimizations that will be left for the next version.
So, I'm planning the following features:
- can store the chat history in a directory in the filesystem
- can store the chat history in a gmail or google apps mail account
- in both cases, it will be able to consolidate the chats, which means there won't be duplicate messages
- it will be "parallel" safe, that is, running two instances in different machines won't conflict when updating gmail at the same time.
- will run under linux (both 32-bit and 64-bit) and windows
Limitations:
- will always fetch the entire history to update the storage (gmail/disk)
- won't send store voice chats (I don't know whether I'll ever do that)
- won't regurlarly automatically
- will require the user to provide the mail credentials in a file in the .skype2gmail directory or ask every run
- created mail messages won't have the sender actual mail, only his skype name
- might not work under OS-X (I don't have means to test it under OS-X)
Some features I'm planning for the future:
- use a mechanism to detect whether the last update was in less than 24 hours in the giving machine; if so, I can use only the recent chat history to update the storage, which is A LOT faster (almost a minute vs less than 2 seconds)
- create indexes to speedup storage update (instead of looking all entries, it will use the index to learn which entries need to be updated just by checking the index)
- run in the system tray regularly, with configurable schedule
- since it may keep running, it may only ask gmail credentials when starting and store in the memory (don't need to ask again in the next update)
- will keep allowing the user to save the credentials in the filesystem
- integrate with gnome-keyring to store credentials
- will be more robust (this depends on skype4java fixes)
- will allow the user to specify, for each skype name, a mail address, so the chat messages will in gmail will have the correct mail address
This is only what I'm able to remember now. I'll certainly take requests from the community once the application is at least implementing the above features (heck, I might take good suggestions anytime) =)
Skype4Java API
Along the project, I took the mission of making the Skype4Java project more reliable. I found that the Skype API under linux is very tricky and doesn't always works as expected. I found several problems.
First, after running for some time, the X-11 Atom "_SKYPE_INSTANCE" just disappears. After that, the skype4java doesn't be able to attach to the running skype and, of course, skype2gmail stops working.
Well, I changed the code and used a workaround, so the native library is now able to find the skype window used by the API under linux even when the atom is gone.
The second problem I faced was mixed responses. Sometimes when two messages are sent through the skype api "very fast", the former message's response was truncated and the later's message response was concatenated. There's no need to say how troubling this was. The application keeps waiting for both responses and got stuck forever.
Fixed the concatenation problem, which was a bug in the native library, but I still couldn't figure out why the first message's response was truncated. I worked around this problem changing the way the java api works. Instead of "ping ponging" after every request (to keep alive), when the timeout comes I changed to retry the request. This made the library much more reliable and it seems it works all the time (except when the api fails to connect to skype, which is happening sometimes).
Sometime in the future I'll have to address mainly in the following problems with the Skype4Java:
- Sometimes (not very often), the application simply doesn't connect. It seems the application sends the request to skype, but there's no response. It always work to retry just after canceling the application. I suppose I can fix by retrying the connection after a short timeout.
- I intend to figure why the native library receives partial messages sometimes. For now, after the connection is established, the application always works to the end, so the workaround seems to be working fine, but it might be the reason the connection fails sometimes. Also, the application will certainly work faster when this problem is fixed, since the requests won't have to be retried as often.
Oh yeah, this development is getting more interesting every day
First, after running for some time, the X-11 Atom "_SKYPE_INSTANCE" just disappears. After that, the skype4java doesn't be able to attach to the running skype and, of course, skype2gmail stops working.
Well, I changed the code and used a workaround, so the native library is now able to find the skype window used by the API under linux even when the atom is gone.
The second problem I faced was mixed responses. Sometimes when two messages are sent through the skype api "very fast", the former message's response was truncated and the later's message response was concatenated. There's no need to say how troubling this was. The application keeps waiting for both responses and got stuck forever.
Fixed the concatenation problem, which was a bug in the native library, but I still couldn't figure out why the first message's response was truncated. I worked around this problem changing the way the java api works. Instead of "ping ponging" after every request (to keep alive), when the timeout comes I changed to retry the request. This made the library much more reliable and it seems it works all the time (except when the api fails to connect to skype, which is happening sometimes).
Sometime in the future I'll have to address mainly in the following problems with the Skype4Java:
- Sometimes (not very often), the application simply doesn't connect. It seems the application sends the request to skype, but there's no response. It always work to retry just after canceling the application. I suppose I can fix by retrying the connection after a short timeout.
- I intend to figure why the native library receives partial messages sometimes. For now, after the connection is established, the application always works to the end, so the workaround seems to be working fine, but it might be the reason the connection fails sometimes. Also, the application will certainly work faster when this problem is fixed, since the requests won't have to be retried as often.
Oh yeah, this development is getting more interesting every day
Wednesday, March 2, 2011
Recording your skype chat with Gmail
I've started writing a java application that will send your skype chat history to any gmail or google apps account you have, even if you use skype in multiple computers.
The first version is already completed and just dumps your chats in the file system. The next step is to make chat history consolidation, allowing dumping multiple skype histories in the same directory.
And finally, the first release will send your chats to a gmail account.
Keep checking to learn when it is done!
The first version is already completed and just dumps your chats in the file system. The next step is to make chat history consolidation, allowing dumping multiple skype histories in the same directory.
And finally, the first release will send your chats to a gmail account.
Keep checking to learn when it is done!
Subscribe to:
Posts (Atom)