Cannot add or remove buddies
Status: Beta
Brought to you by:
dsj_shock
Hi :)
When I try to add or remove buddies, the following
exceptions are thrown in MsnServer.invokeMethod and
the application closes:
Adding:
java.lang.NoSuchMethodException:
hamsam.protocol.msn.NotificationServer.processBuddyRe
move
Removing:
java.lang.NoSuchMethodException:
hamsam.protocol.msn.NotificationServer.processBuddyAd
d
By the way it is not very nice to invoke methods on a
subclass by using Reflection. Exceptions are difficult to
track and the code hard to read. If it is not possible to
declare the methods in the superclass as abstract
methods, another structure should be considered. In
these cases it's always a good idea to take a look at
some patterns for inspiration :).
Regards,
Daniel J.
Logged In: YES
user_id=680966
These two features are not implemented in 0.2.1.
I admit that the MSN module looks ugly. In the next version, I
might go for a complete rewrite of the MSN module. That'll
bring in a structure as of AIM module.
Logged In: YES
user_id=884338
I can see that the functions add and remove actually works,
but the problem is that the server-response cannot be
processed, but insteed the app is closed. Would it be possible
to make this work soon and what is the response ment to
cause?
// Daniel
Logged In: YES
user_id=884338
I needed it to work right away, so I implemented the
response-process. If you would like to imlement it (hope you
do :) ), the code is this:
To EventProcessor this is added:
/**
* Invoked when an attempt to add a buddy succeeds.
*
* @param buddy buddy whom you tried to remove
*/
void buddyAdded(Buddy buddy)
{
if(listener != null)
listener.buddyAdded(buddy);
}
/**
* Invoked when an attempt to delete a buddy (from the
forward list) succeeds.
*
* @param buddy buddy whom you tried to remove
*/
void buddyDeleted(Buddy buddy)
{
if(listener != null)
listener.buddyDeleted(buddy);
}
To NotificationServer this is added:
void processBuddyAdd(AbstractCommand cmd)
{
if ("ADD".equals(cmd.getType()))
{
String passport = cmd.getParam(2);
Buddy buddy = new Buddy(this.protocol, passport);
buddy.setStatus(null);
processor.buddyAdded(buddy);
}
else if ("ILN".equals(cmd.getType()))
{
processInitialStatus(cmd);
}
}
void processBuddyRemove(AbstractCommand cmd)
{
if ("REM".equals(cmd.getType()))
{
String passport = cmd.getParam(2);
Buddy buddy = new Buddy(this.protocol, passport);
buddy.setStatus(null);
processor.buddyDeleted(buddy);
}
}
Regards,
Daniel
Logged In: YES
user_id=68628
Daniel,
it's cool that you implemented the processBuddy* callbacks,
I was just faced with that problem and was about to
implement them myself.
Project managers: it'd be good if this appeared on the
patches section, or were commited to the CVS, so we don't
have to dig up the opened bug reports to see what got fixed.
Logged In: YES
user_id=884338
I posted the code here mostly so that Kraghu could add the
code to the API and therefore be available by CVS.
// Daniel