第1行: | 第1行: | ||
+ | = UI部分 = | ||
+ | |||
+ | 入口函数:src/list.c deal_key() | ||
+ | |||
+ | = 逻辑部分 = | ||
+ | |||
== friends == | == friends == | ||
<source lang="c"> | <source lang="c"> | ||
+ | // 部分 | ||
+ | struct user_info { /* Structure used in UTMP file */ | ||
+ | int active; /* When allocated this field is true */ | ||
+ | int uid; /* Used to find user name in passwd file */ | ||
+ | int pid; /* kill() to notify user of talk request */ | ||
+ | // ... | ||
+ | int friendsnum; | ||
+ | int friends_uid[MAXFRIENDS]; | ||
+ | #ifdef FRIEND_MULTI_GROUP | ||
+ | unsigned int friends_p[MAXFRIENDS]; | ||
+ | #endif | ||
+ | // ... | ||
+ | }; | ||
+ | |||
+ | // friends文件就是这个东西的一个数组 | ||
struct friends { | struct friends { | ||
− | char id[13]; | + | char id[13]; // 用户名 |
− | char exp[LEN_FRIEND_EXP]; | + | char exp[LEN_FRIEND_EXP]; // 昵称,默认为空 |
#ifdef FRIEND_MULTI_GROUP | #ifdef FRIEND_MULTI_GROUP | ||
int groupid; | int groupid; | ||
#endif | #endif | ||
}; | }; | ||
+ | |||
struct friends_info { | struct friends_info { | ||
− | char exp[LEN_FRIEND_EXP]; | + | char exp[LEN_FRIEND_EXP]; // 存储昵称用 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}; | }; | ||
+ | struct friends_info* topfriend; // 存储了好友的昵称 | ||
+ | // 次序按照用户名经过处理排序后的,对照userinfo.friends_uid | ||
+ | |||
</source> | </source> | ||
2012年1月31日 (二) 06:51的版本
UI部分
入口函数:src/list.c deal_key()
逻辑部分
friends
// 部分
struct user_info { /* Structure used in UTMP file */
int active; /* When allocated this field is true */
int uid; /* Used to find user name in passwd file */
int pid; /* kill() to notify user of talk request */
// ...
int friendsnum;
int friends_uid[MAXFRIENDS];
#ifdef FRIEND_MULTI_GROUP
unsigned int friends_p[MAXFRIENDS];
#endif
// ...
};
// friends文件就是这个东西的一个数组
struct friends {
char id[13]; // 用户名
char exp[LEN_FRIEND_EXP]; // 昵称,默认为空
#ifdef FRIEND_MULTI_GROUP
int groupid;
#endif
};
struct friends_info {
char exp[LEN_FRIEND_EXP]; // 存储昵称用
};
struct friends_info* topfriend; // 存储了好友的昵称
// 次序按照用户名经过处理排序后的,对照userinfo.friends_uid
utmp.c
- cmpfuid [(const void*a,const void*b)]
- Friend.NCaseId()
- getfriendstr [(struct userec* user,struct user_info* puinfo)]
- User.GetFriends()
- myfriend [(int uid, char *fexp)]
- UserInfo.HasFriend()
- hisfriend [(int uid,struct user_info* him)]
- UserInfo.HasFriend()