账号管理
获取账号列表
list_accounts:查询客户端已添加的全部账号。
const AccountList *list_accounts(void);
void free_accounts(const AccountList *list);- 权限:
list_accounts - 调用要求:无需账号在线
使用说明
- 失败时返回
NULL(原因见运行日志);返回空列表(count == 0)不是失败。 - 遍历以
count为准,count == 0时不要读取items。 - 不要按列表位置关联账号,请使用
self_id与platform定位目标账号。 - 用完必须调用
free_accounts(list)交还。
返回值 AccountList
| 字段 | 类型 | 说明 |
|---|---|---|
count | uint32_t | 账号数量 |
items | Account[] | 账号数组 |
Account
| 字段 | 类型 | 说明 |
|---|---|---|
self_id | uint64_t | QQ 号 |
protocol | const char * | 当前协议 PROTOCOL_*,如 "tim_pad" |
platform | const char * | 所属平台 PLATFORM_*("android" / "pc"),由协议决定 |
nickname | const char * | 昵称 |
status | int32_t | 账号状态:ACCOUNT_OFFLINE(0)/ ACCOUNT_ONLINE(1)/ ACCOUNT_LOGGING_IN(2)/ ACCOUNT_RECONNECTING(3) |
level | int32_t | QQ 等级,未取到时为 -1 |
received | uint64_t | 本次上线以来收到的聊天消息数,重连期间不清零 |
sent | uint64_t | 本次上线以来成功发出的聊天消息数,不含系统事件 |
online_since | uint64_t | 本次上线时间(Unix 秒),重连期间保留,不在线时为 0 |
note | const char * | 附加信息,如断线原因 |