/** * finger_config: **/ static gboolean finger_config(ZProxy *s) { FingerProxy *self = Z_CAST(s, FingerProxy); finger_config_set_defaults(self); finger_register_vars(self); return Z_SUPER(s, ZProxy)->config(s); }
/** * anypy_config: * @s: AnyPyProxy instance casted to ZProxy * * This function is called upon startup to configure the proxy. * This calls the the __pre_config__, config and __post_config__ events. **/ static gboolean anypy_config(ZProxy *s) { AnyPyProxy *self = Z_CAST(s, AnyPyProxy); anypy_config_set_defaults(self); anypy_register_vars(self); if (Z_SUPER(s, ZProxy)->config(s)) { return TRUE; } return FALSE; }
static GIOStatus pop3_transfer_src_read(ZTransfer2 *s, ZStream *stream, gchar *buf, gsize count, gsize *bytes_read, GError **err) { GIOStatus ret; Pop3Transfer *self = Z_CAST(s, Pop3Transfer); Pop3Proxy *owner = Z_CAST(s->owner, Pop3Proxy); ret = Z_SUPER(s, ZTransfer2)->src_read(s, stream, buf, count, bytes_read, err); if (self->header_state < POP3_HEADER_END && (ret == G_IO_STATUS_NORMAL || (ret == G_IO_STATUS_AGAIN && *bytes_read > 0))) { if (*bytes_read == 0) { self->header_state = POP3_HEADER_END; } else { gsize bytes_need = *bytes_read; if (buf[0] != ' ' && buf[0] != '\t') { self->header_state = POP3_HEADER_NONE; self->actual_header = NULL; } while (buf[bytes_need - 1] == '\n' || buf[bytes_need - 1] == '\r' || buf[bytes_need - 1] == ' ') bytes_need--; z_trace(NULL, "Read header line; line='%.*s'", (gint) bytes_need, buf); if (self->header_state == POP3_HEADER_NONE) { if (g_ascii_strncasecmp(buf, FROM, MIN(__builtin_strlen(FROM), bytes_need)) == 0) { if (owner->from == NULL) { self->header_state = POP3_HEADER_INSIDE; owner->from = g_string_new_len(buf + __builtin_strlen(FROM), bytes_need - __builtin_strlen(FROM)); self->actual_header = owner->from; } else { /* FIXME: Log */ } } else if (g_ascii_strncasecmp(buf, TO, MIN(__builtin_strlen(TO), bytes_need)) == 0) { if (owner->to == NULL) { self->header_state = POP3_HEADER_INSIDE; owner->to = g_string_new_len(buf + __builtin_strlen(TO), bytes_need - __builtin_strlen(TO)); self->actual_header = owner->to; } else { /* FIXME: Log */ } } else if (g_ascii_strncasecmp(buf, SUBJECT, MIN(__builtin_strlen(SUBJECT), bytes_need)) == 0) { if (owner->subject == NULL) { self->header_state = POP3_HEADER_INSIDE; owner->subject = g_string_new_len(buf + __builtin_strlen(SUBJECT), bytes_need - __builtin_strlen(SUBJECT)); self->actual_header = owner->subject; } else { /* FIXME: Log */ } } } else { g_string_append(self->actual_header, "\r\n"); g_string_append_len(self->actual_header, buf, bytes_need); } } } return ret; }