summaryrefslogtreecommitdiffstats
path: root/apps/contacts/lib
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-06-26 05:26:50 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-06-26 05:26:50 +0200
commitbf756293c62ceb63a4bad7491d9fc90e3c6c9af0 (patch)
tree1b4fad2e9bba01fbd4a22f6cbd679295ff56ae71 /apps/contacts/lib
parent8df59852a46b50a8ac0984a4500954dba2725d9b (diff)
downloadnextcloud-server-bf756293c62ceb63a4bad7491d9fc90e3c6c9af0.tar.gz
nextcloud-server-bf756293c62ceb63a4bad7491d9fc90e3c6c9af0.zip
Added signals.
Diffstat (limited to 'apps/contacts/lib')
-rw-r--r--apps/contacts/lib/hooks.php9
-rw-r--r--apps/contacts/lib/vcard.php9
2 files changed, 14 insertions, 4 deletions
diff --git a/apps/contacts/lib/hooks.php b/apps/contacts/lib/hooks.php
index e74b465a47b..0a920fc519d 100644
--- a/apps/contacts/lib/hooks.php
+++ b/apps/contacts/lib/hooks.php
@@ -21,6 +21,15 @@
*/
/**
+ * The following signals are being emitted:
+ *
+ * OC_Contacts_VCard::post_moveToAddressbook(array('aid' => $aid, 'id' => $id))
+ * OC_Contacts_VCard::pre_deleteVCard(array('aid' => $aid, 'id' => $id, 'uri' = $uri)); (NOTE: the values can be null depending on which method emits them)
+ * OC_Contacts_VCard::post_updateVCard($id)
+ * OC_Contacts_VCard::post_createVCard($newid)
+ */
+
+/**
* This class contains all hooks.
*/
class OC_Contacts_Hooks{
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 110d721ace0..0f3a08844b1 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -293,7 +293,7 @@ class OC_Contacts_VCard{
$newid = OCP\DB::insertid('*PREFIX*contacts_cards');
OC_Contacts_Addressbook::touch($aid);
-
+ OC_Hook::emit('OC_Contacts_VCard', 'post_createVCard', $newid);
return $newid;
}
@@ -360,7 +360,7 @@ class OC_Contacts_VCard{
$result = $stmt->execute(array($fn,$data,time(),$id));
OC_Contacts_Addressbook::touch($oldcard['addressbookid']);
-
+ OC_Hook::emit('OC_Contacts_VCard', 'post_updateVCard', $id);
return true;
}
@@ -388,6 +388,7 @@ class OC_Contacts_VCard{
*/
public static function delete($id){
// FIXME: Add error checking.
+ OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => null, 'id' => $id, 'uri' => null));
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
$stmt->execute(array($id));
@@ -402,6 +403,7 @@ class OC_Contacts_VCard{
*/
public static function deleteFromDAVData($aid,$uri){
// FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
+ OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => $aid, 'id' => null, 'uri' => $uid));
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
$stmt->execute(array($aid,$uri));
OC_Contacts_Addressbook::touch($aid);
@@ -559,9 +561,8 @@ class OC_Contacts_VCard{
return false;
}
}
-
+ OC_Hook::emit('OC_Contacts_VCard', 'post_moveToAddressbook', array('aid' => $aid, 'id' => $id));
OC_Contacts_Addressbook::touch($aid);
return true;
}
-
}