Exception in retrieving buddylist

Login to post  Page: « < 1 of 1 > »
03 Aug 2009 - 10:264734
Exception in retrieving buddylist
Hi,

I want to send message to all the buddies. While using the sample code accjbot.java from accsdk_win32_1_8_2.zip, when I try to get the buddylist using session.getBuddyList(), I get following exception:
Main AccException, hr: ACC_E_FAIL
com.aol.acc.AccException: IAccSession_GetBuddyList
	at com.aol.acc.AccSession.GetBuddyList(Native Method)
	at com.aol.acc.AccSession.getBuddyList(AccSession.java:174)

My code looks like below:
...
...
accjbot(String username, String password) throws AccException{
//create main session object
//add event listener
//set key
//set screen name
//set up prefs
session.signOn(password);
sendMessage();//method to send message to all buddies.
//msg pump while loop.
...
...
} 
...
...
...
//method for now just prints all the buddies.
    public void sendToUsers() throws AccException {
        AccBuddyList bl = session.getBuddyList();
        int ct = bl.getGroupCount();
        System.out.println("group count : " + ct);
        for (int i = 0; i < ct; i++) {
            AccGroup group = bl.getGroupByIndex(i);
            System.out.println("group name: " + group.getName());
            int ct1 = group.getBuddyCount();
            for (int j = 0; j < ct1; j++) {
                AccUser buddy = group.getBuddyByIndex(j);
                System.out.println(" Buddy name: " + buddy.getName());
            }
        }
    }
...
...
What is missing or going wrong here?
How and where should the session.getBuddyList() method be invoked?

Thanks.


03 Aug 2009 - 12:424737
Exception in retrieving buddylist
Refer to http://dev.aol.com/forum?c=showthread&ThreadID=1227 for solution.


Login to post  Page: « < 1 of 1 > »