Im Buddy Management Solution

Source: Internet
Author: User

Client Processing interface:

  1. #define Wm_gv_userinfoupdate WM_GV +///< user Information update notification, WParam (int) represents the user ID number, and lParam (int) represents the update category

  2. #define Wm_gv_friendstatus WM_GV +///< Friends Online status changes, WParam (int) represents the friend User ID number, and lParam (int) indicates the user's current active status: 0 offline , 1 on-line


  3. Get a list of user friend IDs

  4. Brac_api DWORD brac_getuserfriends (Lpdword lpuseridarray, dword& dwusernum);

  5. Get Friends Online Status

  6. BRAC_API DWORD Brac_getfriendstatus (DWORD Dwfrienduserid, dword& dwstatus);

  7. Get a list of user group IDs

  8. Brac_api DWORD brac_getusergroups (Lpdword lpgroupidarray, dword& dwgroupnum);

  9. Get a list of friends under Group

  10. BRAC_API DWORD Brac_getgroupfriends (DWORD dwgroupid, Lpdword Lpuseridarray, dword& dwusernum);

  11. Get user Information

  12. BRAC_API DWORD Brac_getuserinfo (DWORD Dwuserid, DWORD dwinfoid, Tchar* Lpinfoname, DWORD Dwlen);

  13. Get user group name

  14. BRAC_API DWORD Brac_getgroupname (DWORD dwgroupid, tchar* Lpgroupname, DWORD Dwlen);

Copy Code

New API interface for server:
  1. User Information control type definition (api:bras_userinfocontrol incoming parameter, Onuserinfocontrol callback parameter)

  2. #define BRAS_USERINFO_CTRLCODE_KICKOUT 1///< kick the specified user out of the system

  3. #define BRAS_USERINFO_CTRLCODE_SYNCDATA 2///< Synchronizing the specified user's data to the client


  4. #define Bras_userinfo_ctrlcode_addgroup///< Add user Group, wparam group Id,lpstrvalue to group name

  5. #define Bras_userinfo_ctrlcode_delgroup///< Delete the user group, WPARAM is the group ID

  6. #define Bras_userinfo_ctrlcode_addfriend///< Add user friend, wparam as friend ID

  7. #define Bras_userinfo_ctrlcode_delfriend///< Delete a user friend, wparam a friend ID

  8. #define Bras_userinfo_ctrlcode_setgrouprelation///< to set the association relationship between friends and groups, wparam as a friend ID for group Id,lparam, indicating that a friend belongs to a group



  9. Set User Details

  10. BRAS_API DWORD Bras_setuserinfo (DWORD Dwuserid, DWORD dwinfoid, LPCTSTR Lpinfovalue, DWORD dwflags=0);

  11. Get details about a user

  12. BRAS_API DWORD Bras_getuserinfo (DWORD Dwuserid, DWORD dwinfoid, Tchar* Lpinfovalue, DWORD dwsize);

  13. User Information Control

  14. BRAS_API DWORD Bras_userinfocontrol (DWORD Dwuserid, DWORD Dwctrlcode, DWORD wparam=0, DWORD lparam=0, LPCTSTR lpstrvalue= NULL);

Copy Code

Server-side business logic processing flow
Set the user's buddy list, group list, user attributes, and send data synchronization instructions in the User logon success event:
    1. User Login successful callback function definition

    2. typedef void (callback* Bras_onuserloginaction_callback) (DWORD Dwuserid, LPCTSTR szUserName, DWORD Dwlevel, LPCTSTR SZIPADDR, LPVOID lpuservalue);

Copy Code

I. Adding groups of users
    1. DWORD dwgroupid = 1;

    2. Bras_userinfocontrol (Dwuserid, Bras_userinfo_ctrlcode_addgroup, dwgroupid, 0, "my Friends");

    3. dwGroupID = 2;

    4. Bras_userinfocontrol (Dwuserid, Bras_userinfo_ctrlcode_addgroup, dwgroupid, 0, "company colleague");

Copy Code

Second, add user friends
    1. DWORD Dwfrienduserid = 10010;

    2. Bras_userinfocontrol (Dwuserid, Bras_userinfo_ctrlcode_addfriend, Dwfrienduserid);

    3. Dwfrienduserid = 10011;

    4. Bras_userinfocontrol (Dwuserid, Bras_userinfo_ctrlcode_addfriend, Dwfrienduserid);

Copy Code

Third, set the relationship between friends and groups (that is, which group a friend belongs to)
    1. DWORD dwgroupid = 1;

    2. DWORD Dwfrienduserid = 10010;

    3. Bras_userinfocontrol (Dwuserid, Bras_userinfo_ctrlcode_setgrouprelation, dwGroupID, dwFriendUserId);

    4. dwGroupID = 2;

    5. Dwfrienduserid = 10011;

    6. Bras_userinfocontrol (Dwuserid, Bras_userinfo_ctrlcode_setgrouprelation, dwGroupID, dwFriendUserId);

Copy Code

Iv. Setting up user information (user profile)
    1. Bras_setuserinfo (Dwuserid, 1, "my signature");

    2. Bras_setuserinfo (Dwuserid, 2, "020-85276986");

    3. ......

Copy Code

V. Synchronize the previously set data to the client
    1. Bras_userinfocontrol (Dwuserid, bras_userinfo_ctrlcode_syncdata, 0, 0);

Copy Code


Im Buddy Management Solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.