111 |
/* WeeChat internal commands */ |
/* WeeChat internal commands */ |
112 |
|
|
113 |
/* no completion for some commands */ |
/* no completion for some commands */ |
114 |
if ((strcasecmp (completion->base_command, "server") == 0) |
if ((ascii_strcasecmp (completion->base_command, "server") == 0) |
115 |
|| (strcasecmp (completion->base_command, "save") == 0)) |
|| (ascii_strcasecmp (completion->base_command, "save") == 0)) |
116 |
{ |
{ |
117 |
completion_stop (completion); |
completion_stop (completion); |
118 |
return; |
return; |
119 |
} |
} |
120 |
if ((strcasecmp (completion->base_command, "alias") == 0) |
if ((ascii_strcasecmp (completion->base_command, "alias") == 0) |
121 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
122 |
{ |
{ |
123 |
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist) |
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist) |
128 |
} |
} |
129 |
return; |
return; |
130 |
} |
} |
131 |
if ((strcasecmp (completion->base_command, "buffer") == 0) |
if ((ascii_strcasecmp (completion->base_command, "buffer") == 0) |
132 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
133 |
{ |
{ |
134 |
weelist_add (&completion->completion_list, |
weelist_add (&completion->completion_list, |
145 |
"notify"); |
"notify"); |
146 |
return; |
return; |
147 |
} |
} |
148 |
if ((strcasecmp (completion->base_command, "clear") == 0) |
if ((ascii_strcasecmp (completion->base_command, "clear") == 0) |
149 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
150 |
{ |
{ |
151 |
weelist_add (&completion->completion_list, |
weelist_add (&completion->completion_list, |
153 |
"-all"); |
"-all"); |
154 |
return; |
return; |
155 |
} |
} |
156 |
if ((strcasecmp (completion->base_command, "connect") == 0) |
if ((ascii_strcasecmp (completion->base_command, "connect") == 0) |
157 |
|| (strcasecmp (completion->base_command, "disconnect") == 0)) |
|| (ascii_strcasecmp (completion->base_command, "disconnect") == 0)) |
158 |
{ |
{ |
159 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
160 |
{ |
{ |
173 |
return; |
return; |
174 |
} |
} |
175 |
} |
} |
176 |
if (strcasecmp (completion->base_command, "debug") == 0) |
if (ascii_strcasecmp (completion->base_command, "debug") == 0) |
177 |
{ |
{ |
178 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
179 |
weelist_add (&completion->completion_list, |
weelist_add (&completion->completion_list, |
183 |
completion_stop (completion); |
completion_stop (completion); |
184 |
return; |
return; |
185 |
} |
} |
186 |
if ((strcasecmp (completion->base_command, "help") == 0) |
if ((ascii_strcasecmp (completion->base_command, "help") == 0) |
187 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
188 |
{ |
{ |
189 |
for (i = 0; weechat_commands[i].command_name; i++) |
for (i = 0; weechat_commands[i].command_name; i++) |
201 |
} |
} |
202 |
return; |
return; |
203 |
} |
} |
204 |
if (strcasecmp (completion->base_command, "key") == 0) |
if (ascii_strcasecmp (completion->base_command, "key") == 0) |
205 |
{ |
{ |
206 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
207 |
{ |
{ |
229 |
return; |
return; |
230 |
} |
} |
231 |
} |
} |
232 |
if (((strcasecmp (completion->base_command, "perl") == 0) |
if (((ascii_strcasecmp (completion->base_command, "perl") == 0) |
233 |
|| (strcasecmp (completion->base_command, "python") == 0)) |
|| (ascii_strcasecmp (completion->base_command, "python") == 0)) |
234 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
235 |
{ |
{ |
236 |
weelist_add (&completion->completion_list, |
weelist_add (&completion->completion_list, |
247 |
"unload"); |
"unload"); |
248 |
return; |
return; |
249 |
} |
} |
250 |
if (strcasecmp (completion->base_command, "set") == 0) |
if (ascii_strcasecmp (completion->base_command, "set") == 0) |
251 |
{ |
{ |
252 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
253 |
{ |
{ |
340 |
completion_stop (completion); |
completion_stop (completion); |
341 |
return; |
return; |
342 |
} |
} |
343 |
if ((strcasecmp (completion->base_command, "unalias") == 0) |
if ((ascii_strcasecmp (completion->base_command, "unalias") == 0) |
344 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
345 |
{ |
{ |
346 |
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) |
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) |
351 |
} |
} |
352 |
return; |
return; |
353 |
} |
} |
354 |
if (strcasecmp (completion->base_command, "window") == 0) |
if (ascii_strcasecmp (completion->base_command, "window") == 0) |
355 |
{ |
{ |
356 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
357 |
{ |
{ |
397 |
/* IRC commands */ |
/* IRC commands */ |
398 |
|
|
399 |
/* no completion for some commands */ |
/* no completion for some commands */ |
400 |
if ((strcasecmp (completion->base_command, "admin") == 0) |
if ((ascii_strcasecmp (completion->base_command, "admin") == 0) |
401 |
|| (strcasecmp (completion->base_command, "die") == 0) |
|| (ascii_strcasecmp (completion->base_command, "die") == 0) |
402 |
|| (strcasecmp (completion->base_command, "info") == 0) |
|| (ascii_strcasecmp (completion->base_command, "info") == 0) |
403 |
|| (strcasecmp (completion->base_command, "join") == 0) |
|| (ascii_strcasecmp (completion->base_command, "join") == 0) |
404 |
|| (strcasecmp (completion->base_command, "links") == 0) |
|| (ascii_strcasecmp (completion->base_command, "links") == 0) |
405 |
|| (strcasecmp (completion->base_command, "list") == 0) |
|| (ascii_strcasecmp (completion->base_command, "list") == 0) |
406 |
|| (strcasecmp (completion->base_command, "lusers") == 0) |
|| (ascii_strcasecmp (completion->base_command, "lusers") == 0) |
407 |
|| (strcasecmp (completion->base_command, "motd") == 0) |
|| (ascii_strcasecmp (completion->base_command, "motd") == 0) |
408 |
|| (strcasecmp (completion->base_command, "oper") == 0) |
|| (ascii_strcasecmp (completion->base_command, "oper") == 0) |
409 |
|| (strcasecmp (completion->base_command, "rehash") == 0) |
|| (ascii_strcasecmp (completion->base_command, "rehash") == 0) |
410 |
|| (strcasecmp (completion->base_command, "restart") == 0) |
|| (ascii_strcasecmp (completion->base_command, "restart") == 0) |
411 |
|| (strcasecmp (completion->base_command, "service") == 0) |
|| (ascii_strcasecmp (completion->base_command, "service") == 0) |
412 |
|| (strcasecmp (completion->base_command, "servlist") == 0) |
|| (ascii_strcasecmp (completion->base_command, "servlist") == 0) |
413 |
|| (strcasecmp (completion->base_command, "squery") == 0) |
|| (ascii_strcasecmp (completion->base_command, "squery") == 0) |
414 |
|| (strcasecmp (completion->base_command, "squit") == 0) |
|| (ascii_strcasecmp (completion->base_command, "squit") == 0) |
415 |
|| (strcasecmp (completion->base_command, "stats") == 0) |
|| (ascii_strcasecmp (completion->base_command, "stats") == 0) |
416 |
|| (strcasecmp (completion->base_command, "summon") == 0) |
|| (ascii_strcasecmp (completion->base_command, "summon") == 0) |
417 |
|| (strcasecmp (completion->base_command, "time") == 0) |
|| (ascii_strcasecmp (completion->base_command, "time") == 0) |
418 |
|| (strcasecmp (completion->base_command, "trace") == 0) |
|| (ascii_strcasecmp (completion->base_command, "trace") == 0) |
419 |
|| (strcasecmp (completion->base_command, "users") == 0) |
|| (ascii_strcasecmp (completion->base_command, "users") == 0) |
420 |
|| (strcasecmp (completion->base_command, "wallops") == 0) |
|| (ascii_strcasecmp (completion->base_command, "wallops") == 0) |
421 |
|| (strcasecmp (completion->base_command, "who") == 0)) |
|| (ascii_strcasecmp (completion->base_command, "who") == 0)) |
422 |
{ |
{ |
423 |
completion_stop (completion); |
completion_stop (completion); |
424 |
return; |
return; |
425 |
} |
} |
426 |
if ((strcasecmp (completion->base_command, "away") == 0) |
if ((ascii_strcasecmp (completion->base_command, "away") == 0) |
427 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
428 |
{ |
{ |
429 |
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) |
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) |
432 |
cfg_irc_default_msg_away); |
cfg_irc_default_msg_away); |
433 |
return; |
return; |
434 |
} |
} |
435 |
if ((strcasecmp (completion->base_command, "ctcp") == 0) |
if ((ascii_strcasecmp (completion->base_command, "ctcp") == 0) |
436 |
&& (completion->base_command_arg == 2)) |
&& (completion->base_command_arg == 2)) |
437 |
{ |
{ |
438 |
weelist_add (&completion->completion_list, |
weelist_add (&completion->completion_list, |
446 |
"version"); |
"version"); |
447 |
return; |
return; |
448 |
} |
} |
449 |
if ((strcasecmp (completion->base_command, "dcc") == 0) |
if ((ascii_strcasecmp (completion->base_command, "dcc") == 0) |
450 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
451 |
{ |
{ |
452 |
weelist_add (&completion->completion_list, |
weelist_add (&completion->completion_list, |
460 |
"close"); |
"close"); |
461 |
return; |
return; |
462 |
} |
} |
463 |
if (strcasecmp (completion->base_command, "invite") == 0) |
if (ascii_strcasecmp (completion->base_command, "invite") == 0) |
464 |
{ |
{ |
465 |
/* arg1: nickname */ |
/* arg1: nickname */ |
466 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
486 |
} |
} |
487 |
return; |
return; |
488 |
} |
} |
489 |
if (strcasecmp (completion->base_command, "kick") == 0) |
if (ascii_strcasecmp (completion->base_command, "kick") == 0) |
490 |
{ |
{ |
491 |
if (completion->base_command_arg != 1) |
if (completion->base_command_arg != 1) |
492 |
completion_stop (completion); |
completion_stop (completion); |
493 |
return; |
return; |
494 |
} |
} |
495 |
if (strcasecmp (completion->base_command, "kill") == 0) |
if (ascii_strcasecmp (completion->base_command, "kill") == 0) |
496 |
{ |
{ |
497 |
if (completion->base_command_arg != 1) |
if (completion->base_command_arg != 1) |
498 |
completion_stop (completion); |
completion_stop (completion); |
499 |
return; |
return; |
500 |
} |
} |
501 |
if (strcasecmp (completion->base_command, "me") == 0) |
if (ascii_strcasecmp (completion->base_command, "me") == 0) |
502 |
{ |
{ |
503 |
completion->context = COMPLETION_NICK; |
completion->context = COMPLETION_NICK; |
504 |
return; |
return; |
505 |
} |
} |
506 |
if (strcasecmp (completion->base_command, "notice") == 0) |
if (ascii_strcasecmp (completion->base_command, "notice") == 0) |
507 |
{ |
{ |
508 |
if (completion->base_command_arg != 1) |
if (completion->base_command_arg != 1) |
509 |
completion_stop (completion); |
completion_stop (completion); |
510 |
return; |
return; |
511 |
} |
} |
512 |
if ((strcasecmp (completion->base_command, "part") == 0) |
if ((ascii_strcasecmp (completion->base_command, "part") == 0) |
513 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
514 |
{ |
{ |
515 |
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) |
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) |
518 |
cfg_irc_default_msg_part); |
cfg_irc_default_msg_part); |
519 |
return; |
return; |
520 |
} |
} |
521 |
if (strcasecmp (completion->base_command, "query") == 0) |
if (ascii_strcasecmp (completion->base_command, "query") == 0) |
522 |
{ |
{ |
523 |
if (completion->base_command_arg != 1) |
if (completion->base_command_arg != 1) |
524 |
completion_stop (completion); |
completion_stop (completion); |
525 |
return; |
return; |
526 |
} |
} |
527 |
if ((strcasecmp (completion->base_command, "quit") == 0) |
if ((ascii_strcasecmp (completion->base_command, "quit") == 0) |
528 |
&& (completion->base_command_arg == 1)) |
&& (completion->base_command_arg == 1)) |
529 |
{ |
{ |
530 |
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) |
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) |
533 |
cfg_irc_default_msg_quit); |
cfg_irc_default_msg_quit); |
534 |
return; |
return; |
535 |
} |
} |
536 |
if (strcasecmp (completion->base_command, "topic") == 0) |
if (ascii_strcasecmp (completion->base_command, "topic") == 0) |
537 |
{ |
{ |
538 |
if (completion->base_command_arg == 1) |
if (completion->base_command_arg == 1) |
539 |
{ |
{ |
717 |
other_completion = 0; |
other_completion = 0; |
718 |
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) |
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) |
719 |
{ |
{ |
720 |
if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) |
if (ascii_strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) |
721 |
{ |
{ |
722 |
if ((!completion->word_found) || word_found_seen) |
if ((!completion->word_found) || word_found_seen) |
723 |
{ |
{ |
725 |
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; |
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; |
726 |
ptr_weelist2 = ptr_weelist2->next_weelist) |
ptr_weelist2 = ptr_weelist2->next_weelist) |
727 |
{ |
{ |
728 |
if (strncasecmp (ptr_weelist2->data, |
if (ascii_strncasecmp (ptr_weelist2->data, |
729 |
completion->base_word + 1, length) == 0) |
completion->base_word + 1, length) == 0) |
730 |
other_completion++; |
other_completion++; |
731 |
} |
} |
739 |
other_completion++; |
other_completion++; |
740 |
} |
} |
741 |
if (completion->word_found && |
if (completion->word_found && |
742 |
(strcasecmp (ptr_weelist->data, completion->word_found) == 0)) |
(ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) |
743 |
word_found_seen = 1; |
word_found_seen = 1; |
744 |
} |
} |
745 |
if (completion->word_found) |
if (completion->word_found) |
765 |
for (ptr_weelist = completion->completion_list; ptr_weelist; |
for (ptr_weelist = completion->completion_list; ptr_weelist; |
766 |
ptr_weelist = ptr_weelist->next_weelist) |
ptr_weelist = ptr_weelist->next_weelist) |
767 |
{ |
{ |
768 |
if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) |
if (ascii_strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) |
769 |
{ |
{ |
770 |
if ((!completion->word_found) || word_found_seen) |
if ((!completion->word_found) || word_found_seen) |
771 |
{ |
{ |
773 |
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; |
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; |
774 |
ptr_weelist2 = ptr_weelist2->next_weelist) |
ptr_weelist2 = ptr_weelist2->next_weelist) |
775 |
{ |
{ |
776 |
if (strncasecmp (ptr_weelist2->data, |
if (ascii_strncasecmp (ptr_weelist2->data, |
777 |
completion->base_word, length) == 0) |
completion->base_word, length) == 0) |
778 |
other_completion++; |
other_completion++; |
779 |
} |
} |
787 |
other_completion++; |
other_completion++; |
788 |
} |
} |
789 |
if (completion->word_found && |
if (completion->word_found && |
790 |
(strcasecmp (ptr_weelist->data, completion->word_found) == 0)) |
(ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) |
791 |
word_found_seen = 1; |
word_found_seen = 1; |
792 |
} |
} |
793 |
if (completion->word_found) |
if (completion->word_found) |
821 |
other_completion = 0; |
other_completion = 0; |
822 |
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) |
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) |
823 |
{ |
{ |
824 |
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) |
if (ascii_strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) |
825 |
{ |
{ |
826 |
if ((!completion->word_found) || word_found_seen) |
if ((!completion->word_found) || word_found_seen) |
827 |
{ |
{ |
829 |
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2; |
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2; |
830 |
ptr_nick2 = ptr_nick2->next_nick) |
ptr_nick2 = ptr_nick2->next_nick) |
831 |
{ |
{ |
832 |
if (strncasecmp (ptr_nick2->nick, |
if (ascii_strncasecmp (ptr_nick2->nick, |
833 |
completion->base_word, length) == 0) |
completion->base_word, length) == 0) |
834 |
other_completion++; |
other_completion++; |
835 |
} |
} |
843 |
other_completion++; |
other_completion++; |
844 |
} |
} |
845 |
if (completion->word_found && |
if (completion->word_found && |
846 |
(strcasecmp (ptr_nick->nick, completion->word_found) == 0)) |
(ascii_strcasecmp (ptr_nick->nick, completion->word_found) == 0)) |
847 |
word_found_seen = 1; |
word_found_seen = 1; |
848 |
} |
} |
849 |
if (completion->word_found) |
if (completion->word_found) |