summaryrefslogtreecommitdiff
path: root/src/core/mail_sql.c
blob: 95b93f92d5635db25060bb48ec6b7ebb9eff9658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
#include "mail_sql.h"
#include "hybbx/service.h"
#include "hybbx/session.h"
#include "hybbx/traffic.h"
#include "hybbx/util.h"
#include "storage_private.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#ifdef HYBBX_HAVE_SQLITE
#include <sqlite3.h>

#define MAIL_FOLDER_INBOX 0
#define MAIL_FOLDER_RECYCLE 1

static int mail_entry_compare(const void *a, const void *b)
{
    const hybbx_mail_entry_t *ea = (const hybbx_mail_entry_t *)a;
    const hybbx_mail_entry_t *eb = (const hybbx_mail_entry_t *)b;

    if (ea->received_at > eb->received_at) {
        return -1;
    }
    if (ea->received_at < eb->received_at) {
        return 1;
    }
    if (ea->id > eb->id) {
        return -1;
    }
    if (ea->id < eb->id) {
        return 1;
    }
    return 0;
}

static hybbx_result_t mail_sql_meta_bump(sqlite3 *db, const char *key,
                                         uint64_t *value)
{
    sqlite3_stmt *stmt;
    int rc;

    *value = 0;

    rc = sqlite3_prepare_v2(db,
                            "SELECT value FROM meta WHERE key=?1;",
                            -1, &stmt, NULL);
    if (rc == SQLITE_OK) {
        sqlite3_bind_text(stmt, 1, key, -1, SQLITE_STATIC);
        if (sqlite3_step(stmt) == SQLITE_ROW) {
            *value = (uint64_t)sqlite3_column_int64(stmt, 0);
        }
        sqlite3_finalize(stmt);
    }

    (*value)++;

    rc = sqlite3_prepare_v2(db,
                            "INSERT INTO meta(key,value) VALUES(?1,?2) "
                            "ON CONFLICT(key) DO UPDATE SET value=?2;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_text(stmt, 1, key, -1, SQLITE_STATIC);
    sqlite3_bind_int64(stmt, 2, (sqlite3_int64)*value);
    rc = sqlite3_step(stmt);
    sqlite3_finalize(stmt);

    return (rc == SQLITE_DONE) ? HYBBX_OK : HYBBX_ERR_IO;
}

static void mail_sql_owner_norm(char *owner, size_t len, const char *username)
{
    hybbx_strlcpy(owner, username, len);
    hybbx_username_normalize(owner);
}

hybbx_result_t hybbx_mail_sql_load_inbox(hybbx_storage_t *storage,
                                         const char *username,
                                         hybbx_mail_entry_t *entries,
                                         size_t max_entries,
                                         size_t *out_count)
{
    sqlite3 *db;
    sqlite3_stmt *stmt;
    char owner[HYBBX_USER_NAME_MAX];
    int rc;
    size_t count = 0;

    if (storage == NULL || username == NULL || entries == NULL ||
        out_count == NULL) {
        return HYBBX_ERR_INVALID;
    }

    db = hybbx_storage_sql_mail_db(storage);
    if (db == NULL) {
        return HYBBX_ERR_IO;
    }

    mail_sql_owner_norm(owner, sizeof(owner), username);
    *out_count = 0;

    rc = sqlite3_prepare_v2(db,
                            "SELECT id,from_user,subject,received_at,read_flag "
                            "FROM messages WHERE owner=?1 AND folder=?2 "
                            "ORDER BY received_at DESC, id DESC;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_text(stmt, 1, owner, -1, SQLITE_STATIC);
    sqlite3_bind_int(stmt, 2, MAIL_FOLDER_INBOX);

    while (sqlite3_step(stmt) == SQLITE_ROW && count < max_entries) {
        hybbx_mail_entry_t *entry = &entries[count];

        memset(entry, 0, sizeof(*entry));
        entry->id = (uint64_t)sqlite3_column_int64(stmt, 0);
        hybbx_strlcpy(entry->from, (const char *)sqlite3_column_text(stmt, 1),
                      sizeof(entry->from));
        hybbx_strlcpy(entry->subject,
                      (const char *)sqlite3_column_text(stmt, 2),
                      sizeof(entry->subject));
        entry->received_at = (time_t)sqlite3_column_int64(stmt, 3);
        entry->read = sqlite3_column_int(stmt, 4);
        count++;
    }

    sqlite3_finalize(stmt);

    if (count > 1) {
        qsort(entries, count, sizeof(entries[0]), mail_entry_compare);
    }

    *out_count = count;
    return HYBBX_OK;
}

static hybbx_result_t mail_sql_trim_inbox(sqlite3 *db, const char *owner,
                                          unsigned max_messages)
{
    sqlite3_stmt *stmt;
    int rc;
    size_t count = 0;

    rc = sqlite3_prepare_v2(db,
                            "SELECT COUNT(*) FROM messages "
                            "WHERE owner=?1 AND folder=?2;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_text(stmt, 1, owner, -1, SQLITE_STATIC);
    sqlite3_bind_int(stmt, 2, MAIL_FOLDER_INBOX);
    if (sqlite3_step(stmt) == SQLITE_ROW) {
        count = (size_t)sqlite3_column_int64(stmt, 0);
    }
    sqlite3_finalize(stmt);

    if (count <= max_messages) {
        return HYBBX_OK;
    }

    rc = sqlite3_prepare_v2(db,
                            "DELETE FROM messages WHERE id IN ("
                            "SELECT id FROM messages WHERE owner=?1 "
                            "AND folder=?2 ORDER BY received_at ASC, id ASC "
                            "LIMIT ?3);",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_text(stmt, 1, owner, -1, SQLITE_STATIC);
    sqlite3_bind_int(stmt, 2, MAIL_FOLDER_INBOX);
    sqlite3_bind_int64(stmt, 3, (sqlite3_int64)(count - max_messages));
    rc = sqlite3_step(stmt);
    sqlite3_finalize(stmt);

    return (rc == SQLITE_DONE) ? HYBBX_OK : HYBBX_ERR_IO;
}

hybbx_result_t hybbx_mail_sql_deliver(hybbx_storage_t *storage,
                                      const hybbx_mail_config_t *mail,
                                      const char *from_user,
                                      const char *to_user,
                                      const char *subject,
                                      const char *body)
{
    sqlite3 *db;
    sqlite3_stmt *stmt;
    char owner[HYBBX_USER_NAME_MAX];
    uint64_t id;
    int rc;
    hybbx_result_t hres;
    time_t now = time(NULL);

    if (storage == NULL || mail == NULL || from_user == NULL ||
        to_user == NULL) {
        return HYBBX_ERR_INVALID;
    }

    if (subject == NULL) {
        subject = "";
    }
    if (body == NULL) {
        body = "";
    }

    db = hybbx_storage_sql_mail_db(storage);
    if (db == NULL) {
        return HYBBX_ERR_IO;
    }

    mail_sql_owner_norm(owner, sizeof(owner), to_user);

    hres = mail_sql_meta_bump(db, "mail_next", &id);
    if (hres != HYBBX_OK) {
        return hres;
    }

    rc = sqlite3_prepare_v2(db,
                            "INSERT INTO messages(id,owner,from_user,subject,"
                            "body,received_at,read_flag,deleted_at,folder) "
                            "VALUES(?1,?2,?3,?4,?5,?6,0,0,?7);",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_int64(stmt, 1, (sqlite3_int64)id);
    sqlite3_bind_text(stmt, 2, owner, -1, SQLITE_STATIC);
    sqlite3_bind_text(stmt, 3, from_user, -1, SQLITE_STATIC);
    sqlite3_bind_text(stmt, 4, subject, -1, SQLITE_STATIC);
    sqlite3_bind_text(stmt, 5, body, -1, SQLITE_STATIC);
    sqlite3_bind_int64(stmt, 6, (sqlite3_int64)now);
    sqlite3_bind_int(stmt, 7, MAIL_FOLDER_INBOX);
    rc = sqlite3_step(stmt);
    sqlite3_finalize(stmt);
    if (rc != SQLITE_DONE) {
        return HYBBX_ERR_IO;
    }

    return mail_sql_trim_inbox(db, owner, mail->max_messages);
}

unsigned hybbx_mail_sql_purge_recycle(hybbx_storage_t *storage,
                                      const hybbx_mail_config_t *mail,
                                      const char *username)
{
    sqlite3 *db;
    sqlite3_stmt *stmt;
    char owner[HYBBX_USER_NAME_MAX];
    time_t cutoff;
    int rc;

    if (storage == NULL || mail == NULL || username == NULL) {
        return 0;
    }

    db = hybbx_storage_sql_mail_db(storage);
    if (db == NULL) {
        return 0;
    }

    mail_sql_owner_norm(owner, sizeof(owner), username);
    cutoff = time(NULL) - (time_t)mail->recycle_days * 86400;

    rc = sqlite3_prepare_v2(db,
                            "DELETE FROM messages WHERE owner=?1 AND folder=?2 "
                            "AND deleted_at > 0 AND deleted_at < ?3;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return 0;
    }

    sqlite3_bind_text(stmt, 1, owner, -1, SQLITE_STATIC);
    sqlite3_bind_int(stmt, 2, MAIL_FOLDER_RECYCLE);
    sqlite3_bind_int64(stmt, 3, (sqlite3_int64)cutoff);
    rc = sqlite3_step(stmt);
    sqlite3_finalize(stmt);

    return (rc == SQLITE_DONE) ? (unsigned)sqlite3_changes(db) : 0;
}

static hybbx_result_t mail_sql_resolve_index(hybbx_service_t *service,
                                             hybbx_session_t *session,
                                             unsigned list_index,
                                             uint64_t *out_id)
{
    const hybbx_mail_config_t *mail;
    hybbx_mail_entry_t entries[HYBBX_MAIL_MAX_MESSAGES];
    size_t count;
    hybbx_result_t rc;

    mail = hybbx_service_get_mail(service);
    if (mail == NULL || !mail->enabled) {
        return HYBBX_ERR_UNSUPPORTED;
    }

    rc = hybbx_mail_sql_load_inbox(hybbx_service_get_storage(service),
                                  hybbx_session_username(session),
                                  entries, HYBBX_MAIL_MAX_MESSAGES, &count);
    if (rc != HYBBX_OK) {
        return rc;
    }

    if (list_index == 0 || list_index > count) {
        return HYBBX_ERR_NOT_FOUND;
    }

    *out_id = entries[list_index - 1].id;
    return HYBBX_OK;
}

hybbx_result_t hybbx_mail_sql_read(hybbx_service_t *service,
                                   hybbx_session_t *session,
                                   unsigned list_index)
{
    hybbx_storage_t *storage;
    sqlite3 *db;
    sqlite3_stmt *stmt;
    uint64_t id;
    char owner[HYBBX_USER_NAME_MAX];
    char line[HYBBX_LINE_MAX];
    int rc;
    hybbx_result_t hres;
    const char *from_user;
    const char *subject;
    const char *body;

    storage = hybbx_service_get_storage(service);
    if (storage == NULL) {
        return HYBBX_ERR_INVALID;
    }

    hres = mail_sql_resolve_index(service, session, list_index, &id);
    if (hres == HYBBX_ERR_NOT_FOUND) {
        hybbx_session_write_line(session, "No such message.");
        return HYBBX_OK;
    }
    if (hres != HYBBX_OK) {
        return hres;
    }

    db = hybbx_storage_sql_mail_db(storage);
    if (db == NULL) {
        return HYBBX_ERR_IO;
    }

    mail_sql_owner_norm(owner, sizeof(owner), hybbx_session_username(session));

    rc = sqlite3_prepare_v2(db,
                            "SELECT from_user,subject,body FROM messages "
                            "WHERE id=?1 AND owner=?2 AND folder=?3;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_int64(stmt, 1, (sqlite3_int64)id);
    sqlite3_bind_text(stmt, 2, owner, -1, SQLITE_STATIC);
    sqlite3_bind_int(stmt, 3, MAIL_FOLDER_INBOX);
    rc = sqlite3_step(stmt);
    if (rc != SQLITE_ROW) {
        sqlite3_finalize(stmt);
        hybbx_session_write_line(session, "Cannot open message.");
        return HYBBX_ERR_IO;
    }

    from_user = (const char *)sqlite3_column_text(stmt, 0);
    subject = (const char *)sqlite3_column_text(stmt, 1);
    body = (const char *)sqlite3_column_text(stmt, 2);
    if (from_user == NULL) {
        from_user = "";
    }
    if (subject == NULL) {
        subject = "";
    }
    if (body == NULL) {
        body = "";
    }

    snprintf(line, sizeof(line), "From: %s", from_user);
    hybbx_session_write_line(session, line);
    snprintf(line, sizeof(line), "Subject: %s", subject);
    hybbx_session_write_line(session, line);

    {
        const char *p = body;
        const char *nl;

        while (*p != '\0') {
            nl = strchr(p, '\n');
            if (nl == NULL) {
                hybbx_session_write_line(session, p);
                break;
            }
            if (nl > p) {
                size_t chunk = (size_t)(nl - p);

                if (chunk >= sizeof(line)) {
                    chunk = sizeof(line) - 1;
                }
                memcpy(line, p, chunk);
                line[chunk] = '\0';
                hybbx_session_write_line(session, line);
            } else {
                hybbx_session_write_line(session, "");
            }
            p = nl + 1;
        }
    }

    sqlite3_finalize(stmt);

    rc = sqlite3_prepare_v2(db,
                            "UPDATE messages SET read_flag=1 "
                            "WHERE id=?1 AND owner=?2;",
                            -1, &stmt, NULL);
    if (rc == SQLITE_OK) {
        sqlite3_bind_int64(stmt, 1, (sqlite3_int64)id);
        sqlite3_bind_text(stmt, 2, owner, -1, SQLITE_STATIC);
        (void)sqlite3_step(stmt);
        sqlite3_finalize(stmt);
    }

    return HYBBX_OK;
}

hybbx_result_t hybbx_mail_sql_delete_range(hybbx_service_t *service,
                                           hybbx_session_t *session,
                                           unsigned from,
                                           unsigned to)
{
    const hybbx_mail_config_t *mail;
    hybbx_storage_t *storage;
    sqlite3 *db;
    sqlite3_stmt *stmt;
    hybbx_mail_entry_t entries[HYBBX_MAIL_MAX_MESSAGES];
    char owner[HYBBX_USER_NAME_MAX];
    size_t count;
    size_t i;
    unsigned moved = 0;
    time_t now = time(NULL);
    int rc;
    hybbx_result_t hres;

    mail = hybbx_service_get_mail(service);
    storage = hybbx_service_get_storage(service);
    if (mail == NULL || !mail->enabled || storage == NULL) {
        return HYBBX_ERR_UNSUPPORTED;
    }

    if (to == 0) {
        to = from;
    }

    (void)hybbx_mail_sql_purge_recycle(storage, mail,
                                       hybbx_session_username(session));

    hres = hybbx_mail_sql_load_inbox(storage, hybbx_session_username(session),
                                      entries, HYBBX_MAIL_MAX_MESSAGES, &count);
    if (hres != HYBBX_OK) {
        return hres;
    }

    if (from > count || to > count) {
        hybbx_session_write_line(session, "No such message.");
        return HYBBX_OK;
    }

    db = hybbx_storage_sql_mail_db(storage);
    if (db == NULL) {
        return HYBBX_ERR_IO;
    }

    mail_sql_owner_norm(owner, sizeof(owner), hybbx_session_username(session));

    rc = sqlite3_prepare_v2(db,
                            "UPDATE messages SET folder=?4, deleted_at=?3 "
                            "WHERE id=?1 AND owner=?2 AND folder=?5;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        return HYBBX_ERR_IO;
    }

    for (i = (size_t)(from - 1); i < (size_t)to; i++) {
        sqlite3_bind_int64(stmt, 1, (sqlite3_int64)entries[i].id);
        sqlite3_bind_text(stmt, 2, owner, -1, SQLITE_STATIC);
        sqlite3_bind_int64(stmt, 3, (sqlite3_int64)now);
        sqlite3_bind_int(stmt, 4, MAIL_FOLDER_RECYCLE);
        sqlite3_bind_int(stmt, 5, MAIL_FOLDER_INBOX);
        rc = sqlite3_step(stmt);
        sqlite3_reset(stmt);
        if (rc == SQLITE_DONE && sqlite3_changes(db) > 0) {
            moved++;
        }
    }

    sqlite3_finalize(stmt);

    if (moved == 0) {
        hybbx_session_write_line(session, "Delete failed.");
        return HYBBX_ERR_IO;
    }

    if (moved == 1) {
        hybbx_session_write_line(session,
            "Message moved to recycle (auto-purge after configured days).");
    } else {
        char buf[64];

        snprintf(buf, sizeof(buf),
                 "%u messages moved to recycle (auto-purge after %u days).",
                 moved, mail->recycle_days);
        hybbx_session_write_line(session, buf);
    }

    return HYBBX_OK;
}

hybbx_result_t hybbx_mail_sql_recycle_empty(hybbx_service_t *service,
                                            hybbx_session_t *session)
{
    const hybbx_mail_config_t *mail;
    hybbx_storage_t *storage;
    sqlite3 *db;
    sqlite3_stmt *stmt;
    char owner[HYBBX_USER_NAME_MAX];
    int rc;
    char buf[64];

    mail = hybbx_service_get_mail(service);
    storage = hybbx_service_get_storage(service);
    if (mail == NULL || !mail->enabled || storage == NULL) {
        return HYBBX_ERR_UNSUPPORTED;
    }

    db = hybbx_storage_sql_mail_db(storage);
    if (db == NULL) {
        return HYBBX_ERR_IO;
    }

    mail_sql_owner_norm(owner, sizeof(owner), hybbx_session_username(session));
    (void)hybbx_mail_sql_purge_recycle(storage, mail, owner);

    rc = sqlite3_prepare_v2(db,
                            "DELETE FROM messages WHERE owner=?1 AND folder=?2;",
                            -1, &stmt, NULL);
    if (rc != SQLITE_OK) {
        hybbx_session_write_line(session, "Cannot read recycle bin.");
        return HYBBX_ERR_IO;
    }

    sqlite3_bind_text(stmt, 1, owner, -1, SQLITE_STATIC);
    sqlite3_bind_int(stmt, 2, MAIL_FOLDER_RECYCLE);
    rc = sqlite3_step(stmt);
    sqlite3_finalize(stmt);

    if (rc != SQLITE_DONE) {
        hybbx_session_write_line(session, "Cannot read recycle bin.");
        return HYBBX_ERR_IO;
    }

    if (sqlite3_changes(db) == 0) {
        hybbx_session_write_line(session, "Recycle bin empty.");
    } else {
        snprintf(buf, sizeof(buf), "Recycle bin emptied (%d message(s)).",
                 sqlite3_changes(db));
        hybbx_session_write_line(session, buf);
    }

    return HYBBX_OK;
}

#else /* HYBBX_HAVE_SQLITE */

hybbx_result_t hybbx_mail_sql_load_inbox(hybbx_storage_t *storage,
                                         const char *username,
                                         hybbx_mail_entry_t *entries,
                                         size_t max_entries,
                                         size_t *out_count)
{
    (void)storage;
    (void)username;
    (void)entries;
    (void)max_entries;
    (void)out_count;
    return HYBBX_ERR_UNSUPPORTED;
}

hybbx_result_t hybbx_mail_sql_deliver(hybbx_storage_t *storage,
                                      const hybbx_mail_config_t *mail,
                                      const char *from_user,
                                      const char *to_user,
                                      const char *subject,
                                      const char *body)
{
    (void)storage;
    (void)mail;
    (void)from_user;
    (void)to_user;
    (void)subject;
    (void)body;
    return HYBBX_ERR_UNSUPPORTED;
}

hybbx_result_t hybbx_mail_sql_read(hybbx_service_t *service,
                                   hybbx_session_t *session,
                                   unsigned list_index)
{
    (void)service;
    (void)session;
    (void)list_index;
    return HYBBX_ERR_UNSUPPORTED;
}

hybbx_result_t hybbx_mail_sql_delete_range(hybbx_service_t *service,
                                           hybbx_session_t *session,
                                           unsigned from,
                                           unsigned to)
{
    (void)service;
    (void)session;
    (void)from;
    (void)to;
    return HYBBX_ERR_UNSUPPORTED;
}

hybbx_result_t hybbx_mail_sql_recycle_empty(hybbx_service_t *service,
                                            hybbx_session_t *session)
{
    (void)service;
    (void)session;
    return HYBBX_ERR_UNSUPPORTED;
}

unsigned hybbx_mail_sql_purge_recycle(hybbx_storage_t *storage,
                                      const hybbx_mail_config_t *mail,
                                      const char *username)
{
    (void)storage;
    (void)mail;
    (void)username;
    return 0;
}

#endif /* HYBBX_HAVE_SQLITE */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com