20
20
use OCA \DAV \CalDAV \Reminder \NotificationProviderManager ;
21
21
use OCA \DAV \CalDAV \Reminder \Notifier ;
22
22
use OCA \DAV \Capabilities ;
23
-
24
23
use OCA \DAV \CardDAV \ContactsManager ;
25
24
use OCA \DAV \CardDAV \PhotoCache ;
26
25
use OCA \DAV \CardDAV \SyncService ;
47
46
use OCA \DAV \Events \CardUpdatedEvent ;
48
47
use OCA \DAV \Events \SubscriptionCreatedEvent ;
49
48
use OCA \DAV \Events \SubscriptionDeletedEvent ;
50
- use OCA \DAV \HookManager ;
51
49
use OCA \DAV \Listener \ActivityUpdaterListener ;
52
50
use OCA \DAV \Listener \AddMissingIndicesListener ;
53
51
use OCA \DAV \Listener \AddressbookListener ;
62
60
use OCA \DAV \Listener \OutOfOfficeListener ;
63
61
use OCA \DAV \Listener \SubscriptionListener ;
64
62
use OCA \DAV \Listener \TrustedServerRemovedListener ;
63
+ use OCA \DAV \Listener \UserEventsListener ;
65
64
use OCA \DAV \Listener \UserPreferenceListener ;
66
65
use OCA \DAV \Search \ContactsSearchProvider ;
67
66
use OCA \DAV \Search \EventsSearchProvider ;
81
80
use OCP \Config \BeforePreferenceSetEvent ;
82
81
use OCP \Contacts \IManager as IContactsManager ;
83
82
use OCP \DB \Events \AddMissingIndicesEvent ;
84
- use OCP \EventDispatcher \GenericEvent ;
85
83
use OCP \EventDispatcher \IEventDispatcher ;
86
84
use OCP \Federation \Events \TrustedServerRemovedEvent ;
87
85
use OCP \Files \AppData \IAppDataFactory ;
88
- use OCP \IUser ;
89
86
use OCP \Server ;
87
+ use OCP \User \Events \BeforeUserDeletedEvent ;
88
+ use OCP \User \Events \BeforeUserIdUnassignedEvent ;
90
89
use OCP \User \Events \OutOfOfficeChangedEvent ;
91
90
use OCP \User \Events \OutOfOfficeClearedEvent ;
92
91
use OCP \User \Events \OutOfOfficeScheduledEvent ;
92
+ use OCP \User \Events \UserChangedEvent ;
93
+ use OCP \User \Events \UserCreatedEvent ;
94
+ use OCP \User \Events \UserDeletedEvent ;
95
+ use OCP \User \Events \UserFirstTimeLoggedInEvent ;
96
+ use OCP \User \Events \UserIdAssignedEvent ;
97
+ use OCP \User \Events \UserIdUnassignedEvent ;
93
98
use Psr \Container \ContainerInterface ;
94
99
use Psr \Log \LoggerInterface ;
95
100
use Throwable ;
@@ -187,6 +192,15 @@ public function register(IRegistrationContext $context): void {
187
192
$ context ->registerEventListener (OutOfOfficeClearedEvent::class, OutOfOfficeListener::class);
188
193
$ context ->registerEventListener (OutOfOfficeScheduledEvent::class, OutOfOfficeListener::class);
189
194
195
+ $ context ->registerEventListener (UserFirstTimeLoggedInEvent::class, UserEventsListener::class);
196
+ $ context ->registerEventListener (UserIdAssignedEvent::class, UserEventsListener::class);
197
+ $ context ->registerEventListener (BeforeUserIdUnassignedEvent::class, UserEventsListener::class);
198
+ $ context ->registerEventListener (UserIdUnassignedEvent::class, UserEventsListener::class);
199
+ $ context ->registerEventListener (BeforeUserDeletedEvent::class, UserEventsListener::class);
200
+ $ context ->registerEventListener (UserDeletedEvent::class, UserEventsListener::class);
201
+ $ context ->registerEventListener (UserCreatedEvent::class, UserEventsListener::class);
202
+ $ context ->registerEventListener (UserChangedEvent::class, UserEventsListener::class);
203
+
190
204
$ context ->registerNotifierService (Notifier::class);
191
205
192
206
$ context ->registerCalendarProvider (CalendarProvider::class);
@@ -209,18 +223,10 @@ public function boot(IBootContext $context): void {
209
223
$ context ->injectFn ([$ this , 'registerCalendarReminders ' ]);
210
224
}
211
225
212
- public function registerHooks (HookManager $ hm ,
226
+ public function registerHooks (
213
227
IEventDispatcher $ dispatcher ,
214
- IAppContainer $ container ) {
215
- $ hm ->setup ();
216
-
217
- // first time login event setup
218
- $ dispatcher ->addListener (IUser::class . '::firstLogin ' , function ($ event ) use ($ hm ): void {
219
- if ($ event instanceof GenericEvent) {
220
- $ hm ->firstLogin ($ event ->getSubject ());
221
- }
222
- });
223
-
228
+ IAppContainer $ container ,
229
+ ): void {
224
230
$ dispatcher ->addListener (UserUpdatedEvent::class, function (UserUpdatedEvent $ event ) use ($ container ): void {
225
231
/** @var SyncService $syncService */
226
232
$ syncService = Server::get (SyncService::class);
@@ -240,7 +246,6 @@ public function registerHooks(HookManager $hm,
240
246
241
247
// Here we should recalculate if reminders should be sent to new or old sharees
242
248
});
243
-
244
249
}
245
250
246
251
public function registerContactsManager (IContactsManager $ cm , IAppContainer $ container ): void {
0 commit comments