function process_replace(&$response, &$session)
 {
     $somappings = new syncml_somappings();
     $channel_id = $session->get_channel_id_from_cmd($this->cmdref, $this->msgref);
     if (!is_null($channel_id)) {
         switch ($this->data) {
             case SYNCML_STATUS_OK:
                 $somappings->update_mapping($channel_id, $this->targetref, NULL, 0);
                 break;
             case SYNCML_STATUS_ITEMADDED:
                 // delete mapping now -- it will come back in MAP
                 $somappings->delete_mapping($channel_id, $this->targetref, NULL, NULL);
                 break;
         }
     }
 }
 function execute(&$response, &$session)
 {
     $somappings = new syncml_somappings();
     if ($response->has_global_status_code()) {
         $response->add_status($this->cmdid, $session->msgid, 'Map', NULL, NULL, $response->get_global_status_code());
         return;
     }
     $open_channel = $session->get_open_channel($this->source['locuri'], $this->target['locuri']);
     foreach ($this->mapitem as $item) {
         $somappings->delete_mapping($open_channel['channel_id'], NULL, $item['target']['locuri'], NULL);
         $somappings->insert_mapping($open_channel['channel_id'], $item['source']['locuri'], $item['target']['locuri'], 0);
     }
     if (isset($this->noresp) && $this->noresp) {
         return;
     }
     $response->add_status($this->cmdid, $session->msgid, 'Map', $this->target['locuri'], $this->source['locuri'], SYNCML_STATUS_OK);
 }
 /**
  * Remove items not touched by the client.
  * 
  * @param $channel_id                ID of channel to prepare the slow
  *                                   sync for.
  * @param $all_client_modified_luids All LUIDs client modified.
  * @param $database                  Database involved in this
  *                                   session.
  */
 function finish_client_refresh($channel_id, $all_client_modified_luids, $database)
 {
     $somappings = new syncml_somappings();
     $all_luids = $somappings->get_all_luids($channel_id);
     $luids_to_kill = array_diff($all_client_modified_luids, $all_luids);
     foreach ($luids_to_kill as $luid) {
         $database->delete_item($luid);
     }
 }