Changeset 3592b95
- Timestamp:
- 2012-11-25T20:21:24Z (12 years ago)
- Branches:
- master
- Children:
- f97b8e9
- Parents:
- 9ed0081
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user-guide/commands.xml
r9ed0081 r3592b95 835 835 <bitlbee-setting name="commands" type="boolean" scope="account"> 836 836 <default>true</default> 837 <possible-values>true, false, strict</possible-values> 837 838 838 839 <description> … … 853 854 854 855 <para> 855 Anything that doesn't look like a command will be treated as a tweet. Watch out for typos ! :-)856 Anything that doesn't look like a command will be treated as a tweet. Watch out for typos, or to avoid this behaviour, you can set this setting to <emphasis>strict</emphasis>, which causes the <emphasis>post</emphasis> command to become mandatory for posting a tweet. 856 857 </para> 857 858 </description> -
protocols/twitter/twitter.c
r9ed0081 r3592b95 219 219 } 220 220 221 222 static char *set_eval_mode(set_t * set, char *value)223 {224 if (g_strcasecmp(value, "one") == 0 ||225 g_strcasecmp(value, "many") == 0 || g_strcasecmp(value, "chat") == 0)226 return value;227 else228 return NULL;229 }230 231 221 int twitter_url_len_diff(gchar *msg, unsigned int target_len) 232 222 { … … 270 260 } 271 261 262 static char *set_eval_commands(set_t * set, char *value) 263 { 264 if (g_strcasecmp(value, "strict") == 0 ) 265 return value; 266 else 267 return set_eval_bool(set, value); 268 } 269 270 static char *set_eval_mode(set_t * set, char *value) 271 { 272 if (g_strcasecmp(value, "one") == 0 || 273 g_strcasecmp(value, "many") == 0 || g_strcasecmp(value, "chat") == 0) 274 return value; 275 else 276 return NULL; 277 } 278 272 279 static void twitter_init(account_t * acc) 273 280 { … … 289 296 s->flags |= ACC_SET_OFFLINE_ONLY; 290 297 291 s = set_add(&acc->set, "commands", "true", set_eval_ bool, acc);298 s = set_add(&acc->set, "commands", "true", set_eval_commands, acc); 292 299 293 300 s = set_add(&acc->set, "fetch_interval", "60", set_eval_int, acc); … … 569 576 char *cmds, **cmd, *new = NULL; 570 577 guint64 in_reply_to = 0; 578 gboolean strict_commands = 579 g_strcasecmp(set_getstr(&ic->acc->set, "commands"), "strict") == 0; 571 580 572 581 cmds = g_strdup(message); … … 576 585 g_free(cmds); 577 586 return; 578 } else if (! set_getbool(&ic->acc->set, "commands")) {587 } else if (!(strict_commands || set_getbool(&ic->acc->set, "commands"))) { 579 588 /* Not supporting commands. */ 580 589 } else if (g_strcasecmp(cmd[0], "undo") == 0) { … … 675 684 } else if (g_strcasecmp(cmd[0], "post") == 0) { 676 685 message += 5; 677 } 678 679 { 686 strict_commands = FALSE; 687 } 688 689 if (strict_commands) { 690 twitter_log(ic, "Unknown command: %s", cmd[0]); 691 } else { 680 692 char *s; 681 693 bee_user_t *bu;
Note: See TracChangeset
for help on using the changeset viewer.