- Timestamp:
- 2020-05-07T19:33:52Z (5 years ago)
- Branches:
- master
- Children:
- b17fa67, f18209a
- Parents:
- 3da21ce
- git-author:
- Iguana <kathy@…> (07-05-20 19:33:52)
- git-committer:
- GitHub <noreply@…> (07-05-20 19:33:52)
- Location:
- protocols/twitter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r3da21ce rb8b931d 918 918 gboolean allow_post = 919 919 g_strcasecmp(set_getstr(&ic->acc->set, "commands"), "strict") != 0; 920 gboolean auto_populate_reply_metadata = FALSE; 920 921 bee_user_t *bu = NULL; 921 922 … … 996 997 in_reply_to = id; 997 998 allow_post = TRUE; 999 } else if (g_strcasecmp(cmd[0], "greply") == 0 && cmd[1] && cmd[2]) { 1000 id = twitter_message_id_from_command_arg(ic, cmd[1], &bu); 1001 if (!id || !bu) { 1002 twitter_log(ic, "User `%s' does not exist or didn't " 1003 "post any statuses recently", cmd[1]); 1004 goto eof; 1005 } 1006 message = new = g_strdup_printf("%s", cmd[2]); 1007 in_reply_to = id; 1008 auto_populate_reply_metadata = TRUE; 1009 allow_post = TRUE; 998 1010 } else if (g_strcasecmp(cmd[0], "rawreply") == 0 && cmd[1] && cmd[2]) { 999 1011 id = twitter_message_id_from_command_arg(ic, cmd[1], NULL); … … 1047 1059 this would delete the second-last Tweet. Prevent that. */ 1048 1060 td->last_status_id = 0; 1049 twitter_post_status(ic, message, in_reply_to );1061 twitter_post_status(ic, message, in_reply_to, auto_populate_reply_metadata); 1050 1062 } else { 1051 1063 twitter_log(ic, "Unknown command: %s", cmd[0]); -
protocols/twitter/twitter_lib.c
r3da21ce rb8b931d 1696 1696 * Function to POST a new status to twitter. 1697 1697 */ 1698 void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to) 1699 { 1700 char *args[4] = { 1701 "status", msg, 1702 "in_reply_to_status_id", 1703 g_strdup_printf("%" G_GUINT64_FORMAT, in_reply_to) 1704 }; 1705 1706 if (set_getbool(&ic->acc->set, "in_korea") && !in_reply_to) { 1707 g_free(args[3]); 1708 args[2] = "place_id"; 1709 args[3] = g_strdup("c999e6a453e9ef72"); 1698 void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to, gboolean auto_populate_reply_metadata) 1699 { 1700 size_t args_len = 0; 1701 char * in_reply_to_str = NULL; 1702 char * place_id_str = NULL; 1703 gboolean in_korea = (set_getbool(&ic->acc->set, "in_korea") && !in_reply_to); 1704 1705 args_len = 2; /* "status", msg */ 1706 if (in_reply_to) { 1707 args_len += 2; 1708 } 1709 if (auto_populate_reply_metadata) { 1710 args_len += 2; 1711 } 1712 if (in_korea) { 1713 args_len += 2; 1714 } 1715 1716 char **args = g_new0(char *, args_len); 1717 args_len = 0; 1718 args[args_len++] = "status"; 1719 args[args_len++] = msg; 1720 if (in_reply_to) { 1721 in_reply_to_str = g_strdup_printf("%" G_GUINT64_FORMAT, in_reply_to); 1722 args[args_len++] = "in_reply_to_status_id"; 1723 args[args_len++] = in_reply_to_str; 1724 } 1725 if (auto_populate_reply_metadata) { 1726 args[args_len++] = "auto_populate_reply_metadata"; 1727 args[args_len++] = "true"; 1728 } 1729 if (in_korea) { 1730 place_id_str = g_strdup("c999e6a453e9ef72"); 1731 args[args_len++] = "place_id"; 1732 args[args_len++] = place_id_str; 1710 1733 in_reply_to = 1; 1711 1734 } 1712 1735 1713 1736 twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, 1714 args, in_reply_to ? 4 : 2); 1715 g_free(args[3]); 1737 args, args_len); 1738 if (in_reply_to_str) { 1739 g_free(in_reply_to_str); 1740 } 1741 if (place_id_str) { 1742 g_free(place_id_str); 1743 } 1744 g_free(args); 1716 1745 } 1717 1746 -
protocols/twitter/twitter_lib.h
r3da21ce rb8b931d 96 96 void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor); 97 97 98 void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to );98 void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to, gboolean auto_populate_reply_metadata); 99 99 void twitter_direct_messages_new(struct im_connection *ic, char *who, char *message); 100 100 void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create);
Note: See TracChangeset
for help on using the changeset viewer.