LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2443|回复: 0

perl oicq code improved (addons 1)

[复制链接]
发表于 2003-4-15 16:51:38 | 显示全部楼层 |阅读模式
I update the code of perloicq, new features include
1. can search user by id, email and nickname
2. can know how many people onliine
3. can show all the friends list
4. can show friend ip (some id may not work)

Pls refer to OICQ.pm to see where to modify

my %CmdCode = (
  logout              => pack('C*', 0, 0x01),
  get_online_num      => pack('C*', 0, 0x02), # new
  reg_new_id_2        => pack('C*', 0, 0x03),
  update_info         => pack('C*', 0, 0x04),
  search_users        => pack('C*', 0, 0x05), # improved
  get_user_info       => pack('C*', 0, 0x06),
  auth_request_packet => pack('C*', 0, 0x09), # specified
  del_contact         => pack('C*', 0, 0x0a),
  auth_yes_packet     => pack('C*', 0, 0x0b), # specified
  set_picture         => pack('C*', 0, 0x0d),
  reg_new_id_1        => pack('C*', 0, 0x11),
  ack_service_msg     => pack('C*', 0, 0x12),
  send_msg            => pack('C*', 0, 0x16),
  recv_msg            => pack('C*', 0, 0x17),
  forbid_contact      => pack('C*', 0, 0x1c),
  login               => pack('C*', 0, 0x22),
  get_friends_list    => pack('C*', 0, 0x26), # new
  get_online_friends  => pack('C*', 0, 0x27),
  recv_service_msg    => pack('C*', 0, 0x80),
  recv_friend_status  => pack('C*', 0, 0x81), };

# Keyboard commands
my %KbCmd = ( # Code ref          # Min num of arguments
  help    => [\&help,               0],
  '?'     => [\&help,               0],
  get     => [\&get_user_info,      0],
  who     => [\&get_online_friends, 0], # changed
  all     => [\&get_friends_list,   0], # new
  count   => [\&get_online_num,     0], # new
  search  => [\&search_users,          0],
  head    => [\&set_picture,        1],
  update  => [\&update_info,        0],
  accept  => [\&accept_contact,     1],
  reject  => [\&reject_contact,     1],
  add     => [\&add_contact,        1],
  del     => [\&del_contact,        1],
  ban     => [\&forbid_contact,     1],
  passwd  => [\&set_passwd,         1],

  away    => [\&toggle_autoreply,   0],
  ls      => [\&list_stored_ids,    0],
  rm      => [\&remove_stored_ids,  1],
  buf     => [\&show_msg_buffer,    0],
  rmbuf   => [\&clear_msg_buffer,   0],
  hist    => [\&show_queue,         0],
  obj     => [\&show_object,        0],
  set     => [\&set_attribute,      0],
  clear   => [ sub { system "clear" }, 0],
);

# Keyboard command help message
sub help {
  print '-'x32, ' Help Message ', '-'x32, "\n";
  print <<EOF;
All lines that begin with / (slash) are treated as keyboard commands.

  /help, /?    - print this help message
  /52482796    - set destination id num to 52482796
  /away        - toggle auto-reply
  /ls [id]     - list id numbers stored in user directory
  /rm [id]     - remove locally stored user info
  /buf         - show message buffer
  /rmbuf       - clear message buffer
  /hist        - show history
  /obj         - show object
  /set         - set object attribute
  /clear       - clear screen

  /get [id]    - get user info of the specified id (default to yourself)
  /who         - get a list of online friends
  /all         - get a list of all friends
  /count       - get the number of online users
  /search Qid,name,email (pls leave NO space)
               - list 25 random online users if Qid <= 10000,
                 input 0 for n to ignore search by Qid
               - search by name : support Chinese
               - search by email: do NOT support wild char (*)
  /head n      - set head picture to number n
  /update      - update information
  /accept [id] - accept contact from id
  /reject [id] - reject contact from id
  /add [id]    - add a user to friend list
  /del [id]    - delete a user from friend list
  /ban [id]    - forbid a user from contacting you
  /passwd xxxx - change passwd to xxxx

Lines that do not begin with / will be stored in the message buffer
and will be sent to destination id when an empty line is entered.
This allows you to send a message of multiple lines.
EOF
  print '='x78, "\n";
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表