today I had discovered these great Java API. First I tried to log in at the icq server with my account and I was happy when that worked.
Then I tried to do something more but I wasn't really succesfull. So I want to ask here if it's possible that someone shows me a code of an easy program that logs in on icq and gets the ID's of all Users in my ICQ-List (maybe the ID's can be saved in an Array?) and finally also the status of them.
It would be great if someone could do this. Thank's a lot
Sebastian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all, great to hear you find this lib useful.
Getting your contacts from the server is a beta feature only available in the sourcecode repository (you can log in and download/compile it yourself). We never got around to releasing it as a download unfortunately. Perhaps I could look in to doing that some time if there is an interest..
There are several listener interfaces your code can implement though (e.g. StatusListener, MessagingListener, ContactListListener). For example:
OscarConnection myCon = new OscarConnection(ICQSERVERADDRESS, ICQSERVERPORT, CONTACT_UID, PASSWORD);
Hi ! Yes the specified error seems to say the AuthorizationReply recieved from the server didn't allow you to connect, or was not recieved, or whatever else where wrong during the login.
You should add these two lines in your icq() constructor:
con.getPacketAnalyser().setDebug(true);
con.getPacketAnalyser().getJarClassLoader().setPath(<path to the joscalib jar>);
Thus, if you execute your application from a console you should get many useful logs as your program starts like :
Warning : No jar file found. Packet unmarshalling won't be possible. Please verify your classpath
Received 1 - 3
--> JOscarLib.Packet.Received.ServerReady__1_3 loaded
Received 1 - 24
--> JOscarLib.Packet.Received.ServerFamilies__1_24 loaded
Received 1 - 19
--> JOscarLib.Packet.Received.Motd__1_19 loaded
Received 1 - 7
--> JOscarLib.Packet.Received.RateReply__1_7 loaded
Received 2 - 3
--> JOscarLib.Packet.Received.LocationRightsReply__2_3 loaded
Received 1 - 15
--> JOscarLib.Packet.Received.OnlineInfoResp__1_15 loaded
Received 3 - 3
--> JOscarLib.Packet.Received.BuddyListRightsReply__3_3 loaded
And so on.
These logs would help finding out the problem.
y the way, the contact list managment is quite functionnal in the most recent sources and i think it ought to be released soon. It's indeed a very useful feature.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately it doesn't work that I get a message when someone signs in or when I get a message. By the way, when I start my program I also get the message: "Client error : Problem due to : null". Please: What is it I'm doing wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The error comes from the code that receives authorization data from the ICQ server. In other words, your login seems to be failing, so no further events are processed (explaining your observations).
The login server+port you are using are correct. Please verify that your UIN / password are correct as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know that my UIN and my password are correct. I know that because I checked this and for example if I have the ICQ-Client opened and I execute my program I get the message from ICQ that someone signed in to my account from a different computer. So I think the log in can’t be the problem.
Have you may any other ideas what the problem can be?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
today I had discovered these great Java API. First I tried to log in at the icq server with my account and I was happy when that worked.
Then I tried to do something more but I wasn't really succesfull. So I want to ask here if it's possible that someone shows me a code of an easy program that logs in on icq and gets the ID's of all Users in my ICQ-List (maybe the ID's can be saved in an Array?) and finally also the status of them.
It would be great if someone could do this. Thank's a lot
Sebastian
Hi sebastian,
First of all, great to hear you find this lib useful.
Getting your contacts from the server is a beta feature only available in the sourcecode repository (you can log in and download/compile it yourself). We never got around to releasing it as a download unfortunately. Perhaps I could look in to doing that some time if there is an interest..
There are several listener interfaces your code can implement though (e.g. StatusListener, MessagingListener, ContactListListener). For example:
OscarConnection myCon = new OscarConnection(ICQSERVERADDRESS, ICQSERVERPORT, CONTACT_UID, PASSWORD);
myCon.addObserver(this);
myCon.addStatusListener(this);
myCon.addMessagingListener(this);
This will cause interesting events to be sent to your code, such as contact status changes, incoming messages, etc. Have a look at those.
Hi ! Yes the specified error seems to say the AuthorizationReply recieved from the server didn't allow you to connect, or was not recieved, or whatever else where wrong during the login.
You should add these two lines in your icq() constructor:
con.getPacketAnalyser().setDebug(true);
con.getPacketAnalyser().getJarClassLoader().setPath(<path to the joscalib jar>);
Thus, if you execute your application from a console you should get many useful logs as your program starts like :
Warning : No jar file found. Packet unmarshalling won't be possible. Please verify your classpath
Received 1 - 3
--> JOscarLib.Packet.Received.ServerReady__1_3 loaded
Received 1 - 24
--> JOscarLib.Packet.Received.ServerFamilies__1_24 loaded
Received 1 - 19
--> JOscarLib.Packet.Received.Motd__1_19 loaded
Received 1 - 7
--> JOscarLib.Packet.Received.RateReply__1_7 loaded
Received 2 - 3
--> JOscarLib.Packet.Received.LocationRightsReply__2_3 loaded
Received 1 - 15
--> JOscarLib.Packet.Received.OnlineInfoResp__1_15 loaded
Received 3 - 3
--> JOscarLib.Packet.Received.BuddyListRightsReply__3_3 loaded
And so on.
These logs would help finding out the problem.
y the way, the contact list managment is quite functionnal in the most recent sources and i think it ought to be released soon. It's indeed a very useful feature.
Hi Daniel,
thank's for your fast answer.
I tried to do this now and that's the code I programmed:
public class icq extends JFrame implements StatusListener, MessagingListener, Observer {
}
Unfortunately it doesn't work that I get a message when someone signs in or when I get a message. By the way, when I start my program I also get the message: "Client error : Problem due to : null". Please: What is it I'm doing wrong?
Sebastian,
The error comes from the code that receives authorization data from the ICQ server. In other words, your login seems to be failing, so no further events are processed (explaining your observations).
The login server+port you are using are correct. Please verify that your UIN / password are correct as well.
Daniel,
I know that my UIN and my password are correct. I know that because I checked this and for example if I have the ICQ-Client opened and I execute my program I get the message from ICQ that someone signed in to my account from a different computer. So I think the log in can’t be the problem.
Have you may any other ideas what the problem can be?