Menu

Problem with send ICQ message...

2008-06-01
2012-09-15
  • Sergey Komarof

    Sergey Komarof - 2008-06-01

    Hi,
    I programmend simple code of sending ICQ message:

    package Send;
    import java.util.;
    import JOscarLib.Tool.
    ;
    import JOscarLib.Core.;
    import JOscarLib.Integration.Event.
    ;
    import JOscarLib.Setting.Enum.*;

    public class SampleSendMessage implements Observer {

    private static final String SERVER = "login.icq.com";
    private static final int PORT = 5190;
    private OscarConnection con;
    private String receiver;

    public SampleSendMessage(String login, String password, String receiver) {
    this.receiver = receiver;
    con = new OscarConnection(SERVER, PORT, login, password);
    con.getPacketAnalyser().setDebug(true);
    / to be notify when connection is ready. /
    con.addObserver(this);
    }

    public void update(Observable obs, Object obj) {
    OscarInterface.sendMessage(con, receiver, "Dude, I'm online !");
    }

    public static void main(String[] args) {
    SampleSendMessage sample = new SampleSendMessage("my_uin", "my_password", "receiver_uin");

    }
    }

    When I start my program I also get the message: "Client error : Problem due to : null".
    I know that my UIN and my password are correct!!!
    Please: Who can tell me what is it wrong in this code?

    Thank's a lot
    Serg

     
    • Igor

      Igor - 2008-06-12

      Hi,
      I have same problem, but I use latest sources and I don't get the message "Client error : Problem due to : null".
      But messages to receiver not deliver.

      Debug:
      Received 1 - 3
      --> JOscarLib.Packet.Received.ServerReady1_3 loaded
      Received 1 - 24
      --> JOscarLib.Packet.Received.ServerFamilies
      1_24 loaded
      Received 1 - 19
      --> JOscarLib.Packet.Received.Motd1_19 loaded
      Received 1 - 7
      --> JOscarLib.Packet.Received.RateReply
      1_7 loaded
      Received 2 - 3
      --> JOscarLib.Packet.Received.LocationRightsReply2_3 loaded
      Received 3 - 3
      --> JOscarLib.Packet.Received.BuddyListRightsReply
      3_3 loaded
      Received 1 - 15
      --> JOscarLib.Packet.Received.OnlineInfoResp1_15 loaded
      Received 4 - 5
      --> JOscarLib.Packet.Received.ICBMParametersReply
      4_5 loaded
      Received 9 - 3
      --> JOscarLib.Packet.Received.BosRightReply9_3 loaded
      Received 19 - 3
      max contacts : 3000
      max groups : 51
      max visible contacts : 1000
      max invisibles contacts : 1000
      max vis/inv bitmask : 1
      max presence info fields : 1
      max ignore list entries : 128
      --> JOscarLib.Packet.Received.RespSSILimits
      19_3 loaded
      Received 1 - 15
      --> JOscarLib.Packet.Received.OnlineInfoResp1_15 loaded
      Received 11 - 2
      Report interval : 1200h
      --> JOscarLib.Packet.Received.MinReportInterval
      11_2 loaded

      Source:

      package testsend;

      import java.util.;
      import JOscarLib.Core.
      ;
      import JOscarLib.Tool.*;

      /*
      * JOscarLib provides a simple interface to perform current tasks such
      * as sending messages, which is defined in OScarInterface class.<br/>
      /

      public class SampleSendMessage implements Observer {
      private static final String SERVER = "login.icq.com";
      private static final int PORT = 5190;
      private OscarConnection con;
      private String receiver;

      public SampleSendMessage(String login, String password, String receiver) {
      this.receiver = receiver;
      con = new OscarConnection(SERVER, PORT, login, password);
      con.getPacketAnalyser().setDebug(true);
      con.getPacketAnalyser().getJarClassLoader().setPath("JIcqBot.jar");
      / to be notify when connection is ready. /
      con.addObserver(this);
      }

      public void update(Observable obs, Object obj) {
      OscarInterface.sendBasicMessage(con, receiver, "Dude, I'm online !");
      }

      public static void main(String[] args) {
      if (args.length < 3) {
      System.out.println("Use : SampleSendMessage MY_UIN MY_PASSWORD RECEIVER_UIN");
      }
      else {
      SampleSendMessage sample = new SampleSendMessage(args[0], args[1], args[2]);
      }
      }
      }

      Need Help!

       
    • Lolo101

      Lolo101 - 2008-06-12

      Hi again !
      The problem has been fixed ! You are invited to update your sources !
      In addition to the fix, the lib now uses the logging facility from JRE 1.4.

       
    • Igor

      Igor - 2008-06-13

      Thanks, now works.

       
    • Lolo101

      Lolo101 - 2008-06-02

      Hi Serguey,

      First, i think you're not using the most up to date sources since the method OscarInterface.sendMessage was replaced by sendBasicMessage and sendExtendedMessage.

      Next, you should call the con.getPacketAnalyser().getJarClassLoader().setPath(...) method in order to tell the lib where to find the classes to handle incoming packets (you often set the path in setPath to the lib itself).

      When i run your code (after replacing sendMessage with sendBasicMessage) i recieve the packet 1-3 and since it cant be handled, nothing more happens. But i dont get any exception. I recommand you to update your sources.

      Thanks for using the lib !
      Let us know if this helps !

      Loïc

       
    • Sergey Komarof

      Sergey Komarof - 2008-06-02

      Hi Loïc,

      Thank for your fast answer.

      In my example i use JOscarLib.jar from (2003-07-20 03:00), link: http://sourceforge.net/project/showfiles.php?group_id=50491
      In this version, when i replaced sendMessage on sendBasicMessage, my NetBeans IDE said me that sendBasicMessage isn't known method and didn't compile my programm.

      In this resourse i can not find more "young" version of JOscarLib as my. Can you get me some link, where i find latest JOscarLib or send me it at my mail???
      Thank's for all.

      P.S. I use NetBeans IDE and it can include your lib to my project, so i must add con.getPacketAnalyser().getJarClassLoader().setPath(...); method to my class or not?

       
    • Lolo101

      Lolo101 - 2008-06-03

      Sergey,

      You can download the most up-to-date code with a CVS client:
      cvs -z3 -d:pserver:anonymous@ooimlib.cvs.sourceforge.net:/cvsroot/ooimlib co -P JOscarLib

      You can get the sources and compile them with Netbeans. I also use NB successfully ;)

      Whatever version you use (0.3b1 or 0.4) you always need to call
      con.getPacketAnalyser().getJarClassLoader().setPath(...)
      Since the lib has it's own classloader dedicated to locate the convenient class for the recieved packets.

      The String in parameter may be absolute or relative to the current directory.

      The specified jar needs not to be in the project lib. However, as i already said, the specified jar is often the JOscarLib itself, hence it's already in your classpath.

      Loïc

       
    • Lolo101

      Lolo101 - 2008-06-12

      Hi Igor. It seems there's a problem with this SampleSendMessage class. I'm currently working on it. It seems there's something wrong with the order the FLAP are send to the server.
      I'll be back ASAP

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.