- if (pop_check_user (pop) == 0)
- g_message ("User is trying to authenticate as %s.", pop->user);
- pop->orig_read (hook, pop->line->str, pop->line->len);
+ case HC_EVENT_READ:
+ while ((r = hc_conn_read (conn, buffer, sizeof (buffer))) > 0)
+ {
+ g_string_append_len (pop->buffer, buffer, r);
+ while (pop_getline (pop) == 0)
+ {
+ if (pop_check_user (pop) == 0)
+ {
+ g_message ("User is trying to authenticate as %s.",
+ pop->user);
+ if (usermap_perm (pop->user) == ACCESS_DENY)
+ {
+ g_message ("Denying access to user %s.", pop->user);
+ if (pop_conn->func)
+ pop_conn->func (pop_conn, HC_EVENT_CLOSE,
+ pop_conn->data);
+ return;
+ }
+ }
+ g_string_append_len (pop->push, pop->line->str, pop->line->len);
+ if (pop_conn->func)
+ pop_conn->func (pop_conn, HC_EVENT_READ, pop_conn->data);
+ }
+ }
+ break;
+ case HC_EVENT_CLOSE:
+ if (pop_conn->func)
+ pop_conn->func (pop_conn, event, pop_conn->data);
+ break;