数据结构

消息索引

  1. msgindex:全消息箱
  2. msgindex2:收件箱
  • 0x00-0x03 4字节
    • 对于收件箱:已读消息个数
  • 之后:struct msghead[]
    • 对应 MsgHead
struct msghead {
    int pos, len; // 消息体在msgcontent中的位置&长度
    char sent;    // 1: 发送的消息 0: 收到的消息
    char mode;    //
    char id[IDLEN+2];  // 发送/接收者ID
    time_t time;  // 发送/接收时间
    int frompid, topid;  // 发送/接收者进程号
};

发送消息过程分析

libmsg.c

canmsg [(struct userec *fromuser, struct user_info *uin)]
  • User.CanSendTo()
can_override [(char *userid, char *whoasks)]
没人用过……
msg_can_sendmsg [(char *userid, int utmppid)]
没人用过……
save_msgtext()
  • 对应 MsgBox.SaveMsgText()
把消息存到用户的msgindex与msgcontent文件中。如果是接收到的,也存到msgindex2中。
load_msghead()
  • 对应 MsgBox.LoadMsgHead()
读出某个消息头,可以指定全消息箱还是收件箱。
get_msgcount()
  • 对应 MsgBox.GetMsgCount()
获取消息数量。
clear_msg()
  • 对应 MsgBox.ClearMsg()
清除所有消息
get_unreadcount()
  • 对应 MsgBox.GetUnreadCount()
获取未读消息数
get_unreadmsg()
  • 对应 MsgBox.GetUnreadMsg()
从收件箱里获取某条消息,并且修改已读指针。
load_msgtext()
  • 对应 MsgBox.LoadMsgText()
读取某条消息的内容。
sendmsgfunc()
发送消息。
translate_msg()
将消息转换为在消息记录之类里面看见的样子
mail_msg()
将所有消息放入邮件寄回信箱。
mailbacklastmsg()
将未发送成功消息寄回信箱。

SMS支持

不在研究范围……

SQL相关

意义不明…… 貌似是通讯录一类的东西