Compare commits
3 Commits
48e96efb86
...
607f9887ca
Author | SHA1 | Date |
---|---|---|
Artem Savkov | 607f9887ca | |
Artem Savkov | eb768b4a81 | |
Artem Savkov | 068ed17a75 |
|
@ -601,6 +601,7 @@ static gboolean discord_prepare_message(struct im_connection *ic,
|
|||
gboolean posted = FALSE;
|
||||
gchar *msg = json_o_strdup(minfo, "content");
|
||||
json_value *jpinned = json_o_get(minfo, "pinned");
|
||||
json_value *ref = json_o_get(minfo, "referenced_message");
|
||||
gboolean pinned = (jpinned != NULL && jpinned->type == json_boolean) ?
|
||||
jpinned->u.boolean : FALSE;
|
||||
|
||||
|
@ -618,6 +619,16 @@ static gboolean discord_prepare_message(struct im_connection *ic,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (ref != NULL && ref->type == json_object) {
|
||||
gchar *rauthor = discord_canonize_name(json_o_str(json_o_get(ref,
|
||||
"author"), "username"));
|
||||
gchar *rmsg = g_strdup_printf("IN_REPLY_TO: %s> %.50s...", rauthor,
|
||||
json_o_str(ref, "content"));
|
||||
posted = discord_post_message(cinfo, author, rmsg, is_self, tstamp);
|
||||
g_free(rmsg);
|
||||
g_free(rauthor);
|
||||
}
|
||||
|
||||
if (pinned == TRUE) {
|
||||
gchar *newmsg = g_strconcat("PINNED: ", msg, NULL);
|
||||
g_free(msg);
|
||||
|
|
|
@ -175,6 +175,9 @@ static void discord_http_gateway_cb(struct http_request *req)
|
|||
|
||||
if (dd->gateway->path == NULL) {
|
||||
dd->gateway->path = g_strdup("/?encoding=json&v=6");
|
||||
} else if (g_strcmp0(dd->gateway->path, "") == 0) {
|
||||
g_free(dd->gateway->path);
|
||||
dd->gateway->path = g_strdup("/?encoding=json&v=6");
|
||||
}
|
||||
|
||||
g_match_info_free(match);
|
||||
|
|
|
@ -360,6 +360,8 @@ static gboolean discord_ws_connected_cb(gpointer data, int retcode,
|
|||
|
||||
g_free(bkey);
|
||||
|
||||
discord_debug(">>> (%s) %s %"G_GSIZE_FORMAT"\n%s\n", dd->uname, __func__, req->len, req->str);
|
||||
|
||||
dd->sslfd = ssl_getfd(source);
|
||||
dd->inpa = b_input_add(dd->sslfd, B_EV_IO_READ, discord_ws_in_cb, ic);
|
||||
ssl_write(dd->ssl, req->str, req->len);
|
||||
|
|
Loading…
Reference in New Issue