           log.error e  if e
           @save_group_info ret.result if ret.retcode == 0
           callback( ret.retcode == 0, e || 'retcode isnot 0' ) if callback
+
+    # 获取好友列表
+    update_buddy_list: (callback)->
+        @api.get_buddy_list @auth , (ret,e)=>
+            @save_buddy_info ret.result if ret.retcode == 0
+            callback( ret.retcode == 0, e || 'retcode isnot 0' ) if callback
     
     # 更新群成员， 似乎获取不到群ID
     # @options {key:value} 

    reply_message: (message, content, callback)->
        log.info "发送消息：",content
        if message.type == 'group'
            api.send_msg_2group  message.from_gid , content , @auth, (ret,e)->
                callback(ret,e) if callback
        else if message.type == 'buddy'            
            api.send_msg_2buddy message.from_uin , content , @auth , (ret,e)->
                callback(ret,e) if callback    
    
    # 发送群消息
    send_message_to_group: (gid, content, callback)->

            log.debug "[群消息]","[#{msg.from_group.name}] #{msg.from_user.nick}:#{msg.content} #{msg.time}"
        else if msg.type == 'buddy'
            log.debug "[好友消息]","#{msg.from_user.nick}:#{msg.content} #{msg.time}"

        # 消息处理
        replied = false
        reply = (content)=>
            @reply_message(msg,content) unless replied
            replied = true

        @dispatcher.dispatch(msg.content ,reply, @ , msg)


    _create_message : (event)->
        value = event.value
        msg = 
            content : value.content.slice(-1).pop().trim()
            time    : new Date(value.time * 1000)
            from_uin: value.from_uin
            type    : if value.group_code then 'group' else 'buddy'
