Lines Matching refs:user

48 static void session_stats_refresh_timeout(struct mail_user *user);
50 static void stats_io_activate(struct mail_user *user)
52 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
56 /* the first user sets the global user. the second user sets
57 it to NULL. when we get back to one user we'll need to set
58 the global user again somewhere. do it here. */
59 stats_global_user = user;
66 mail_user_stats_fill(user, suser->pre_io_stats);
70 static void stats_add_session(struct mail_user *user)
72 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
79 mail_user_stats_fill(user, new_stats);
123 static void session_stats_refresh(struct mail_user *user)
125 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
131 if (mail_stats_connection_connect(suser->stats_conn, user) == 0)
139 mail_stats_connection_send_session(suser->stats_conn, user,
146 session_stats_refresh_timeout, user);
154 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(box->storage->user);
194 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(ctx->box->storage->user);
205 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(ctx->box->storage->user);
215 struct mail_user *user = ctx->transaction->box->storage->user;
216 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
231 session_stats_refresh(user);
243 session_stats_refresh(box->storage->user);
267 struct stats_user *suser = STATS_USER_CONTEXT(box->storage->user);
285 static void session_stats_refresh_timeout(struct mail_user *user)
288 stats_add_session(user);
289 session_stats_refresh(user);
292 static void stats_io_deactivate(struct mail_user *user)
294 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
298 stats_add_session(user);
303 stats_add_session(user);
304 session_stats_refresh(user);
308 session_stats_refresh_timeout, user);
312 static void stats_user_stats_fill(struct mail_user *user, struct stats *stats)
314 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
320 suser->module_ctx.super.stats_fill(user, stats);
323 static void stats_user_deinit(struct mail_user *user)
325 struct stats_user *suser = STATS_USER_CONTEXT_REQUIRE(user);
333 i_assert(stats_global_user == user);
334 stats_add_session(user);
340 stats_io_deactivate, user);
342 session_stats_refresh(user);
344 mail_stats_connection_disconnect(stats_conn, user);
347 suser->module_ctx.super.deinit(user);
352 static void stats_user_created(struct mail_user *user)
357 struct mail_user_vfuncs *v = user->vlast;
363 mail-storage-service wasn't used to create this user.
367 if (user->autocreated) {
368 /* lda / shared user. we're not tracking this one. */
373 str = mail_user_plugin_getenv(user, "old_stats_refresh");
389 path = mail_user_plugin_getenv(user, "old_stats_notify_path");
393 path = t_strconcat(user->set->base_dir, "/", path, NULL);
399 /* first user connection */
400 stats_global_user = user;
402 /* second user connection. we'll need to start doing
405 having 1 user, in which case stats_global_user=NULL) */
413 suser = p_new(user->pool, struct stats_user, 1);
415 user->vlast = &suser->module_ctx.super;
420 if (mail_user_plugin_getenv_bool(user, "old_stats_track_cmds"))
424 if (user->session_id != NULL && user->session_id[0] != '\0')
425 suser->stats_session_id = user->session_id;
431 p_strdup(user->pool, guid_128_to_string(guid));
434 user->stats_enabled = TRUE;
439 stats_io_deactivate, user);
441 suser->pre_io_stats = stats_alloc(user->pool);
442 suser->session_stats = stats_alloc(user->pool);
443 suser->last_sent_session_stats = stats_alloc(user->pool);
445 MODULE_CONTEXT_SET(user, stats_user_module, suser);
446 if (mail_stats_connection_connect(suser->stats_conn, user) == 0)
450 session_stats_refresh_timeout, user);
453 users. otherwise the next user will start with the previous one's
455 mail_user_stats_fill(user, suser->pre_io_stats);