]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added signals.
authorThomas Tanghus <thomas@tanghus.net>
Tue, 26 Jun 2012 03:26:50 +0000 (05:26 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Tue, 26 Jun 2012 03:26:50 +0000 (05:26 +0200)
apps/contacts/lib/hooks.php
apps/contacts/lib/vcard.php

index e74b465a47bfba0213a7928ff987b6db96ba7ec7..0a920fc519d1a350fffb93672315149a0840111a 100644 (file)
  *
  */
 
+/**
+ * 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.
  */
index 110d721ace0926798fce420e320b69f82268716c..0f3a08844b1827fef62cec74a82f6fc25de93c83 100644 (file)
@@ -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;
        }
-
 }