在用户登录成功事件中设置用户的好友列表、分组列表、用户属性,并发送数据同步指令:// 用户登录成功回调函数定义
typedef void (CALLBACK* BRAS_OnUserLoginAction_CallBack)(DWORD dwUserId, LPCTSTR szUserName, DWORD dwLevel, LPCTSTR szIpAddr, LPVOID lpUserValue);
复制代码 一、添加用户分组DWORD dwGroupId = 1;
BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_ADDGROUP, dwGroupId, 0, "我的好友");
dwGroupId = 2;
BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_ADDGROUP, dwGroupId, 0, "公司同事");
复制代码 二、添加用户好友DWORD dwFriendUserId = 10010;
BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_ADDFRIEND, dwFriendUserId);
dwFriendUserId = 10011;
BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_ADDFRIEND, dwFriendUserId );
复制代码 三、设置好友与分组的关系(即好友属于哪一个分组)DWORD dwGroupId = 1;
DWORD dwFriendUserId = 10010;
BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_SETGROUPRELATION, dwGroupId, dwFriendUserId);
dwGroupId = 2;
dwFriendUserId = 10011;
BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_SETGROUPRELATION, dwGroupId, dwFriendUserId);
复制代码 四、设置用户信息(用户资料)BRAS_SetUserInfo(dwUserId, 1, "我的签名");
BRAS_SetUserInfo(dwUserId, 2, "020-85276986");
……
复制代码 五、将前面设置的资料同步给客户端BRAS_UserInfoControl(dwUserId, BRAS_USERINFO_CTRLCODE_SYNCDATA, 0, 0);
复制代码 |