summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md12
-rw-r--r--TODO.md2
-rw-r--r--data.c12
-rw-r--r--format.c6
-rw-r--r--html.c8
-rw-r--r--main.c35
6 files changed, 59 insertions, 16 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index f39a912..7a23b8b 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,17 @@
1# Release Notes 1# Release Notes
2 2
3## UNRELEASED
4
5Fixed a search bug.
6
7Each notification includes a link labelled `Context`, that leads to a page with the full conversation tree the post is a part of.
8
9Fixed more crashes (thank you very much to inz for helping me debugging this).
10
11Fixed link detection in posts (contributed by inz).
12
13Allow multiple editors for command-line posts (contributed by inz).
14
3## 2.71 15## 2.71
4 16
5Fixed memory leak (contributed by inz). 17Fixed memory leak (contributed by inz).
diff --git a/TODO.md b/TODO.md
index 045b4cc..bdb860c 100644
--- a/TODO.md
+++ b/TODO.md
@@ -14,6 +14,8 @@ Important: deleting a follower should do more that just delete the object, see h
14 14
15## Wishlist 15## Wishlist
16 16
17Each notification should show a link to the full thread, to see it in context.
18
17The instance timeline should also show boosts from users. 19The instance timeline should also show boosts from users.
18 20
19Mastoapi: implement /v1/conversations. 21Mastoapi: implement /v1/conversations.
diff --git a/data.c b/data.c
index 50c6121..2f1a52b 100644
--- a/data.c
+++ b/data.c
@@ -2766,7 +2766,17 @@ xs_list *content_search(snac *user, const char *regex,
2766 for (int n = 0; n < 3; n++) { 2766 for (int n = 0; n < 3; n++) {
2767 if (md5s[n] != NULL) { 2767 if (md5s[n] != NULL) {
2768 xs *fn = _object_fn_by_md5(md5s[n], "content_search"); 2768 xs *fn = _object_fn_by_md5(md5s[n], "content_search");
2769 double mt = mtime(fn); 2769 double mt;
2770
2771 while ((mt = mtime(fn)) == 0 && md5s[n] != NULL) {
2772 /* object is not here: move to the next one */
2773 if (xs_list_next(tls[n], &md5s[n], &c[n])) {
2774 xs_free(fn);
2775 fn = _object_fn_by_md5(md5s[n], "content_search_2");
2776 }
2777 else
2778 md5s[n] = NULL;
2779 }
2770 2780
2771 if (mt > mtime) { 2781 if (mt > mtime) {
2772 newest = n; 2782 newest = n;
diff --git a/format.c b/format.c
index e5934b8..4c8ed29 100644
--- a/format.c
+++ b/format.c
@@ -78,6 +78,8 @@ xs_dict *emojis(void)
78 return d; 78 return d;
79} 79}
80 80
81/* Non-whitespace without trailing comma, period or closing paren */
82#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+"
81 83
82static xs_str *format_line(const char *line, xs_list **attach) 84static xs_str *format_line(const char *line, xs_list **attach)
83/* formats a line */ 85/* formats a line */
@@ -96,8 +98,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
96 "__[^_]+__" "|" //anzu 98 "__[^_]+__" "|" //anzu
97 "!\\[[^]]+\\]\\([^\\)]+\\)" "|" 99 "!\\[[^]]+\\]\\([^\\)]+\\)" "|"
98 "\\[[^]]+\\]\\([^\\)]+\\)" "|" 100 "\\[[^]]+\\]\\([^\\)]+\\)" "|"
99 "[a-z]+:/" "/[^[:space:]]+" "|" 101 "[a-z]+:/" "/" NOSPACE "|"
100 "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+" 102 "(mailto|xmpp):[^@[:space:]]+@" NOSPACE
101 ")"); 103 ")");
102 int n = 0; 104 int n = 0;
103 105
diff --git a/html.c b/html.c
index 54920fb..5f1cd6c 100644
--- a/html.c
+++ b/html.c
@@ -3139,11 +3139,16 @@ xs_str *html_notifications(snac *user, int skip, int show)
3139 else 3139 else
3140 if (obj != NULL) { 3140 if (obj != NULL) {
3141 xs *md5 = xs_md5_hex(id, strlen(id)); 3141 xs *md5 = xs_md5_hex(id, strlen(id));
3142 xs *ctxt = xs_fmt("%s/admin/p/%s#%s_entry", user->actor, md5, md5);
3142 3143
3143 xs_html *h = html_entry(user, obj, 0, 0, md5, 1); 3144 xs_html *h = html_entry(user, obj, 0, 0, md5, 1);
3144 3145
3145 if (h != NULL) { 3146 if (h != NULL) {
3146 xs_html_add(entry, 3147 xs_html_add(entry,
3148 xs_html_tag("p",
3149 xs_html_tag("a",
3150 xs_html_attr("href", ctxt),
3151 xs_html_text(L("Context")))),
3147 h); 3152 h);
3148 } 3153 }
3149 } 3154 }
@@ -3550,7 +3555,8 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3550 const char *md5 = xs_list_get(l, -1); 3555 const char *md5 = xs_list_get(l, -1);
3551 3556
3552 if (md5 && *md5 && timeline_here(&snac, md5)) { 3557 if (md5 && *md5 && timeline_here(&snac, md5)) {
3553 xs *list = xs_list_append(xs_list_new(), md5); 3558 xs *list0 = xs_list_append(xs_list_new(), md5);
3559 xs *list = timeline_top_level(&snac, list0);
3554 3560
3555 *body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1, error); 3561 *body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1, error);
3556 *b_size = strlen(*body); 3562 *b_size = strlen(*body);
diff --git a/main.c b/main.c
index 347c495..58a46de 100644
--- a/main.c
+++ b/main.c
@@ -676,19 +676,25 @@ int main(int argc, char *argv[])
676 676
677 if (strcmp(url, "-e") == 0) { 677 if (strcmp(url, "-e") == 0) {
678 /* get the content from an editor */ 678 /* get the content from an editor */
679#define EDITOR "$EDITOR "
680 char cmd[] = EDITOR "/tmp/snac-XXXXXX";
679 FILE *f; 681 FILE *f;
680 682 int fd = mkstemp(cmd + strlen(EDITOR));
681 unlink("/tmp/snac-edit.txt"); 683
682 system("$EDITOR /tmp/snac-edit.txt"); 684 if (fd >= 0) {
683 685 int status = system(cmd);
684 if ((f = fopen("/tmp/snac-edit.txt", "r")) != NULL) { 686
685 content = xs_readall(f); 687 if (WIFEXITED(status) && WEXITSTATUS(status) == 0 && (f = fdopen(fd, "r")) != NULL) {
686 fclose(f); 688 content = xs_readall(f);
687 689 fclose(f);
688 unlink("/tmp/snac-edit.txt"); 690 unlink(cmd + strlen(EDITOR));
689 } 691 } else {
690 else { 692 printf("Nothing to send\n");
691 printf("Nothing to send\n"); 693 close(fd);
694 return 1;
695 }
696 } else {
697 fprintf(stderr, "Temp file creation failed\n");
692 return 1; 698 return 1;
693 } 699 }
694 } 700 }
@@ -700,6 +706,11 @@ int main(int argc, char *argv[])
700 else 706 else
701 content = xs_dup(url); 707 content = xs_dup(url);
702 708
709 if (!content || !*content) {
710 printf("Nothing to send\n");
711 return 1;
712 }
713
703 int scope = 0; 714 int scope = 0;
704 if (strcmp(cmd, "note_mention") == 0) 715 if (strcmp(cmd, "note_mention") == 0)
705 scope = 1; 716 scope = 1;