From 0f1ef421b93f410e61a136e9036aba09a8ebb69f Mon Sep 17 00:00:00 2001 From: Ruslan Burakov Date: Thu, 21 May 2020 19:52:23 +0300 Subject: [PATCH 1/5] Fixed unrecognized field "groups" Openfire error on user update. --- src/Gidkom/OpenFireRestApi/OpenFireRestApi.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php index 80e37b1..beec192 100644 --- a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php +++ b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php @@ -79,13 +79,12 @@ public function deleteUser($username) * @param string|false $password Password (Optional) * @param string|false $name Name (Optional) * @param string|false $email Email (Optional) - * @param string[]|false $groups Groups (Optional) * @return json|false Json with data or error, or False when something went fully wrong */ - public function updateUser($username, $password, $name=false, $email=false, $groups=false) + public function updateUser($username, $password, $name=false, $email=false) { $endpoint = '/users/'.$username; - return $this->doRequest('PUT', $endpoint, compact('username', 'password','name','email', 'groups')); + return $this->doRequest('PUT', $endpoint, compact('username', 'password','name','email')); } From 5dca55c342cb515cf64a4700ee387ef10fbeb13b Mon Sep 17 00:00:00 2001 From: Ruslan Burakov Date: Thu, 21 May 2020 19:59:22 +0300 Subject: [PATCH 2/5] Fixed unrecognized field "name" Openfire error on roster item create. --- src/Gidkom/OpenFireRestApi/OpenFireRestApi.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php index beec192..be66609 100644 --- a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php +++ b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php @@ -185,14 +185,14 @@ public function userRosters($username) * * @param string $username Username * @param string $jid JID - * @param string|false $name Name (Optional) - * @param int|false $subscriptionType Subscription (Optional) + * @param string|false $nickname Name (Optional) + * @param int|null $subscriptionType Subscription (Optional) * @return json|false Json with data or error, or False when something went fully wrong */ - public function addToRoster($username, $jid, $name=false, $subscriptionType=false) + public function addToRoster($username, $jid, $nickname=false, $subscriptionType=null) { $endpoint = '/users/'.$username.'/roster'; - return $this->doRequest('POST', $endpoint, compact('jid','name','subscriptionType')); + return $this->doRequest('POST', $endpoint, compact('jid','nickname','subscriptionType')); } From 7bd0c80da49f0e7d990192a476d4ac85cb1646cd Mon Sep 17 00:00:00 2001 From: Ruslan Burakov Date: Thu, 21 May 2020 20:16:54 +0300 Subject: [PATCH 3/5] Fixed update user roster request. --- src/Gidkom/OpenFireRestApi/OpenFireRestApi.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php index be66609..d35ac07 100644 --- a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php +++ b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php @@ -213,15 +213,15 @@ public function deleteFromRoster($username, $jid) * Updates this OpenFire user's roster * * @param string $username Username - * @param string $jid JID + * @param string $JID JID * @param string|false $nickname Nick Name (Optional) - * @param int|false $subscriptionType Subscription (Optional) + * @param int|null $subscriptionType Subscription (Optional) * @return json|false Json with data or error, or False when something went fully wrong */ - public function updateRoster($username, $jid, $nickname=false, $subscriptionType=false) + public function updateRoster($username, $jid, $nickname=false, $subscriptionType=null) { $endpoint = '/users/'.$username.'/roster/'.$jid; - return $this->doRequest('PUT', $endpoint, $jid, compact('jid','username','subscriptionType')); + return $this->doRequest('PUT', $endpoint, compact('jid','nickname','subscriptionType')); } From 72edfe790d6a08a144f8b7347a8ecac47375cbfd Mon Sep 17 00:00:00 2001 From: Ruslan Burakov Date: Fri, 13 May 2022 17:44:13 +0300 Subject: [PATCH 4/5] Added push roster event endpoint. --- src/Gidkom/OpenFireRestApi/OpenFireRestApi.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php index d35ac07..5e1239a 100644 --- a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php +++ b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php @@ -224,6 +224,18 @@ public function updateRoster($username, $jid, $nickname=false, $subscriptionType return $this->doRequest('PUT', $endpoint, compact('jid','nickname','subscriptionType')); } + /** + * Push roster event to this OpenFire user + * + * @param string $username Username + * @return json|false Json with data or error, or False when something went fully wrong + */ + public function pushRosterEvent($username) + { + $endpoint = '/users/'.$username.'/roster/push'; + return $this->doRequest('POST', $endpoint); + } + From a58ce43ea93b63d09da8e77d1d8cb04eea8ff24a Mon Sep 17 00:00:00 2001 From: Ruslan Burakov Date: Fri, 23 Sep 2022 15:02:42 +0300 Subject: [PATCH 5/5] Added message history clear endpoint. --- src/Gidkom/OpenFireRestApi/OpenFireRestApi.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php index 5e1239a..fac5419 100644 --- a/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php +++ b/src/Gidkom/OpenFireRestApi/OpenFireRestApi.php @@ -534,4 +534,16 @@ public function broadcastMessage($message = '') return $this->doRequest('POST', $endpoint, $content); } + /** + * Clear messages history + * + * @param string $username Username + * @param string $targetUsername Username to clear messages history + * @return json|false Json with data or error, or False when something went fully wrong + */ + public function clearMessages($username, $targetUsername) + { + $endpoint = '/archive/messages/'.$username.'/'.$targetUsername; + return $this->doRequest('DELETE', $endpoint ); + } }