Changeset 0ca1d79
- Timestamp:
- 2015-02-20T22:47:33Z (10 years ago)
- Branches:
- master
- Children:
- af359b4
- Parents:
- 34afea7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user-guide/commands.xml
r34afea7 r0ca1d79 1091 1091 </bitlbee-setting> 1092 1092 1093 <bitlbee-setting name="format_string" type="string" scope="account">1094 <default>^B[^B%i^B]^B %c</default>1095 1096 <description>1097 <para>1098 This setting controls how tweets are displayed. Below are listed the two replacement attributes you may use in the string. If you wish to use a percent symbol in your string, ensure you escape it with a second percent symbol (i.e. "%%").1099 </para>1100 1101 <para>1102 The default setting contains ^B as a control code for toggling of the bold property. Other similar properties (including color codes) are also functional in this setting. See the documentation for your IRC client for details on such control codes.1103 </para>1104 1105 <variablelist>1106 <varlistentry><term>%i</term><listitem><para>The ID of the tweet</para></listitem></varlistentry>1107 <varlistentry><term>%c</term><listitem><para>The text of the tweet</para></listitem></varlistentry>1108 </variablelist>1109 </description>1110 1111 </bitlbee-setting>1112 1113 <bitlbee-setting name="reply_format_string" type="string" scope="account">1114 <default>^B[^B%i->%t^B]^B %c</default>1115 1116 <description>1117 <para>1118 This setting controls how replies to tweets are displayed. Below are listed the three replacement attributes you may use in the string. If you wish to use a percent symbol in your string, ensure you escape it with a second percent symbol (i.e. "%%").1119 </para>1120 1121 <para>1122 The default setting contains ^B as a control code for toggling of the bold property. Other similar properties (including color codes) are also functional in this setting. See the documentation for your IRC client for details on such control codes.1123 </para>1124 1125 <variablelist>1126 <varlistentry><term>%i</term><listitem><para>The ID of this tweet</para></listitem></varlistentry>1127 <varlistentry><term>%r</term><listitem><para>The ID of the tweet being replied to</para></listitem></varlistentry>1128 <varlistentry><term>%c</term><listitem><para>The text of the tweet</para></listitem></varlistentry>1129 </variablelist>1130 </description>1131 1132 </bitlbee-setting>1133 1134 <bitlbee-setting name="retweet_format_string" type="string" scope="account">1135 <default>^B[^B%i^B]^B RT @%a: %c</default>1136 1137 <description>1138 <para>1139 This setting controls how retweets are displayed. Below are listed the three replacement attributes you may use in the string. If you wish to use a percent symbol in your string, ensure you escape it with a second percent symbol (i.e. "%%").1140 </para>1141 1142 <para>1143 The default setting contains ^B as a control code for toggling of the bold property. Other similar properties (including color codes) are also functional in this setting. See the documentation for your IRC client for details on such control codes.1144 </para>1145 1146 <variablelist>1147 <varlistentry><term>%i</term><listitem><para>The ID of the tweet</para></listitem></varlistentry>1148 <varlistentry><term>%a</term><listitem><para>The author of the original tweet</para></listitem></varlistentry>1149 <varlistentry><term>%c</term><listitem><para>The text of the tweet</para></listitem></varlistentry>1150 </variablelist>1151 </description>1152 1153 </bitlbee-setting>1154 1155 1093 <bitlbee-setting name="mobile_is_away" type="boolean" scope="global"> 1156 1094 <default>false</default> -
protocols/twitter/twitter.c
r34afea7 r0ca1d79 539 539 540 540 s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc); 541 542 s = set_add(&acc->set, "format_string", "\002[\002%i\002]\002 %c", NULL, acc);543 s = set_add(&acc->set, "retweet_format_string", "\002[\002%i\002]\002 RT @%a: %c", NULL, acc);544 s = set_add(&acc->set, "reply_format_string", "\002[\002%i->%r\002]\002 %c", NULL, acc);545 541 546 542 s = set_add(&acc->set, "_last_tweet", "0", NULL, acc); -
protocols/twitter/twitter_lib.c
r34afea7 r0ca1d79 63 63 guint64 reply_to; 64 64 gboolean from_filter; 65 struct twitter_xml_status *rt;66 65 }; 67 66 … … 89 88 g_free(txs->text); 90 89 txu_free(txs->user); 91 txs_free(txs->rt);92 90 g_free(txs); 93 91 } … … 491 489 if (rtxs) { 492 490 g_free(txs->text); 493 txs->text = g_strdup (rtxs->text);491 txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text); 494 492 txs->id = rtxs->id; 495 txs ->rt = rtxs;493 txs_free(rtxs); 496 494 } 497 495 } else if (entities) { … … 611 609 } 612 610 613 /**614 * Function to properly format a tweet as per the users configuration.615 */616 static char *twitter_msg_get_text(struct im_connection *ic, int log_id, int reply_to,617 struct twitter_xml_status *txs, const char *prefix) {618 gchar * format = set_getstr(&ic->acc->set, "format_string");619 GString * text = g_string_new(NULL);620 621 gchar *c;622 if (reply_to != -1)623 format = set_getstr(&ic->acc->set, "reply_format_string");624 if (txs->rt)625 format = set_getstr(&ic->acc->set, "retweet_format_string");626 627 for (c = format; *c ; c++) {628 if (!(*c == '%' && *(c+1))) {629 text = g_string_append_c(text, *c);630 continue;631 }632 c++; // Move past the %633 switch (*c) {634 case 'i':635 g_string_append_printf(text, "%02x", log_id);636 break;637 case 'r':638 if (reply_to != -1) // In case someone does put %r in the wrong format_string639 g_string_append_printf(text, "%02x", reply_to);640 break;641 case 'a':642 if (txs->rt) // In case someone does put %a in the wrong format_string643 text = g_string_append(text, txs->rt->user->screen_name);644 break;645 case 'c':646 text = g_string_append(text, txs->text);647 break;648 default:649 text = g_string_append_c(text, *c);650 }651 }652 text = g_string_prepend(text, prefix);653 return g_string_free(text, FALSE);654 }655 656 611 /* Will log messages either way. Need to keep track of IDs for stream deduping. 657 612 Plus, show_ids is on by default and I don't see why anyone would disable it. */ … … 692 647 td->log[td->log_id].id = txs->rt_id; 693 648 694 return twitter_msg_get_text(ic, td->log_id, reply_to, txs, prefix); 649 if (set_getbool(&ic->acc->set, "show_ids")) { 650 if (reply_to != -1) 651 return g_strdup_printf("\002[\002%02x->%02x\002]\002 %s%s", 652 td->log_id, reply_to, prefix, txs->text); 653 else 654 return g_strdup_printf("\002[\002%02x\002]\002 %s%s", 655 td->log_id, prefix, txs->text); 656 } else { 657 if (*prefix) 658 return g_strconcat(prefix, txs->text, NULL); 659 else 660 return NULL; 661 } 695 662 } 696 663
Note: See TracChangeset
for help on using the changeset viewer.