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()