8.16 Example: Buddy List 2.0

The source of this example is found under the Examples/AS2/24_pro_buddyList2 folder.
The example is also provided for Flash CS3 and Actionscript 3

» Introduction

The sample application demonstrates the new capabilities offered by the Buddy List 2.0 introduced with SmartFoxServer 1.6

A detailed tour of the new features is found in this article.

» The application

When the application is launched you will be able to type a user name under which you will join the Zone.
You are free to use any name as there is no server side login handler or checks: the easiest way to check the application is to run 2 or more instances of it and logging in with different names.

App As3

The leftmost table contains your buddy list, which will probably be empty when you first check the application. It contains three columns:

The next table will show all the buddy variables for the currently selected buddy.

» Adding a buddy to the buddy list:
Simply type the name (respecting the case) in the field at the bottom left and click the Add Buddy button

» Removing a buddy from the buddy list:
Select the buddy in the leftmost table and click the Remove Buddy button.

» Blocking a buddy:
Select the buddy in the leftmost table and click the Block Buddy button.

» Unblocking a buddy:
Select the buddy in the leftmost table and click the Unblock Buddy button.

» Setting the buddy variables:
Type the name (key) and value in the fields below the variables table and click Save Variable. In order to check the new variable check another instance of the application in which the buddy was added.
If you use a $ (dollar) sign as the first character of the Buddy Variable name it will be detected as off-line buddy variable.

» Sending messages:
You can send private messages to any buddy in your list provided that they are not blocked. In order to send a message select a buddy in the buddy list, type your message in the relative text field and hit the Send button.

» Add Buddy Permissions

When a "Add Buddy" request is sent using the new Buddy List 2.0, the target buddy will receive the request and will be able to grant it or refuse it. A new event was introduced in SmartFoxServer 1.6 client API called onBuddyPermissionRequest and also a new method, sendBuddyPermissionResponse, was added send a response back.

Alert

» Compatibility with previous Buddy List system

The previous buddy list system is still present in SmartFoxServer for compatibility with previous applications. However, the advantages of the new system are not only a richer set of features with many customizable options, but also a better overall performance: in fact while the first system was file-based, the new Buddy List 2.0 uses a lightning fast embedded database.

» Code changes

Even if the Buddy List 2.0 introduces many new features we strived to maintain the client API as simple as possible keeping the compatibility with the previous system. You will find that the Buddy List API have the same previous features with some nice new additions:


  doc index