/** * 插入消息. * @param pal class PalInfo * @param btype 消息所属类型 * @param msg 消息 */ void UdpData::InsertMessage(PalInfo *pal, GroupBelongType btype, const char *msg) { MsgPara para; ChipData *chip; /* 构建消息封装包 */ para.pal = pal; para.stype = MESSAGE_SOURCE_TYPE_PAL; para.btype = btype; chip = new ChipData; chip->type = MESSAGE_CONTENT_TYPE_STRING; chip->data = g_strdup(msg); para.dtlist = g_slist_append(NULL, chip); /* 交给某人处理吧 */ cthrd.InsertMessage(¶); }
/** * 回馈错误消息. * @param pal class PalInfo * @param btype 消息归属类型 * @param error 错误串 */ void Command::FeedbackError(PalInfo *pal, GroupBelongType btype, const char *error) { MsgPara para; ChipData *chip; /* 构建消息封装包 */ para.pal = pal; para.stype = MESSAGE_SOURCE_TYPE_ERROR; para.btype = btype; chip = new ChipData; chip->type = MESSAGE_CONTENT_TYPE_STRING; chip->data = g_strdup(error); para.dtlist = g_slist_append(NULL, chip); /* 交给某人处理吧 */ cthrd.InsertMessage(¶); }