diff options
| author | 2023-07-10 18:04:59 +0200 | |
|---|---|---|
| committer | 2023-07-10 18:04:59 +0200 | |
| commit | 3642cd25e4eedbe2c3c2981eac03422b26a8eda0 (patch) | |
| tree | 2a3245523568b2ef27bbba975d7000605087f6d0 | |
| parent | Revert "New server config array "webfinger_domains"." (diff) | |
| download | snac2-3642cd25e4eedbe2c3c2981eac03422b26a8eda0.tar.gz snac2-3642cd25e4eedbe2c3c2981eac03422b26a8eda0.tar.xz snac2-3642cd25e4eedbe2c3c2981eac03422b26a8eda0.zip | |
Simplified inbox_list().
| -rw-r--r-- | data.c | 22 |
1 files changed, 7 insertions, 15 deletions
| @@ -1725,13 +1725,9 @@ void inbox_add(const char *inbox) | |||
| 1725 | xs *fn = xs_fmt("%s/inbox/%s", srv_basedir, md5); | 1725 | xs *fn = xs_fmt("%s/inbox/%s", srv_basedir, md5); |
| 1726 | FILE *f; | 1726 | FILE *f; |
| 1727 | 1727 | ||
| 1728 | if (strlen(inbox) < 256 && (f = fopen(fn, "w")) != NULL) { | 1728 | if ((f = fopen(fn, "w")) != NULL) { |
| 1729 | pthread_mutex_lock(&data_mutex); | ||
| 1730 | |||
| 1731 | fprintf(f, "%s\n", inbox); | 1729 | fprintf(f, "%s\n", inbox); |
| 1732 | fclose(f); | 1730 | fclose(f); |
| 1733 | |||
| 1734 | pthread_mutex_unlock(&data_mutex); | ||
| 1735 | } | 1731 | } |
| 1736 | } | 1732 | } |
| 1737 | 1733 | ||
| @@ -1760,18 +1756,14 @@ xs_list *inbox_list(void) | |||
| 1760 | FILE *f; | 1756 | FILE *f; |
| 1761 | 1757 | ||
| 1762 | if ((f = fopen(v, "r")) != NULL) { | 1758 | if ((f = fopen(v, "r")) != NULL) { |
| 1763 | char line[256]; | 1759 | xs *line = xs_readline(f); |
| 1764 | |||
| 1765 | if (fgets(line, sizeof(line), f)) { | ||
| 1766 | fclose(f); | ||
| 1767 | 1760 | ||
| 1768 | int i = strlen(line); | 1761 | if (line) { |
| 1769 | 1762 | line = xs_strip_i(line); | |
| 1770 | if (i) { | 1763 | ibl = xs_list_append(ibl, line); |
| 1771 | line[i - 1] = '\0'; | ||
| 1772 | ibl = xs_list_append(ibl, line); | ||
| 1773 | } | ||
| 1774 | } | 1764 | } |
| 1765 | |||
| 1766 | fclose(f); | ||
| 1775 | } | 1767 | } |
| 1776 | } | 1768 | } |
| 1777 | 1769 | ||