[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [18536] get_channel_id_from_cmd returns null on failu
From: |
Johan Gunnarsson |
Subject: |
[Phpgroupware-cvs] [18536] get_channel_id_from_cmd returns null on failure. |
Date: |
Sun, 18 May 2008 10:56:57 +0000 |
Revision: 18536
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18536
Author: johang
Date: 2008-05-18 10:56:56 +0000 (Sun, 18 May 2008)
Log Message:
-----------
get_channel_id_from_cmd returns null on failure. also make sure the rest of the
code knows that.
Modified Paths:
--------------
trunk/syncml/inc/class.syncml_command_status.inc.php
trunk/syncml/inc/class.syncml_session.inc.php
Modified: trunk/syncml/inc/class.syncml_command_status.inc.php
===================================================================
--- trunk/syncml/inc/class.syncml_command_status.inc.php 2008-05-14
17:42:27 UTC (rev 18535)
+++ trunk/syncml/inc/class.syncml_command_status.inc.php 2008-05-18
10:56:56 UTC (rev 18536)
@@ -44,14 +44,16 @@
$channel_id = $session->get_channel_id_from_cmd(
$this->cmdref, $this->msgref);
-
- switch($this->data)
- {
- case SYNCML_STATUS_OK:
- // insert a temp mapping so we don't
send this item
- // again if client caches the MAP
commands
- $somappings->insert_mapping(
- $channel_id, NULL,
$this->sourceref, 0);
+
+ if(!is_null($channel_id)) {
+ switch($this->data)
+ {
+ case SYNCML_STATUS_OK:
+ // insert a temp mapping so we
don't send this item
+ // again if client caches the
MAP commands
+ $somappings->insert_mapping(
+ $channel_id, NULL,
$this->sourceref, 0);
+ }
}
}
@@ -61,9 +63,11 @@
$channel_id = $session->get_channel_id_from_cmd(
$this->cmdref, $this->msgref);
-
- $somappings->delete_mapping(
- $channel_id, $this->targetref, NULL, NULL);
+
+ if(!is_null($channel_id)) {
+ $somappings->delete_mapping(
+ $channel_id, $this->targetref, NULL,
NULL);
+ }
}
function process_replace(&$response, &$session)
@@ -73,17 +77,19 @@
$channel_id = $session->get_channel_id_from_cmd(
$this->cmdref, $this->msgref);
- 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;
+ 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;
+ }
}
}
}
Modified: trunk/syncml/inc/class.syncml_session.inc.php
===================================================================
--- trunk/syncml/inc/class.syncml_session.inc.php 2008-05-14 17:42:27 UTC
(rev 18535)
+++ trunk/syncml/inc/class.syncml_session.inc.php 2008-05-18 10:56:56 UTC
(rev 18536)
@@ -58,14 +58,19 @@
return $this->account_id;
}
+ /**
+ * Returns ID of a channel that a previously sent command
corresponded
+ * to.
+ *
+ * @param int Command ID of previously sent command.
+ * @return mixed NULL if command ID wasn't recognized, integer
command
+ * ID on success.
+ */
function get_channel_id_from_cmd($cmdid)
{
- if(!is_array($this->session_data))
+ if(!is_array($this->session_data) &&
+
!isset($this->session_data['sent_commands'][$cmdid]))
{
- return array();
- }
- if(!isset($this->session_data['sent_commands'][$cmdid]))
- {
return NULL;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [18536] get_channel_id_from_cmd returns null on failure.,
Johan Gunnarsson <=