how to add offline user as buddy

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
jackygu
Posts: 34
Joined: 13 Jun 2008, 17:35

how to add offline user as buddy

Post 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]
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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.
Lapo
--
gotoAndPlay()
...addicted to flash games
jackygu
Posts: 34
Joined: 13 Jun 2008, 17:35

Post by jackygu »

Ok, Thanks
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Post 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
helloniklas
Posts: 21
Joined: 14 Sep 2009, 10:18
Location: London
Contact:

Post by helloniklas »

Did you manage to resolve this? I'm having the same problems.
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Post 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.
Post Reply