Changeset b8b931d for protocols/twitter/twitter_lib.c
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.