Partho Biswas - 2012-01-30

I am trying to make a MSN-Bot that will interact with latest version of Windows Live Messenger. And i am willing to use this library. Doe's the current version of JML can interact with latest version of Windows Live Messenger. And as far as i know the latest version of Windows Live Messenger are using MSNP19.  If so then does JML can use MSNP19 ?

I am trying to connect with that code

package net.sf.jml.example;
/*
 * Copyright 2004-2005 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import net.sf.jml.MsnMessenger;
import net.sf.jml.impl.MsnMessengerFactory;

/**
 * @author Roger Chen
 */
public class BasicMessenger {

    private String email;
    private String password;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    protected void initMessenger(MsnMessenger messenger) {
    }

    public void start() {
        //create MsnMessenger instance
        MsnMessenger messenger = MsnMessengerFactory.createMsnMessenger(email,
                password);

        //MsnMessenger support all protocols by default
        //messenger.setSupportedProtocol(new MsnProtocol[] { MsnProtocol.MSNP8 });
        //default init status is online, 
        //messenger.getOwner().setInitStatus(MsnUserStatus.BUSY);
        //log incoming message
        messenger.setLogIncoming(true);

        //log outgoing message
        messenger.setLogOutgoing(true);

        initMessenger(messenger);
        messenger.login();
    }

    public static void main(String[] args) throws Exception {
        //if (args.length != 3) {
        //    System.out.println("Usage: java messengerClassName email password");
        //    return;
       // }
        BasicMessenger messenger = (BasicMessenger) Class.forName("net.sf.jml.example.EchoMessenger")
                .newInstance();
        messenger.setEmail("XYZ@hotmail.com");
        messenger.setPassword("password");
        messenger.start();
    }
}

And this BasicMessenger class uses the following EchoMessenger class

package net.sf.jml.example;
/*
 * Copyright 2004-2005 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import net.sf.jml.MsnContact;
import net.sf.jml.MsnMessenger;
import net.sf.jml.MsnSwitchboard;
import net.sf.jml.event.MsnMessageAdapter;
import net.sf.jml.message.MsnControlMessage;
import net.sf.jml.message.MsnDatacastMessage;
import net.sf.jml.message.MsnInstantMessage;

/**
 * @author Roger Chen
 */
public class EchoMessenger extends BasicMessenger {

    protected void initMessenger(MsnMessenger messenger) {
        messenger.addMessageListener(new MsnMessageAdapter() {

            public void instantMessageReceived(MsnSwitchboard switchboard,
                    MsnInstantMessage message, MsnContact contact) {
                //text message received
       
                //switchboard.sendMessage(message);
            }

            public void controlMessageReceived(MsnSwitchboard switchboard,
                    MsnControlMessage message, MsnContact contact) {
                //such as typing message and recording message
                System.out.println("Type: ");
                //System.out.println(message);
                java.util.Scanner scan = new java.util.Scanner(System.in);
                MsnInstantMessage  message2 = new MsnInstantMessage();
                message2.setContent(scan.nextLine());
                switchboard.sendMessage(message2);
            }

            public void datacastMessageReceived(MsnSwitchboard switchboard,
                    MsnDatacastMessage message, MsnContact contact) {
                //such as Nudge
           
                switchboard.sendMessage(message);
            }

        });
    }

}

When i run this code then i get this error.

Jan 30, 2012 11:38:22 PM net.sf.jml.protocol.MsnSession$1 messageSent
INFO: partho.maple@hotmail.com NS >>> VER 1 MSNP15 MSNP14 MSNP13 MSNP12 MSNP11 MSNP10 MSNP9 MSNP8 CVR0
Jan 30, 2012 11:38:22 PM net.sf.jml.protocol.MsnSession$1 messageSent
INFO: partho.maple@hotmail.com NS >>> CVR 2 0x0409 winnt 5.1 i386 MSNMSGR 8.5.1288.816 MSMSGS partho.maple@hotmail.com
Jan 30, 2012 11:38:22 PM net.sf.jml.protocol.MsnSession$1 messageReceived
INFO: partho.maple@hotmail.com NS <<< VER 1 MSNP15
Jan 30, 2012 11:38:22 PM net.sf.jml.protocol.MsnSession$1 messageReceived
INFO: partho.maple@hotmail.com NS <<< CVR 2 14.0.8117 14.0.8117 14.0.8117 http://msgruser.dlservice.microsoft.com/download/A/6/1/A616CCD4-B0CA-4A3D-B975-3EDB38081B38/en/wlsetup-cvr.exe http://download.live.com/?sku=messenger
.........................................................................................................
.........................................................................................................
.........................................................................................................
Jan 30, 2012 11:38:27 PM net.sf.jml.protocol.MsnSession$1 messageReceived
INFO: partho.maple@hotmail.com NS <<< USR 3 SSO S MBI_KEY jYl4Us9bmEBHTT+RbBLoxH5JWMyF9cUNWyAT9eMLP4gxbGu88VLN6jvm/fuPa46R
Jan 30, 2012 11:38:32 PM net.sf.jml.protocol.soap.SSO getTicketFromResponseXml
SEVERE: Login error 
java.lang.NullPointerException
    at net.sf.jml.protocol.soap.SSO.getTicketFromResponseXml(SSO.java:333)
    at net.sf.jml.protocol.soap.SSO.getTicket(SSO.java:308)
    at net.sf.jml.protocol.soap.SSO.getTicket(SSO.java:82)
    at net.sf.jml.protocol.incoming.IncomingUSR$1.run(IncomingUSR.java:287)

Please help me on this. Pleas somebody reply….