Changeset ee310eb
- Timestamp:
- Feb 3, 2008, 1:08:11 AM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 99219ed
- Parents:
- 625802a (diff), af1920fd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 added
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
dict.c
r1cf3f8d3 raf1920fd 179 179 owl_dict_free_all(&d, NULL); 180 180 181 / / if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");181 /* if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n"); */ 182 182 printf("# END testing owl_dict (%d failures)\n", numfailed); 183 183 return(numfailed); -
editwin.c
rb2c1bd4 ree310eb 36 36 e->echochar='\0'; 37 37 38 /* We get initialized multiple times, but we need to hold on to 39 the callbacks, so we can't NULL them here. */ 38 40 /* 39 // We get initialized multiple times, but we need to hold on to40 // the callbacks, so we can't NULL them here.41 41 e->command = NULL; 42 42 e->callback = NULL; … … 116 116 owl_function_error("Internal error: No editwin callback!"); 117 117 } else { 118 / / owl_function_error("text: |%s|", owl_editwin_get_text(e));118 /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */ 119 119 cb(e); 120 120 } -
filter.c
rad15610 raf1920fd 341 341 TEST_FILTER("type ^zephyr$ and direction ^in$ and ( class ^owl$ or instance ^owl$ )", 1); 342 342 343 / / Order of operations and precedence343 /* Order of operations and precedence */ 344 344 TEST_FILTER("not true or false", 0); 345 345 TEST_FILTER("true or true and false", 0); … … 352 352 TEST_FILTER("filter f1", 1); 353 353 354 / / Test recursion prevention354 /* Test recursion prevention */ 355 355 FAIL_UNLESS("self reference", owl_filter_init_fromstring(&f2, "test", "filter test")); 356 356 357 / / mutual recursion357 /* mutual recursion */ 358 358 owl_filter_init_fromstring(&f3, "f3", "filter f4"); 359 359 owl_global_add_filter(&g, &f3); -
filterelement.c
r5616acc raf1920fd 124 124 } 125 125 126 / / Print methods126 /* Print methods */ 127 127 128 128 static void owl_filterelement_print_true(owl_filterelement *fe, char *buf) … … 182 182 } 183 183 184 / / Constructors184 /* Constructors */ 185 185 186 186 void owl_filterelement_create(owl_filterelement *fe) { -
fmtext.c
rc55ad84 ree310eb 793 793 void owl_fmtext_init_colorpair_mgr(owl_colorpair_mgr *cpmgr) 794 794 { 795 / / This could be a bitarray if we wanted to save memory.795 /* This could be a bitarray if we wanted to save memory. */ 796 796 short i, j; 797 797 cpmgr->next = 8; 798 798 799 / / The test is <= because we allocate COLORS+1 entries.799 /* The test is <= because we allocate COLORS+1 entries. */ 800 800 cpmgr->pairs = owl_malloc((COLORS+1) * sizeof(short*)); 801 801 for(i = 0; i <= COLORS; i++) { … … 823 823 cpmgr->next = 8; 824 824 825 / / The test is <= because we allocated COLORS+1 entries.825 /* The test is <= because we allocated COLORS+1 entries. */ 826 826 for(i = 0; i <= COLORS; i++) { 827 827 for(j = 0; j <= COLORS; j++) { … … 844 844 short pair, default_bg; 845 845 846 /* Sanity (Bounds) Check */ 847 if (fg > COLORS || fg < OWL_COLOR_DEFAULT) fg = OWL_COLOR_DEFAULT; 848 if (bg > COLORS || bg < OWL_COLOR_DEFAULT) bg = OWL_COLOR_DEFAULT; 849 846 850 #ifdef HAVE_USE_DEFAULT_COLORS 847 851 if (fg == OWL_COLOR_DEFAULT) fg = -1; … … 853 857 #endif 854 858 855 / / looking for a pair we already set up for this draw.859 /* looking for a pair we already set up for this draw. */ 856 860 cpmgr = owl_global_get_colorpair_mgr(&g); 857 861 pair = cpmgr->pairs[fg+1][bg+1]; 858 862 if (!(pair != -1 && pair < cpmgr->next)) { 859 /* owl_global_set_needrefresh(&g);*/ 860 // If we didn't find a pair, search for a free one to assign. 863 /* If we didn't find a pair, search for a free one to assign. */ 861 864 pair = (cpmgr->next < COLOR_PAIRS) ? cpmgr->next : -1; 862 865 if (pair != -1) { 863 / / We found a free pair, initialize it.866 /* We found a free pair, initialize it. */ 864 867 init_pair(pair, fg, bg); 865 868 cpmgr->pairs[fg+1][bg+1] = pair; … … 867 870 } 868 871 else if (bg != OWL_COLOR_DEFAULT) { 869 / / We still don't have a pair, drop the background color. Too bad.872 /* We still don't have a pair, drop the background color. Too bad. */ 870 873 owl_function_debugmsg("colorpairs: color shortage - dropping background color."); 871 874 pair = owl_fmtext_get_colorpair(fg, OWL_COLOR_DEFAULT); 872 875 } 873 876 else { 874 / / We still don't have a pair, defaults all around.877 /* We still don't have a pair, defaults all around. */ 875 878 owl_function_debugmsg("colorpairs: color shortage - dropping foreground and background color."); 876 879 pair = 0; -
functions.c
rf9eea4c ree310eb 1372 1372 redrawwin(owl_global_get_curs_recwin(&g)); 1373 1373 redrawwin(owl_global_get_curs_sepwin(&g)); 1374 / / Work around curses segfualts with windows off the screen1374 /* Work around curses segfualts with windows off the screen */ 1375 1375 if (g.lines >= owl_global_get_typwin_lines(&g)+2) 1376 1376 redrawwin(owl_global_get_curs_typwin(&g)); -
logging.c
r28ee32b ree310eb 139 139 /* Figure out what path to log to */ 140 140 if (owl_message_is_type_zephyr(m)) { 141 / / If this has CC's, do all but the "recipient" which we'll do below141 /* If this has CC's, do all but the "recipient" which we'll do below */ 142 142 to = owl_message_get_cc_without_recipient(m); 143 143 if (to != NULL) { … … 326 326 327 327 if (personal && owl_message_is_type_zephyr(m)) { 328 // We want to log to all of the CC'd people who were not us, or 329 // the sender, as well. 328 /* We want to log to all of the CC'd people who were not us, or 329 * the sender, as well. 330 */ 330 331 char *cc, *temp; 331 332 cc = owl_message_get_cc_without_recipient(m); -
obarray.c
r535d68b raf1920fd 10 10 */ 11 11 12 // Helper method: Lookup a key in the obarray. If the key exists, 13 // return its index, and the interned value in *val. Otherwise, return 14 // the index it should be inserted at. 12 /* Helper method: Lookup a key in the obarray. If the key exists, 13 * return its index, and the interned value in *val. Otherwise, return 14 * the index it should be inserted at. 15 */ 15 16 int owl_obarray_lookup(owl_obarray *oa, char * key, char ** val) /*noproto*/ 16 17 { … … 39 40 } 40 41 41 / / Returns NULL if the string doesn't exist in the obarray42 /* Returns NULL if the string doesn't exist in the obarray */ 42 43 char * owl_obarray_find(owl_obarray *oa, char * string) 43 44 { … … 47 48 } 48 49 49 / / Inserts the string into the obarray if it doesn't exist50 /* Inserts the string into the obarray if it doesn't exist */ 50 51 char * owl_obarray_insert(owl_obarray *oa, char * string) 51 52 { -
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r5ff830a rcab045b 162 162 ); 163 163 164 if ($conn->conn ected) {164 if ($conn->conn->connected) { 165 165 BarnOwl::admin_message("IRC", "Connected to $alias as $nick"); 166 166 $ircnets{$alias} = $conn; -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r81312e4 ree310eb 137 137 } 138 138 139 our $showOffline = 0; 140 139 141 sub blist_listBuddy { 140 142 my $roster = shift; … … 152 154 $blistStr .= " [" . ( $rq{show} ? $rq{show} : 'online' ) . "]"; 153 155 $blistStr .= " " . $rq{status} if $rq{status}; 154 $blistStr = BarnOwl::Style::boldify($blistStr) ;156 $blistStr = BarnOwl::Style::boldify($blistStr) if $showOffline; 155 157 } 156 158 else { 157 return '' if (BarnOwl::getvar('jabber:show_offline_buddies') eq 'off');159 return '' unless $showOffline; 158 160 if ($jq{ask}) { 159 161 $blistStr .= " [pending]"; … … 198 200 199 201 sub onGetBuddyList { 202 $showOffline = BarnOwl::getvar('jabber:show_offline_buddies') eq 'on'; 200 203 my $blist = ""; 201 204 foreach my $jid ($conn->getJIDs()) { -
perlconfig.c
r367fbf3 ree310eb 14 14 extern XS(boot_BarnOwl); 15 15 extern XS(boot_DynaLoader); 16 / / extern XS(boot_DBI);16 /* extern XS(boot_DBI); */ 17 17 18 18 static void owl_perl_xs_init(pTHX) -
util.c
r84027015 ree310eb 888 888 !strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-"))); 889 889 890 / / if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");890 /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */ 891 891 printf("# END testing owl_util (%d failures)\n", numfailed); 892 892 return(numfailed); -
variable.c
rd536e72 raf1920fd 1083 1083 owl_variable_dict_free(&vd); 1084 1084 1085 / / if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");1085 /* if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n"); */ 1086 1086 printf("# END testing owl_variable (%d failures)\n", numfailed); 1087 1087 return(numfailed); -
Makefile.in
r5ff830a r625802a 26 26 keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \ 27 27 aim.c buddy.c buddylist.c timer.c style.c stylefunc.c errqueue.c \ 28 zbuddylist.c muxevents.c popexec.c obarray.c 28 zbuddylist.c muxevents.c popexec.c obarray.c wcwidth.c glib_compat.c 29 29 OWL_SRC = owl.c 30 30 TESTER_SRC = tester.c -
aim.c
r9854278 r34509d5 948 948 949 949 if (modname) { 950 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) {950 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) { 951 951 /* perror("memrequest: malloc"); */ 952 952 return -1; … … 954 954 sprintf(filename, "%s/%s.ocm", priv->aimbinarypath, modname); 955 955 } else { 956 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) {956 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) { 957 957 /* perror("memrequest: malloc"); */ 958 958 return -1; … … 964 964 if (!modname) { 965 965 /* perror("memrequest: stat"); */ 966 free(filename);966 owl_free(filename); 967 967 return -1; 968 968 } … … 986 986 int i; 987 987 988 free(filename); /* not needed */988 owl_free(filename); /* not needed */ 989 989 owl_function_error("getaimdata memrequest: recieved invalid request for 0x%08lx bytes at 0x%08lx (file %s)\n", len, offset, modname); 990 990 i = 8; … … 993 993 } 994 994 995 if (!(buf = malloc(i))) {995 if (!(buf = owl_malloc(i))) { 996 996 return -1; 997 997 } … … 1017 1017 *buflenret = i; 1018 1018 } else { 1019 if (!(buf = malloc(len))) {1020 free(filename);1019 if (!(buf = owl_malloc(len))) { 1020 owl_free(filename); 1021 1021 return -1; 1022 1022 } … … 1024 1024 if (!(f = fopen(filename, "r"))) { 1025 1025 /* perror("memrequest: fopen"); */ 1026 free(filename);1027 free(buf);1026 owl_free(filename); 1027 owl_free(buf); 1028 1028 return -1; 1029 1029 } 1030 1030 1031 free(filename);1031 owl_free(filename); 1032 1032 1033 1033 if (fseek(f, offset, SEEK_SET) == -1) { 1034 1034 /* perror("memrequest: fseek"); */ 1035 1035 fclose(f); 1036 free(buf);1036 owl_free(buf); 1037 1037 return -1; 1038 1038 } … … 1041 1041 /* perror("memrequest: fread"); */ 1042 1042 fclose(f); 1043 free(buf);1043 owl_free(buf); 1044 1044 return -1; 1045 1045 } … … 1076 1076 if (priv->aimbinarypath && (getaimdata(sess, &buf, &buflen, offset, len, modname) == 0)) { 1077 1077 aim_sendmemblock(sess, fr->conn, offset, buflen, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1078 free(buf);1078 owl_free(buf); 1079 1079 } else { 1080 1080 owl_function_debugmsg("faimtest_memrequest: unable to use AIM binary (\"%s/%s\"), sending defaults...\n", priv->aimbinarypath, modname); … … 1342 1342 int z; 1343 1343 1344 newbuf = malloc(i+1);1344 newbuf = owl_malloc(i+1); 1345 1345 for (z = 0; z < i; z++) 1346 1346 newbuf[z] = (z % 10)+0x30; 1347 1347 newbuf[i] = '\0'; 1348 1348 /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK | AIM_IMFLAGS_AWAY, newbuf); */ 1349 free(newbuf);1349 owl_free(newbuf); 1350 1350 } 1351 1351 } else if (strstr(tmpstr, "seticqstatus")) { -
cmd.c
r6922edd r34509d5 74 74 owl_cmd *cmd; 75 75 76 tmpbuff= strdup(cmdbuff);76 tmpbuff=owl_strdup(cmdbuff); 77 77 argv=owl_parseline(tmpbuff, &argc); 78 78 if (argc < 0) { -
config.h.in
r03cf6b9 re23eb2b 22 22 #undef HAVE_LIBCOM_ERR 23 23 24 /* Define to 1 if you have the `curses' library (-lcurses). */25 #undef HAVE_LIBCURSES26 27 24 /* Define to 1 if you have the `des425' library (-ldes425). */ 28 25 #undef HAVE_LIBDES425 … … 39 36 /* Define to 1 if you have the `krb5' library (-lkrb5). */ 40 37 #undef HAVE_LIBKRB5 41 42 /* Define to 1 if you have the `ncurses' library (-lncurses). */43 #undef HAVE_LIBNCURSES44 38 45 39 /* Define to 1 if you have the `ncursesw' library (-lncursesw). */ -
configure.in
r18e28a4 re23eb2b 12 12 fi 13 13 14 m4_include(/usr/share/aclocal/pkg.m4) 15 dnl m4_include(pkg.m4) 14 16 15 17 dnl Check for Athena … … 44 46 fi 45 47 46 AC_CHECK_LIB(ncursesw, initscr,, 47 AC_CHECK_LIB(ncurses, initscr,, 48 AC_CHECK_LIB(curses, initscr,, AC_MSG_ERROR(No curses library found.)))) 48 AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No curses library found.)) 49 49 AC_CHECK_LIB(com_err, com_err) 50 50 AC_CHECK_LIB(nsl, gethostbyname) … … 109 109 LDFLAGS=${LDFLAGS}\ ${FOO} 110 110 111 dnl Add CFLAGS and LDFLAGS for glib-2.0 112 PKG_CHECK_MODULES(GLIB,glib-2.0) 113 114 echo Adding glib-2.0 CFLAGS ${GLIB_CFLAGS} 115 CFLAGS=${CFLAGS}\ ${GLIB_CFLAGS} 116 echo Adding glib-2.0 LDFLAGS ${GLIB_LIBS} 117 LDFLAGS=${LDFLAGS}\ ${GLIB_LIBS} 118 119 111 120 dnl Checks for typedefs, structures, and compiler characteristics. 112 121 -
global.c
reebef19 r625802a 549 549 len+=strlen(argv[i])+5; 550 550 } 551 g->startupargs= malloc(len+5);551 g->startupargs=owl_malloc(len+5); 552 552 553 553 strcpy(g->startupargs, ""); -
keymap.c
rcf83b7a r428834d 5 5 6 6 /* returns 0 on success */ 7 int owl_keymap_init(owl_keymap *km, char *name, char *desc, void (*default_fn)( int), void (*prealways_fn)(int), void (*postalways_fn)(int))7 int owl_keymap_init(owl_keymap *km, char *name, char *desc, void (*default_fn)(owl_input), void (*prealways_fn)(owl_input), void (*postalways_fn)(owl_input)) 8 8 { 9 9 if (!name || !desc) return(-1); … … 151 151 } 152 152 153 owl_keymap *owl_keyhandler_create_and_add_keymap(owl_keyhandler *kh, char *name, char *desc, void (*default_fn)( int), void (*prealways_fn)(int), void (*postalways_fn)(int))153 owl_keymap *owl_keyhandler_create_and_add_keymap(owl_keyhandler *kh, char *name, char *desc, void (*default_fn)(owl_input), void (*prealways_fn)(owl_input), void (*postalways_fn)(owl_input)) 154 154 { 155 155 owl_keymap *km; … … 202 202 /* processes a keypress. returns 0 if the keypress was handled, 203 203 * 1 if not handled, -1 on error, and -2 if j==ERR. */ 204 int owl_keyhandler_process(owl_keyhandler *kh, int j)204 int owl_keyhandler_process(owl_keyhandler *kh, owl_input j) 205 205 { 206 206 owl_keymap *km; … … 214 214 215 215 /* temporarily disallow C-`/C-SPACE until we fix associated bugs */ 216 if (j ==ERR || j==0) {216 if (j.ch == ERR || j.ch == 0) { 217 217 return(-1); 218 218 } … … 224 224 225 225 /* deal with ESC prefixing */ 226 if (!kh->in_esc && j ==27) {226 if (!kh->in_esc && j.ch == 27) { 227 227 kh->in_esc = 1; 228 228 return(0); 229 229 } 230 230 if (kh->in_esc) { 231 j = OWL_META(j);231 j.ch = OWL_META(j.ch); 232 232 kh->in_esc = 0; 233 233 } 234 234 235 kh->kpstack[++(kh->kpstackpos)] = j ;235 kh->kpstack[++(kh->kpstackpos)] = j.ch; 236 236 if (kh->kpstackpos >= OWL_KEYMAP_MAXSTACK) { 237 237 owl_keyhandler_reset(kh); … … 260 260 } else if (match == 2) { /* exact match */ 261 261 /* owl_function_debugmsg("processkey: found exact match in %s", km->name); */ 262 owl_keybinding_execute(kb, j );262 owl_keybinding_execute(kb, j.ch); 263 263 owl_keyhandler_reset(kh); 264 264 if (km->postalways_fn) { -
keypress.c
r948b942 r428834d 148 148 } 149 149 if (!*kb) { 150 if (j &OWL_META(0)) {150 if (j & OWL_META(0)) { 151 151 strcat(kb, "M-"); 152 152 j &= ~OWL_META(0); … … 163 163 strcat(kb, kb2); 164 164 } 165 165 166 } 166 167 if (!*kb) { -
keys.c
r8938188 rfac5463 294 294 /****************************************************************/ 295 295 296 void owl_keys_recwin_prealways( int j) {296 void owl_keys_recwin_prealways(owl_input j) { 297 297 /* Clear the message line on subsequent key presses */ 298 298 owl_function_makemsg(""); 299 299 } 300 300 301 void owl_keys_editwin_default( int j) {301 void owl_keys_editwin_default(owl_input j) { 302 302 owl_editwin *e; 303 303 if (NULL != (e=owl_global_get_typwin(&g))) { 304 owl_editwin_process_char(e, j);304 owl_editwin_process_char(e, j); 305 305 } 306 306 } 307 307 308 void owl_keys_editwin_postalways( int j) {308 void owl_keys_editwin_postalways(owl_input j) { 309 309 owl_editwin *e; 310 310 if (NULL != (e=owl_global_get_typwin(&g))) { 311 311 owl_editwin_post_process_char(e, j); 312 } 312 } 313 313 owl_global_set_needrefresh(&g); 314 314 } 315 315 316 void owl_keys_popless_postalways( int j) {316 void owl_keys_popless_postalways(owl_input j) { 317 317 owl_viewwin *v = owl_global_get_viewwin(&g); 318 318 owl_popwin *pw = owl_global_get_popwin(&g); … … 323 323 } 324 324 325 void owl_keys_default_invalid( int j) {326 if (j ==ERR) return;327 if (j ==410) return;325 void owl_keys_default_invalid(owl_input j) { 326 if (j.ch==ERR) return; 327 if (j.ch==410) return; 328 328 owl_keyhandler_invalidkey(owl_global_get_keyhandler(&g)); 329 329 } -
message.c
r635881c ra827529 79 79 owl_list_append_element(&(m->attributes), pair); 80 80 } 81 owl_pair_set_value(pair, owl_ strdup(attrvalue));81 owl_pair_set_value(pair, owl_validate_or_convert(attrvalue)); 82 82 } 83 83 … … 493 493 { 494 494 if(m->zwriteline) owl_free(m->zwriteline); 495 m->zwriteline= strdup(line);495 m->zwriteline=owl_strdup(line); 496 496 } 497 497 … … 535 535 owl_fmtext_init_null(&b); 536 536 537 owl_fmtext_truncate_lines(&(m->fmtext->fmtext), aline, bline-aline +1, &a);537 owl_fmtext_truncate_lines(&(m->fmtext->fmtext), aline, bline-aline, &a); 538 538 owl_fmtext_truncate_cols(&a, acol, bcol, &b); 539 if (fgcolor!=OWL_COLOR_DEFAULT) { 540 owl_fmtext_colorize(&b, fgcolor); 541 } 542 if (bgcolor!=OWL_COLOR_DEFAULT) { 543 owl_fmtext_colorizebg(&b, bgcolor); 544 } 545 546 if (owl_global_is_search_active(&g)) { 547 owl_fmtext_search_and_highlight(&b, owl_global_get_search_string(&g)); 548 } 549 539 owl_fmtext_colorize(&b, fgcolor); 540 owl_fmtext_colorizebg(&b, bgcolor); 541 550 542 owl_fmtext_curs_waddstr(&b, win); 551 543 … … 890 882 } 891 883 892 m->zwriteline= strdup("");884 m->zwriteline=owl_strdup(""); 893 885 894 886 /* save the hostname */ … … 972 964 } 973 965 974 m->zwriteline= strdup("");966 m->zwriteline=owl_strdup(""); 975 967 976 968 owl_message_set_body(m, "<uninitialized>"); -
owl.c
reebef19 r625802a 48 48 #include <termios.h> 49 49 #include <sys/stat.h> 50 #include <locale.h> 50 51 #include "owl.h" 51 52 … … 69 70 owl_editwin *tw; 70 71 owl_popwin *pw; 71 int j, ret, initialsubs, debug, argcsave, followlast; 72 int ret, initialsubs, debug, argcsave, followlast; 73 owl_input j; 72 74 int newmsgs, nexttimediff; 73 75 struct sigaction sigact; … … 84 86 int newstderr; 85 87 #endif 88 89 if (!GLIB_CHECK_VERSION (2, 12, 0)) 90 g_error ("GLib version 2.12.0 or above is needed."); 86 91 87 92 argcsave=argc; … … 92 97 debug=0; 93 98 initialsubs=1; 99 100 setlocale(LC_ALL, ""); 101 94 102 if (argc>0) { 95 103 argv++; … … 530 538 * little bit, but otherwise do not. This lets input be grabbed 531 539 * as quickly as possbile */ 532 j =wgetch(typwin);533 if (j ==ERR) {540 j.ch = wgetch(typwin); 541 if (j.ch == ERR) { 534 542 usleep(10000); 535 543 } else { 544 j.uch = '\0'; 545 if (j.ch >= KEY_MIN && j.ch <= KEY_MAX) { 546 /* This is a curses control character. */ 547 } 548 else if (j.ch > 0x7f && j.ch < 0xfe) { 549 /* Pull in a full utf-8 character. */ 550 int bytes, i; 551 char utf8buf[7]; 552 memset(utf8buf, '\0', 7); 553 554 utf8buf[0] = j.ch; 555 556 if ((j.ch & 0xc0) && (~j.ch & 0x20)) bytes = 2; 557 else if ((j.ch & 0xe0) && (~j.ch & 0x10)) bytes = 3; 558 else if ((j.ch & 0xf0) && (~j.ch & 0x08)) bytes = 4; 559 else if ((j.ch & 0xf8) && (~j.ch & 0x04)) bytes = 5; 560 else if ((j.ch & 0xfc) && (~j.ch & 0x02)) bytes = 6; 561 else bytes = 1; 562 563 for (i = 1; i < bytes; i++) { 564 int tmp = wgetch(typwin); 565 /* If what we got was not a byte, or not a continuation byte */ 566 if (tmp > 0xff || !(tmp & 0x80 && ~tmp & 0x40)) { 567 /* ill-formed UTF-8 code unit subsequence, put back the 568 char we just got. */ 569 ungetch(tmp); 570 j.ch = ERR; 571 break; 572 } 573 utf8buf[i] = tmp; 574 } 575 576 if (j.ch != ERR) { 577 if (g_utf8_validate(utf8buf, -1, NULL)) { 578 j.uch = g_utf8_get_char(utf8buf); 579 } 580 else { 581 j.ch = ERR; 582 } 583 } 584 } 585 else if (j.ch <= 0x7f) { 586 j.uch = j.ch; 587 } 588 536 589 owl_global_set_lastinputtime(&g, now); 537 590 /* find and activate the current keymap. -
owl.h
r88dc766 rf92080c 52 52 #include <termios.h> 53 53 #include <libfaim/aim.h> 54 #include <wchar.h> 54 55 #include "config.h" 56 #include "glib.h" 55 57 #ifdef HAVE_LIBZEPHYR 56 58 #include <zephyr/zephyr.h> … … 100 102 #define OWL_FMTEXT_ATTR_REVERSE 2 101 103 #define OWL_FMTEXT_ATTR_UNDERLINE 4 104 105 #define OWL_FMTEXT_UC_BASE 0x100000 /* Unicode Plane 16 - Supplementary Private Use Area-B*/ 106 #define OWL_FMTEXT_UC_ATTR ( OWL_FMTEXT_UC_BASE | 0x800 ) 107 #define OWL_FMTEXT_UC_ATTR_MASK 0x7 108 #define OWL_FMTEXT_UC_COLOR_BASE ( OWL_FMTEXT_UC_BASE | 0x400 ) 109 #define OWL_FMTEXT_UC_FGCOLOR OWL_FMTEXT_UC_COLOR_BASE 110 #define OWL_FMTEXT_UC_BGCOLOR ( OWL_FMTEXT_UC_COLOR_BASE | 0x200 ) 111 #define OWL_FMTEXT_UC_DEFAULT_COLOR 0x100 112 #define OWL_FMTEXT_UC_FGDEFAULT ( OWL_FMTEXT_UC_FGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR ) 113 #define OWL_FMTEXT_UC_BGDEFAULT ( OWL_FMTEXT_UC_BGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR ) 114 #define OWL_FMTEXT_UC_COLOR_MASK 0xFF 115 #define OWL_FMTEXT_UC_ALLCOLOR_MASK ( OWL_FMTEXT_UC_COLOR_MASK | OWL_FMTEXT_UC_DEFAULT_COLOR | 0x200) 116 #define OWL_FMTEXT_UC_STARTBYTE_UTF8 '\xf4' 117 118 #define OWL_FMTEXT_UTF8_ATTR_NONE "\xf4\x80\xa0\x80" 119 #define OWL_FMTEXT_UTF8_FGDEFAULT "\xf4\x80\x94\x80" 120 #define OWL_FMTEXT_UTF8_BGDEFAULT "\xf4\x80\x96\x80" 121 122 123 102 124 103 125 #define OWL_COLOR_BLACK 0 … … 212 234 #endif 213 235 214 #define OWL_META(key) ((key)|0 200)236 #define OWL_META(key) ((key)|010000) 215 237 /* OWL_CTRL is definied in kepress.c */ 216 238 … … 252 274 } owl_variable; 253 275 276 typedef struct _owl_input { 277 int ch; 278 gunichar uch; 279 } owl_input; 280 254 281 typedef struct _owl_fmtext { 255 282 int textlen; 256 283 int bufflen; 257 284 char *textbuff; 258 char *fmbuff;259 short *fgcolorbuff;260 short *bgcolorbuff;285 char default_attrs; 286 short default_fgcolor; 287 short default_bgcolor; 261 288 } owl_fmtext; 262 289 … … 491 518 owl_list bindings; /* key bindings */ 492 519 struct _owl_keymap *submap; /* submap */ 493 void (*default_fn)( int j); /* default action (takes a keypress) */494 void (*prealways_fn)( intj); /* always called before a keypress is received */495 void (*postalways_fn)( intj); /* always called after keypress is processed */520 void (*default_fn)(owl_input j); /* default action (takes a keypress) */ 521 void (*prealways_fn)(owl_input j); /* always called before a keypress is received */ 522 void (*postalways_fn)(owl_input j); /* always called after keypress is processed */ 496 523 } owl_keymap; 497 524 -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
r892568b re0ffe77 1 1 use warnings; 2 2 use strict; 3 use utf8; 3 4 4 5 =head1 NAME -
perl/modules/Jabber/lib/Net/XMPP/Debug.pm
rc2bed55 rb7b2a76 189 189 { 190 190 $self->{HANDLE}->autoflush(1); 191 binmode $self->{HANDLE}, ":utf8"; 191 192 $Net::XMPP::Debug::HANDLES{$args{file}} = $self->{HANDLE}; 192 193 } -
perl/modules/Jabber/lib/Net/XMPP/Message.pm
rc2bed55 r8574801 135 135 $Mess->SetMessage(TO=>"bob\@jabber.org", 136 136 Subject=>"Lunch", 137 Bo Dy=>"Let's do lunch!");137 Body=>"Let's do lunch!"); 138 138 $Mess->SetMessage(to=>"bob\@jabber.org", 139 139 from=>"jabber.org", -
perl/modules/Jabber/lib/XML/Stream.pm
r5073972 ra8d5a39 1659 1659 { 1660 1660 $self->debug(3,"Send: can_write"); 1661 1661 1662 1662 $self->{SENDSTRING} = Encode::encode_utf8(join("",@_)); 1663 1663 -
text.c
r72db971 r47519e1b 50 50 void owl_text_truncate_cols(char *out, char *in, int acol, int bcol) 51 51 { 52 char *ptr 1, *ptr2, *tmpbuff, *last;53 int len;54 52 char *ptr_s, *ptr_e, *ptr_c, *tmpbuff, *last; 53 int col, cnt, padding; 54 55 55 tmpbuff=owl_malloc(strlen(in)+20); 56 56 57 57 strcpy(tmpbuff, ""); 58 58 last=in+strlen(in)-1; 59 ptr 1=in;60 while (ptr 1<last) {61 ptr 2=strchr(ptr1, '\n');62 if (!ptr 2) {59 ptr_s=in; 60 while (ptr_s<last) { 61 ptr_e=strchr(ptr_s, '\n'); 62 if (!ptr_e) { 63 63 /* but this shouldn't happen if we end in a \n */ 64 64 break; 65 65 } 66 66 67 if (ptr 2==ptr1) {67 if (ptr_e==ptr_s) { 68 68 strcat(tmpbuff, "\n"); 69 ptr1++; 70 continue; 71 } 72 69 ptr_s++; 70 continue; 71 } 72 73 col = 0; 74 cnt = 0; 75 padding = 0; 76 ptr_c = ptr_s; 77 while(col < bcol && ptr_c < ptr_e) { 78 gunichar c = g_utf8_get_char(ptr_c); 79 if (col + mk_wcwidth(c) > bcol) break; 80 col += mk_wcwidth(c); 81 ptr_c = g_utf8_next_char(ptr_c); 82 if (col >= acol) { 83 if (cnt == 0) { 84 ptr_s = ptr_c; 85 padding = col - acol; 86 } 87 ++cnt; 88 } 89 } 90 if (cnt) { 91 while(padding-- > 0) { 92 strcat(tmpbuff, " "); 93 } 94 strncat(tmpbuff, ptr_s, ptr_c - ptr_s - 1); 95 } 96 strcat(tmpbuff, "\n"); 97 ptr_s = ptr_e + 1; 98 #if 0 73 99 /* we need to check that we won't run over here */ 74 if ( (ptr 2-ptr1) < (bcol-acol) ) {75 len=ptr 2-(ptr1+acol);100 if ( (ptr_e-ptr_s) < (bcol-acol) ) { 101 len=ptr_e-(ptr_s+acol); 76 102 } else { 77 103 len=bcol-acol; 78 104 } 79 if ((ptr 1+len)>=last) {80 len-=last-(ptr 1+len);81 } 82 83 strncat(tmpbuff, ptr 1+acol, len);105 if ((ptr_s+len)>=last) { 106 len-=last-(ptr_s+len); 107 } 108 109 strncat(tmpbuff, ptr_s+acol, len); 84 110 strcat(tmpbuff, "\n"); 85 111 86 ptr1=ptr2+1; 112 ptr_s=ptr_e+1; 113 #endif 87 114 } 88 115 strcpy(out, tmpbuff); … … 275 302 char *stristr(char *a, char *b) 276 303 { 277 char *x, *y, *ret; 278 279 if ((x=owl_strdup(a))==NULL) return(NULL); 280 if ((y=owl_strdup(b))==NULL) return(NULL); 281 downstr(x); 282 downstr(y); 283 ret=strstr(x, y); 284 if (ret==NULL) { 285 owl_free(x); 286 owl_free(y); 287 return(NULL); 288 } 289 ret=ret-x+a; 290 owl_free(x); 291 owl_free(y); 304 char *x, *y; 305 char *ret = NULL; 306 if ((x = g_utf8_casefold(a, -1)) != NULL) { 307 if ((y = g_utf8_casefold(b, -1)) != NULL) { 308 ret = strstr(x, y); 309 if (ret != NULL) { 310 ret = ret - x + a; 311 } 312 g_free(y); 313 } 314 g_free(x); 315 } 292 316 return(ret); 293 317 } … … 296 320 int only_whitespace(char *s) 297 321 { 298 int i; 299 for (i=0; s[i]; i++) { 300 if (!isspace((int) s[i])) return(0); 322 if (g_utf8_validate(s,-1,NULL)) { 323 char *p; 324 for(p = s; p[0]; p=g_utf8_next_char(p)) { 325 if (!g_unichar_isspace(g_utf8_get_char(p))) return 0; 326 } 327 } 328 else { 329 int i; 330 for (i=0; s[i]; i++) { 331 if (!isspace((int) s[i])) return(0); 332 } 301 333 } 302 334 return(1); … … 327 359 tolen = strlen(to); 328 360 fromlen = strlen(from); 329 out = malloc(outlen);361 out = owl_malloc(outlen); 330 362 331 363 while (in[inpos]) { -
viewwin.c
r8721756 r47519e1b 73 73 owl_fmtext_truncate_cols(&fm1, v->rightshift, v->wincols-1+v->rightshift, &fm2); 74 74 75 owl_fmtext_curs_waddstr (&fm2, v->curswin);75 owl_fmtext_curs_waddstr_without_search(&fm2, v->curswin); 76 76 77 77 /* print the message at the bottom */ -
zcrypt.c
r9ceee9d r34509d5 385 385 386 386 /* Build a space-separated string from argv from elements between start * 387 * and end - 1. malloc()'s the returned string. */387 * and end - 1. owl_malloc()'s the returned string. */ 388 388 char *BuildArgString(char **argv, int start, int end) { 389 389 int len = 1; … … 397 397 398 398 /* Allocate memory */ 399 result = (char *) malloc(len);399 result = (char *)owl_malloc(len); 400 400 if (result) { 401 401 /* Build the string */ … … 482 482 /* Prepare result to be returned */ 483 483 char *temp = keyfile; 484 keyfile = (char *) malloc(strlen(temp) + 1);484 keyfile = (char *)owl_malloc(strlen(temp) + 1); 485 485 if (keyfile) { 486 486 strcpy(keyfile, temp); … … 611 611 } 612 612 use_buffer = TRUE; 613 if ((inptr = inbuff = (char *) malloc(MAX_RESULT)) == NULL) {613 if ((inptr = inbuff = (char *)owl_malloc(MAX_RESULT)) == NULL) { 614 614 printf("Memory allocation error\n"); 615 615 return FALSE; … … 639 639 printf("Could not run zwrite\n"); 640 640 if (freein && inbuff) { 641 free(inbuff);641 owl_free(inbuff); 642 642 } 643 643 return(FALSE); … … 685 685 686 686 /* Free the input buffer, if necessary */ 687 if (freein && inbuff) free(inbuff);687 if (freein && inbuff) owl_free(inbuff); 688 688 689 689 return(!error); -
zephyr.c
r10e3963 r625802a 354 354 return(owl_strdup("")); 355 355 } 356 357 char *owl_zephyr_get_field_as_utf8(ZNotice_t *n, int j) 358 { 359 int i, count, save; 360 361 /* If there's no message here, just run along now */ 362 if (n->z_message_len == 0) 363 return(owl_strdup("")); 364 365 count=save=0; 366 for (i = 0; i < n->z_message_len; i++) { 367 if (n->z_message[i]=='\0') { 368 count++; 369 if (count == j) { 370 /* just found the end of the field we're looking for */ 371 return(owl_validate_or_convert(n->z_message + save)); 372 } else { 373 save = i + 1; 374 } 375 } 376 } 377 /* catch the last field, which might not be null terminated */ 378 if (count == j - 1) { 379 char *tmp, *out; 380 tmp = owl_malloc(n->z_message_len-save+5); 381 memcpy(tmp, n->z_message+save, n->z_message_len-save); 382 tmp[n->z_message_len-save]='\0'; 383 out = owl_validate_or_convert(tmp); 384 owl_free(tmp); 385 return out; 386 } 387 388 return(owl_strdup("")); 389 } 356 390 #else 357 391 char *owl_zephyr_get_field(void *n, int j) 358 392 { 359 393 return(owl_strdup("")); 394 } 395 char *owl_zephyr_get_field_as_utf8(ZNotice_t *n, int j) 396 { 397 return owl_zephyr_get_field(n, j); 360 398 } 361 399 #endif -
zwrite.c
r1fe100c r7b1d048 44 44 break; 45 45 } 46 z->class=owl_ strdup(myargv[1]);46 z->class=owl_get_iso_8859_1_if_possible(myargv[1]); 47 47 myargv+=2; 48 48 myargc-=2; … … 52 52 break; 53 53 } 54 z->inst=owl_ strdup(myargv[1]);54 z->inst=owl_get_iso_8859_1_if_possible(myargv[1]); 55 55 myargv+=2; 56 56 myargc-=2; … … 60 60 break; 61 61 } 62 z->realm=owl_ strdup(myargv[1]);62 z->realm=owl_get_iso_8859_1_if_possible(myargv[1]); 63 63 myargv+=2; 64 64 myargc-=2; … … 68 68 break; 69 69 } 70 z->zsig=owl_ strdup(myargv[1]);70 z->zsig=owl_get_iso_8859_1_if_possible(myargv[1]); 71 71 myargv+=2; 72 72 myargc-=2; … … 76 76 break; 77 77 } 78 z->opcode=owl_ strdup(myargv[1]);78 z->opcode=owl_get_iso_8859_1_if_possible(myargv[1]); 79 79 myargv+=2; 80 80 myargc-=2; … … 93 93 myargv++; 94 94 myargc--; 95 z->message=owl_ strdup("");95 z->message=owl_get_iso_8859_1_if_possible(""); 96 96 while (myargc) { 97 z->message= realloc(z->message, strlen(z->message)+strlen(myargv[0])+5);97 z->message=owl_realloc(z->message, strlen(z->message)+strlen(myargv[0])+5); 98 98 strcat(z->message, myargv[0]); 99 99 strcat(z->message, " "); … … 113 113 } else { 114 114 /* anything unattached is a recipient */ 115 owl_list_append_element(&(z->recips), strdup(myargv[0]));115 owl_list_append_element(&(z->recips), owl_get_iso_8859_1_if_possible(myargv[0])); 116 116 myargv++; 117 117 myargc--; … … 146 146 147 147 if (zsigowlvar && *zsigowlvar) { 148 z->zsig=owl_ strdup(zsigowlvar);148 z->zsig=owl_get_iso_8859_1_if_possible(zsigowlvar); 149 149 } else if (zsigproc && *zsigproc) { 150 150 FILE *file; … … 161 161 if (!file) { 162 162 if (zsigzvar && *zsigzvar) { 163 z->zsig=owl_ strdup(zsigzvar);163 z->zsig=owl_get_iso_8859_1_if_possible(zsigzvar); 164 164 } 165 165 } else { … … 175 175 } 176 176 } else if (zsigzvar) { 177 z->zsig=owl_ strdup(zsigzvar);177 z->zsig=owl_get_iso_8859_1_if_possible(zsigzvar); 178 178 } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) { 179 z->zsig= strdup(pw->pw_gecos);179 z->zsig=owl_get_iso_8859_1_if_possible(pw->pw_gecos); 180 180 ptr=strchr(z->zsig, ','); 181 181 if (ptr) { … … 218 218 int i, j; 219 219 char toline[LINE]; 220 char *tmp = NULL; 220 221 221 222 if (z->message) owl_free(z->message); … … 231 232 } 232 233 } 233 z->message=owl_sprintf("%s\n%s", toline, msg); 234 tmp = owl_get_iso_8859_1_if_possible(msg); 235 z->message=owl_sprintf("%s\n%s", toline, tmp); 234 236 } else { 235 z->message=owl_strdup(msg); 236 } 237 z->message=owl_get_iso_8859_1_if_possible(msg); 238 } 239 if (tmp) owl_free(tmp); 237 240 } 238 241 … … 305 308 { 306 309 if (z->opcode) owl_free(z->opcode); 307 z->opcode=owl_ strdup(opcode);310 z->opcode=owl_get_iso_8859_1_if_possible(opcode); 308 311 } 309 312
Note: See TracChangeset
for help on using the changeset viewer.