示例#1
0
 public static function Delete($ID)
 {
     $ID = intval($ID);
     \Bitrix\Im\MessageTable::delete($ID);
     foreach (GetModuleEvents("im", "OnAfterDeleteMessage", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     return true;
 }
示例#2
0
 public function DeleteWithCheck($ID)
 {
     global $DB;
     $ID = intval($ID);
     $strSql = "SELECT M.* FROM b_im_relation R, b_im_message M WHERE M.ID = " . $ID . " AND R.USER_ID = " . $this->user_id . " AND R.MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "' AND R.CHAT_ID = M.CHAT_ID";
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($arRes = $dbRes->Fetch()) {
         IM\MessageTable::delete($ID);
         $messageParameters = IM\MessageParamTable::getList(array('select' => array('ID'), 'filter' => array('=MESSAGE_ID' => $ID)));
         while ($ar = $messageParameters->fetch()) {
             IM\MessageParamTable::delete($ar['ID']);
         }
         $arRes['RELATION_USER_ID'] = $this->user_id;
         foreach (GetModuleEvents("im", "OnAfterDeleteNotify", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($ID, $arRes));
         }
         CIMMessenger::SpeedFileDelete($this->user_id, IM_SPEED_NOTIFY);
         return true;
     }
     return false;
 }