summaryrefslogtreecommitdiff
path: root/vchat-ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'vchat-ui.c')
-rwxr-xr-xvchat-ui.c113
1 files changed, 14 insertions, 99 deletions
diff --git a/vchat-ui.c b/vchat-ui.c
index 136fdee..bb94653 100755
--- a/vchat-ui.c
+++ b/vchat-ui.c
@@ -30,9 +30,11 @@
30#include <readline/history.h> 30#include <readline/history.h>
31#include <openssl/pem.h> 31#include <openssl/pem.h>
32#include <regex.h> 32#include <regex.h>
33#include "vchat.h"
34#include <wchar.h> 33#include <wchar.h>
35 34
35#include "vchat.h"
36#include "vchat-user.h"
37
36/* version of this module */ 38/* version of this module */
37char *vchat_ui_version = "$Id$"; 39char *vchat_ui_version = "$Id$";
38 40
@@ -667,37 +669,6 @@ shrinkprivwin (void) {
667 } 669 }
668} 670}
669 671
670/* nick completion callback for readline */
671static char **
672vcccomplete (char *text, int start, int end)
673{
674 char **matches;
675 matches = (char **) NULL;
676 /* are we at start of line, with no characters typed? message completion */
677 if (start == 0 && end == 0)
678 {
679#ifdef OLDREADLINE
680 matches = completion_matches (text, (CPFunction *) ul_mnickcomp);
681#else
682 matches = rl_completion_matches (text, (rl_compentry_func_t *) ul_mnickcomp);
683#endif
684 rl_attempted_completion_over = 1;
685 }
686 /* start of line? get matches for channel! */
687 else if (start == 0)
688 {
689#ifdef OLDREADLINE
690 matches = completion_matches (text, (CPFunction *) ul_cnickcomp);
691#else
692 matches = rl_completion_matches (text, (rl_compentry_func_t *) ul_cnickcomp);
693#endif
694 /* no, we want no 'normal' completion if started typing on the beginning
695 * of the line */
696 rl_attempted_completion_over = 1;
697 }
698 return (matches);
699}
700
701/* clear message window */ 672/* clear message window */
702void 673void
703clearpriv () 674clearpriv ()
@@ -1057,10 +1028,6 @@ drawwin (WINDOW *win, struct sb_data *sb )
1057 } 1028 }
1058} 1029}
1059 1030
1060#ifdef OLDREADLINE
1061typedef int rl_command_func_t __P((int, int));
1062#endif
1063
1064/* initialize curses and display */ 1031/* initialize curses and display */
1065void 1032void
1066initui (void) 1033initui (void)
@@ -1224,9 +1191,6 @@ initui (void)
1224 rl_generic_bind (ISFUNC, "\\M-[5~", (void *)scrollup, keymap); 1191 rl_generic_bind (ISFUNC, "\\M-[5~", (void *)scrollup, keymap);
1225 rl_generic_bind (ISFUNC, "\\M-[6~", (void *)scrolldown, keymap); 1192 rl_generic_bind (ISFUNC, "\\M-[6~", (void *)scrolldown, keymap);
1226 1193
1227// rl_bind_keyseq( "\\M-[5~", (rl_command_func_t *)scrollup );
1228// rl_bind_keyseq( "\\M-[6~", (rl_command_func_t *)scrolldown );
1229
1230 /* bind TAB to menu complete from readline */ 1194 /* bind TAB to menu complete from readline */
1231 rl_bind_key ('\t', (rl_command_func_t *) rl_menu_complete); 1195 rl_bind_key ('\t', (rl_command_func_t *) rl_menu_complete);
1232 1196
@@ -1235,66 +1199,17 @@ initui (void)
1235 1199
1236 /* set up nick completion functions .. */ 1200 /* set up nick completion functions .. */
1237 rl_ignore_completion_duplicates = 0; 1201 rl_ignore_completion_duplicates = 0;
1238#ifdef OLDREADLINE 1202 rl_sort_completion_matches = 0;
1239 rl_completion_entry_function = (Function *) ul_nickcomp; 1203 rl_attempted_completion_function = (rl_completion_func_t *) ul_complete_user;
1240 rl_attempted_completion_function = vcccomplete;
1241#else
1242 rl_completion_entry_function = (rl_compentry_func_t *) ul_nickcomp;
1243 rl_attempted_completion_function = (rl_completion_func_t *) vcccomplete;
1244#endif
1245 1204
1246 /* .. and 'line completed' callback */ 1205 /* .. and 'line completed' callback */
1247#ifdef OLDREADLINE
1248 rl_callback_handler_install ("", linecomplete);
1249#else
1250 rl_callback_handler_install ("", (rl_vcpfunc_t *) linecomplete); 1206 rl_callback_handler_install ("", (rl_vcpfunc_t *) linecomplete);
1251#endif
1252
1253 1207
1254 if( getintoption(CF_PRIVCOLLAPS) ) 1208 if( getintoption(CF_PRIVCOLLAPS) )
1255 toggleprivwin(); 1209 toggleprivwin();
1256 1210
1257/* 1211 resize(0);
1258 writeout( ">> Ctrl-X <<");
1259
1260 if (errstr[0] != '\0') {
1261 writeout(errstr);
1262 writeout( " ");
1263 }
1264
1265 writeout (vchat_cl_version);
1266 writeout (vchat_ui_version);
1267 writeout (vchat_io_version);
1268 writeout (vchat_us_version);
1269 writeout (vchat_cm_version);
1270 showout( );
1271*/
1272
1273 resize(0);
1274}
1275
1276/* render colorized line to window */
1277/* DOES NOT WRAP !!!
1278 CURRENTLY UNUSED
1279 Enable, when needed
1280
1281static void
1282writecolorized( WINDOW *win, char *string) {
1283 ncurs_attr old_att, new_att;
1284 int i;
1285
1286 WATTR_GET( win, old_att );
1287 new_att = old_att;
1288 for( i = 0; string[ i ]; i++ )
1289 if( string[ i ] == 1 ) {
1290 docolorize( string[++i], &new_att, old_att);
1291 } else {
1292 WATTR_SET( win, new_att );
1293 waddch( win, string[ i ] );
1294 }
1295 WATTR_SET( win, old_att );
1296} 1212}
1297*/
1298 1213
1299/* render consoleline to screen */ 1214/* render consoleline to screen */
1300void 1215void
@@ -1403,18 +1318,18 @@ exitui (void)
1403void 1318void
1404nickprompt (void) 1319nickprompt (void)
1405{ 1320{
1406 if (nick) 1321 char * newnick = 0;
1322
1323 if (own_nick_get())
1407 return; 1324 return;
1408 1325
1409 /* prompt user for nick unless he enters one */ 1326 /* prompt user for nick unless he enters one */
1410 consoleline("Please enter your nickname:"); 1327 consoleline("Please enter your nickname:");
1411 while (!nick || !nick[0]) 1328 while (!newnick)
1412 { 1329 newnick = readline("");
1413 if (nick) 1330
1414 free (nick); 1331 own_nick_set(newnick);
1415 nick = readline(""); 1332 setstroption(CF_NICK,newnick);
1416 }
1417 setstroption(CF_NICK,nick);
1418 1333
1419 /* try to get readlines stats clean again */ 1334 /* try to get readlines stats clean again */
1420 //rl_free_line_state (); 1335 //rl_free_line_state ();