Page 1 of 1

how to add offline user as buddy

Posted: 24 Sep 2008, 08:15
by jackygu
Hi, in our application, we need to add offline user which stored in our database as buddy. We use "requestAddBuddyPermission" on the server side as following:
requestAddBuddyPermission(User sender, target_username, msg);
Offcause the sender is online, but the target_username is offline. The error as following:
=====================
[WARNING]> Exception in ExtensionHandler: java.lang.NullPointerException
Exception type: java.lang.NullPointerException
java.lang.NullPointerException
at it.gotoandplay.smartfoxserver.controllers.SystemHandler.askAddBuddyPermission<SystemHandler.java:3029>
at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.requestAddBuddyPermission(ExtensionHelper.java:1010)
at it.gotoandplay.extensions.examples.SimpleDbExtension.handleRequest)(SimpleDbExtension.java:3883)
....
======================

Pls give us hand to solve.

Best Regards/
Gu[/img]

Posted: 25 Sep 2008, 20:30
by Lapo
You can't ask the permission to a user that is not connected.
So if your system needs the permission from the target buddy it's not possible to do it when the user is off-line.

You could however intercept the add-buddy requests to offline users, store them in a database and when such user comes back online you can deliver it.

Posted: 25 Sep 2008, 22:03
by jackygu
Ok, Thanks

Posted: 11 Mar 2009, 08:43
by dieffe
Lapo wrote:You can't ask the permission to a user that is not connected.
So if your system needs the permission from the target buddy it's not possible to do it when the user is off-line.

You could however intercept the add-buddy requests to offline users, store them in a database and when such user comes back online you can deliver it.
I cant get this system to work on my extension.
Is the mutualaddBuddy triggered by the request sended by addBuddy or is triggered also by the _server.addBuddy() method.

I add the buddy serverSide but this doesnt trigger the add of me to the requester in the first place.

A(online) request to B(offline) ( i write this in DB )
B comes online and accepts ( i add A to B's Buddylist server side ) while A is offline.
B isnt in A's buddylist.

Here it is my config.
<offLineBuddyVariables>true</offLineBuddyVariables>
<addBuddyPermission>false</addBuddyPermission>
<permissionTimeOut>10</permissionTimeOut>
<mutualAddBuddy>true</mutualAddBuddy> <mutualRemoveBuddy>true</mutualRemoveBuddy>

Thanks

Posted: 30 Sep 2009, 09:12
by helloniklas
Did you manage to resolve this? I'm having the same problems.

Posted: 01 Oct 2009, 13:12
by dieffe
Actually i didnt.

I solved it by saving db side the pending request and as soon as the other user logs in i process this request.