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());
}
}
}
...
...
How and where should the session.getBuddyList() method be invoked?
Thanks.
