/* * | | | | \ \ / / | | | | / _______| * | |____| | \ \/ / | |____| | / / * | |____| | \ / | |____| | | | _____ * | | | | / \ | | | | | | |____ | * | | | | / /\ \ | | | | \ \______| | * | | | | /_/ \_\ | | | | \_________| * * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. */ #import <Foundation/Foundation.h> #import <JMessage/JMSGMessage.h> /*! * 消息相关的变更通知 * * 包括三类: * * - 发出消息的返回结果; * - 服务器端下发的消息; * - 服务器端下发的事件(一类特殊的消息); */ @protocol JMSGMessageDelegate <NSObject> /*! * @abstract 发送消息结果返回回调 * * @param message 原发出的消息对象 * @param error 不为nil表示发送消息出错 * * @discussion 应检查 error 是否为空来判断是否出错. 如果未出错, 则成功. */ @optional - (void)onSendMessageResponse:(JMSGMessage *)message error:(NSError *)error; /*! * @abstract 接收消息(服务器端下发的)回调 * * @param message 接收到下发的消息 * @param error 不为 nil 表示接收消息出错 * * @discussion 应检查 error 是否为空来判断有没有出错. 如果未出错, 则成功. * 留意的是, 这里的 error 不包含媒体消息下载文件错误. 这类错误有单独的回调 onReceiveMessageDownloadFailed: * * 收到的消息里, 也包含服务器端下发的各类消息事件, 比如有人被加入了群聊. 这类消息事件处理为特殊的 JMSGMessage 类型. * * 事件类的消息, 基于 JMSGMessage 类里的 contentType 属性来做判断, * contentType = kJMSGContentTypeEventNotification. */ @optional - (void)onReceiveMessage:(JMSGMessage *)message error:(NSError *)error; /*! * @abstract 接收消息媒体文件下载失败的回调 * * @param message 下载出错的消息 * * @discussion 因为对于接收消息, 最主要需要特别做处理的就是媒体文件下载, 所以单列出来. 一定要处理. * * 通过的作法是: 如果是图片, 则 App 展示一张特别的表明未下载成功的图, 用户点击再次发起下载. 如果是语音, * 则不必特别处理, 还是原来的图标展示. 用户点击时, SDK 发现语音文件在本地没有, 会再次发起下载. */ @optional - (void)onReceiveMessageDownloadFailed:(JMSGMessage *)message; @end