Changes in / [dcc3f80:32ad44d]
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r1703f72 r42ad917 4 4 *~ 5 5 .#* 6 .*.swp7 6 .deps 8 7 META.yml -
Makefile.am
rb373d44 r42ad917 20 20 perl_tester_SOURCES = $(BASE_SRCS) \ 21 21 owl.h owl_perl.h config.h \ 22 libzcrypt.a \ 22 23 $(GEN_C) $(GEN_H) \ 23 24 perl_tester.c 24 25 25 perl_tester_LDADD = libfaim/libfaim.a 26 perl_tester_LDADD = libfaim/libfaim.a libzcrypt.a 26 27 27 28 TESTS=runtests.sh … … 42 43 GEN_H = owl_prototypes.h 43 44 44 TYPEMAP = typemap45 46 45 BUILT_SOURCES = $(GEN_C) $(GEN_H) 47 46 … … 55 54 proto: owl_prototypes.h 56 55 57 perlglue.c: perlglue.xs $(TYPEMAP)58 $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs -typemap $(TYPEMAP)> perlglue.c56 perlglue.c: perlglue.xs 57 $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c 59 58 60 59 varstubs.c: stubgen.pl variable.c -
aim.c
r1fdca1b rc79a047 249 249 } 250 250 251 /* 252 * I got these constants by skimming libfaim/im.c 253 * 254 * "UNICODE" actually means "UCS-2BE". 255 */ 256 #define AIM_CHARSET_ISO_8859_1 0x0003 257 #define AIM_CHARSET_UNICODE 0x0002 258 259 int owl_aim_do_send(const char *to, const char *msg, int flags) /* noproto */ 251 int owl_aim_send_im(const char *to, const char *msg) 260 252 { 261 253 int ret; 262 char *encoded; 263 struct aim_sendimext_args args; 264 gsize len; 265 266 encoded = g_convert(msg, -1, "ISO-8859-1", "UTF-8", NULL, &len, NULL); 267 if (encoded) { 268 owl_function_debugmsg("Encoded outgoing AIM as ISO-8859-1"); 269 args.charset = AIM_CHARSET_ISO_8859_1; 270 args.charsubset = 0; 271 args.flags = AIM_IMFLAGS_ISO_8859_1; 272 } else { 273 owl_function_debugmsg("Encoding outgoing IM as UCS-2BE"); 274 encoded = g_convert(msg, -1, "UCS-2BE", "UTF-8", NULL, &len, NULL); 275 if (!encoded) { 276 /* 277 * TODO: Strip or HTML-encode characters, or figure out how to 278 * send in a differen charset. 279 */ 280 owl_function_error("Unable to encode outgoing AIM message in UCS-2"); 281 return 1; 282 } 283 284 args.charset = AIM_CHARSET_UNICODE; 285 args.charsubset = 0; 286 args.flags = AIM_IMFLAGS_UNICODE; 287 } 288 289 args.destsn = to; 290 args.msg = encoded; 291 args.msglen = len; 292 args.flags |= flags; 293 294 ret=aim_im_sendch1_ext(owl_global_get_aimsess(&g), &args); 295 296 owl_free(encoded); 297 254 255 ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, 0, msg); 256 257 /* I don't know how to check for an error yet */ 298 258 return(ret); 299 259 } 300 260 301 int owl_aim_send_im(const char *to, const char *msg)302 {303 return owl_aim_do_send(to, msg, 0);304 }305 306 261 int owl_aim_send_awaymsg(const char *to, const char *msg) 307 262 { 308 return owl_aim_do_send(to, msg, AIM_IMFLAGS_AWAY); 263 int ret; 264 265 ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, AIM_IMFLAGS_AWAY, msg); 266 267 /* I don't know how to check for an error yet */ 268 return(ret); 309 269 } 310 270 … … 1189 1149 owl_message *m; 1190 1150 char *stripmsg, *nz_screenname, *wrapmsg; 1191 char *realmsg = NULL; 1192 1193 if (!args->msg) { 1194 realmsg = owl_strdup(""); 1195 } else if (args->icbmflags & AIM_IMFLAGS_UNICODE) { 1196 realmsg = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", 1197 NULL, NULL, NULL); 1198 } else if(args->icbmflags & AIM_IMFLAGS_ISO_8859_1) { 1199 realmsg = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", 1200 NULL, NULL, NULL); 1151 char realmsg[8192+1] = ""; 1152 /* int clienttype = AIM_CLIENTTYPE_UNKNOWN; */ 1153 1154 /* clienttype = aim_fingerprintclient(args->features, args->featureslen); */ 1155 1156 /* 1157 printf("icbm: sn = \"%s\"\n", userinfo->sn); 1158 printf("icbm: probable client type: %d\n", clienttype); 1159 printf("icbm: warnlevel = %f\n", aim_userinfo_warnlevel(userinfo)); 1160 printf("icbm: flags = 0x%04x = ", userinfo->flags); 1161 printuserflags(userinfo->flags); 1162 printf("\n"); 1163 */ 1164 1165 /* 1166 printf("icbm: membersince = %lu\n", userinfo->membersince); 1167 printf("icbm: onlinesince = %lu\n", userinfo->onlinesince); 1168 printf("icbm: idletime = 0x%04x\n", userinfo->idletime); 1169 printf("icbm: capabilities = %s = 0x%08lx\n", (userinfo->present & AIM_USERINFO_PRESENT_CAPABILITIES) ? "present" : "not present", userinfo->capabilities); 1170 */ 1171 1172 /* 1173 printf("icbm: icbmflags = "); 1174 if (args->icbmflags & AIM_IMFLAGS_AWAY) printf("away "); 1175 if (args->icbmflags & AIM_IMFLAGS_ACK) printf("ackrequest "); 1176 if (args->icbmflags & AIM_IMFLAGS_OFFLINE) printf("offline "); 1177 if (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) printf("buddyreq "); 1178 if (args->icbmflags & AIM_IMFLAGS_HASICON) printf("hasicon "); 1179 printf("\n"); 1180 */ 1181 1182 /* 1183 if (args->icbmflags & AIM_IMFLAGS_CUSTOMCHARSET) { 1184 printf("icbm: encoding flags = {%04x, %04x}\n", args->charset, args->charsubset); 1185 } 1186 */ 1187 1188 /* 1189 * Quickly convert it to eight bit format, replacing non-ASCII UNICODE 1190 * characters with their equivelent HTML entity. 1191 */ 1192 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { 1193 int i; 1194 1195 for (i=0; i<args->msglen; i+=2) { 1196 fu16_t uni; 1197 1198 uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff); 1199 if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */ 1200 snprintf(realmsg+strlen(realmsg), sizeof(realmsg)-strlen(realmsg), "%c", uni); 1201 } else { /* something else, do UNICODE entity */ 1202 snprintf(realmsg+strlen(realmsg), sizeof(realmsg)-strlen(realmsg), "&#%04x;", uni); 1203 } 1204 } 1201 1205 } else { 1202 realmsg = owl_strdup(args->msg); 1203 } 1204 1205 if (!realmsg) { 1206 realmsg = owl_strdup("[Error decoding incoming IM]"); 1206 /* 1207 * For non-UNICODE encodings (ASCII and ISO 8859-1), there is 1208 * no need to do anything special here. Most 1209 * terminals/whatever will be able to display such characters 1210 * unmodified. 1211 * 1212 * Beware that PC-ASCII 128 through 159 are _not_ actually 1213 * defined in ASCII or ISO 8859-1, and you should send them as 1214 * UNICODE. WinAIM will send these characters in a UNICODE 1215 * message, so you need to do so as well. 1216 * 1217 * You may not think it necessary to handle UNICODE messages. 1218 * You're probably wrong. For one thing, Microsoft "Smart 1219 * Quotes" will be sent by WinAIM as UNICODE (not HTML UNICODE, 1220 * but real UNICODE). If you don't parse UNICODE at all, your 1221 * users will get a blank message instead of the message 1222 * containing Smart Quotes. 1223 * 1224 */ 1225 if (args->msg && args->msglen) 1226 strncpy(realmsg, args->msg, sizeof(realmsg)); 1207 1227 } 1208 1228 … … 1249 1269 } 1250 1270 1251 owl_free(realmsg); 1252 1271 /* 1272 if (realmsg) { 1273 int i = 0; 1274 while (realmsg[i] == '<') { 1275 if (realmsg[i] == '<') { 1276 while (realmsg[i] != '>') 1277 i++; 1278 i++; 1279 } 1280 } 1281 tmpstr = realmsg+i; 1282 faimtest_handlecmd(sess, conn, userinfo, tmpstr); 1283 } 1284 */ 1285 1253 1286 return(1); 1254 1287 } -
commands.c
r5ade618 r61de085 861 861 OWLCMD_VOID_CTX("edit:history-next", owl_command_edit_history_next, 862 862 OWL_CTX_EDIT, 863 "replaces the text with the nexthistory",863 "replaces the text with the previous history", 864 864 "", ""), 865 865 -
editwin.c
r6c171f1 r2184001 326 326 static void oe_release_excursion(owl_editwin *e, oe_excursion *x) 327 327 { 328 oe_excursion * *px;328 oe_excursion *p; 329 329 330 330 x->valid = 0; 331 for (px = &e->excursions; *px != NULL; px = &(*px)->next) 332 if (*px == x) { 333 *px = x->next; 334 return; 335 } 336 abort(); 331 if (e->excursions == NULL) 332 /* XXX huh. */ ; 333 else if (e->excursions == x) 334 e->excursions = x->next; 335 else { 336 for (p = e->excursions; p->next != NULL; p = p->next) 337 if (p->next == x) { 338 p->next = p->next->next; 339 break; 340 } 341 /* and if we ran off the end? XXX */ 342 } 337 343 } 338 344 … … 1252 1258 1253 1259 if (!g_unichar_iscntrl(c) || c == '\n' || c== '\t' ) { 1260 memset(tmp, 0, 7); 1261 1254 1262 if (c == '\n' && e->style == OWL_EDITWIN_STYLE_ONELINE) { 1255 1263 return; … … 1294 1302 return; /* our work here is done */ 1295 1303 1296 tmp[g_unichar_to_utf8(c, tmp)] = '\0';1304 g_unichar_to_utf8(c, tmp); 1297 1305 owl_editwin_replace(e, 0, tmp); 1298 1306 } -
fmtext.c
r6c171f1 rf119757 57 57 58 58 /* Set attributes */ 59 if (a) 60 strncat(f->textbuff, attrbuff, 61 g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff)); 62 if (fg) 63 strncat(f->textbuff, attrbuff, 64 g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff)); 65 if (bg) 66 strncat(f->textbuff, attrbuff, 67 g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff)); 59 if (a) { 60 memset(attrbuff,0,6); 61 g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff); 62 strcat(f->textbuff, attrbuff); 63 } 64 if (fg) { 65 memset(attrbuff,0,6); 66 g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff); 67 strcat(f->textbuff, attrbuff); 68 } 69 if (bg) { 70 memset(attrbuff,0,6); 71 g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff); 72 strcat(f->textbuff, attrbuff); 73 } 68 74 69 75 strcat(f->textbuff, text); … … 196 202 _owl_fmtext_realloc(f, newlen); 197 203 198 if (a) 199 strncat(f->textbuff, attrbuff, 200 g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff)); 201 if (fg) 202 strncat(f->textbuff, attrbuff, 203 g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff)); 204 if (bg) 205 strncat(f->textbuff, attrbuff, 206 g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff)); 204 if (a) { 205 memset(attrbuff,0,6); 206 g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff); 207 strcat(f->textbuff, attrbuff); 208 } 209 if (fg) { 210 memset(attrbuff,0,6); 211 g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff); 212 strcat(f->textbuff, attrbuff); 213 } 214 if (bg) { 215 memset(attrbuff,0,6); 216 g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff); 217 strcat(f->textbuff, attrbuff); 218 } 207 219 208 220 strncat(f->textbuff, in->textbuff+start, stop-start+1); … … 303 315 int start, end; 304 316 while (owl_regex_compare(owl_global_get_search_re(&g), s, &start, &end) == 0) { 305 /* Prevent an infinite loop matching the empty string. */306 if (end == 0)307 break;308 309 317 /* Found search string, highlight it. */ 310 318 -
functions.c
rdca3b27 r340c3e7 1941 1941 { 1942 1942 owl_fmtext fm; 1943 char *ptr; 1944 char *result; 1943 char *ptr, buff[LINE]; 1945 1944 int i; 1946 1945 … … 1948 1947 1949 1948 for (i=0; i<argc; i++) { 1950 ptr = long_zuser(argv[i]); 1951 result = owl_zephyr_zlocate(ptr, auth); 1952 owl_fmtext_append_normal(&fm, result); 1953 owl_free(result); 1949 ptr=long_zuser(argv[i]); 1950 owl_zephyr_zlocate(ptr, buff, auth); 1951 owl_fmtext_append_normal(&fm, buff); 1954 1952 owl_free(ptr); 1955 1953 } -
perl/lib/BarnOwl.pm
r77c87b2 rdf569c5 436 436 sub default_zephyr_signature 437 437 { 438 my $zsig = getvar('zsig'); 439 if (!$zsig && (my $zsigproc = getvar('zsigproc'))) { 440 $zsig = `$zsigproc`; 441 } elsif (!defined($zsig = get_zephyr_variable('zwrite-signature'))) { 442 $zsig = ((getpwuid($<))[6]); 443 $zsig =~ s/,.*//; 438 if (my $zsig = getvar('zsig')) { 439 return $zsig; 444 440 } 445 chomp($zsig); 446 return $zsig; 441 if (my $zsigproc = getvar('zsigproc')) { 442 return `$zsigproc`; 443 } 444 my $zwrite_signature = get_zephyr_variable('zwrite-signature'); 445 if (defined($zwrite_signature)) { 446 return $zwrite_signature; 447 } 448 my $name = ((getpwuid($<))[6]); 449 $name =~ s/,.*//; 450 return $name; 447 451 } 448 452 -
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r0c4a190 r744769e 399 399 $body =~ tr/\n\r/ /; 400 400 if ($body =~ /^\/me (.*)/) { 401 $conn->conn->me($to, Encode::encode('utf-8', $1));401 $conn->conn->me($to, $1); 402 402 $body = '* '.$conn->nick.' '.$1; 403 403 } else { 404 $conn->conn->privmsg($to, Encode::encode('utf-8', $body));404 $conn->conn->privmsg($to, $body); 405 405 } 406 406 my $msg = BarnOwl::Message->new( … … 545 545 $conn = get_connection_by_alias($alias); 546 546 } 547 if( $use_channel) {547 if(!$conn && $use_channel) { 548 548 $channel = $ARGV[0]; 549 549 if(defined($channel) && $channel =~ /^#/) { 550 550 if($channels{$channel} && @{$channels{$channel}} == 1) { 551 551 shift @ARGV; 552 $conn = $channels{$channel}[0] unless $conn; 552 $conn = $channels{$channel}[0]; 553 } 554 } else { 555 if($m && $m->type eq 'IRC' && !$m->is_private) { 556 $channel = $m->channel; 557 } else { 558 undef $channel; 553 559 } 554 } elsif ($m && $m->type eq 'IRC' && !$m->is_private) {555 $channel = $m->channel;556 } else {557 undef $channel;558 560 } 559 561 } 560 561 562 if(!$channel && $use_channel == REQUIRE_CHANNEL) { 562 563 die("Usage: $cmd <channel>\n"); -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r7cfb1df r744769e 74 74 $self->conn->add_handler(endofwhois=> sub { shift; $self->on_endofwhois(@_) }); 75 75 $self->conn->add_handler(mode => sub { shift; $self->on_mode(@_) }); 76 $self->conn->add_handler(nosuchchannel => sub { shift; $self->on_nosuchchannel(@_) }); 76 77 # * nosuchchannel 78 # * 77 79 78 80 return $self; … … 202 204 my $self = shift; 203 205 delete $BarnOwl::Module::IRC::ircnets{$self->alias}; 204 for my $k (keys %BarnOwl::Module::IRC::channels) {205 my @conns = grep {$_ ne $self} @{$BarnOwl::Module::IRC::channels{$k}};206 if(@conns) {207 $BarnOwl::Module::IRC::channels{$k} = \@conns;208 } else {209 delete $BarnOwl::Module::IRC::channels{$k};210 }211 }212 206 BarnOwl::remove_dispatch($self->{FD}); 213 207 BarnOwl::admin_message('IRC', … … 288 282 join(" ", $evt->args) . "on " . $evt->to->[0] 289 283 ); 290 }291 292 sub on_nosuchchannel {293 my ($self, $evt) = @_;294 BarnOwl::admin_message("IRC",295 "[" . $self->alias . "] " .296 "No such channel: " . [$evt->args]->[1])297 284 } 298 285 -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r26cde20 r5118b32 321 321 . "add <jid> Adds <jid> to your roster.\n\n" 322 322 . "unsub <jid> Unsubscribe from <jid>'s presence.\n\n" 323 . "remove <jid> Removes <jid> fromyour roster. (implicit unsub)\n\n"323 . "remove <jid> Removes <jid> to your roster. (implicit unsub)\n\n" 324 324 . "auth <jid> Authorizes <jid> to subscribe to your presence.\n\n" 325 325 . "deauth <jid> De-authorizes <jid>'s subscription to your presence.\n\n" -
perl_tester.c
r737b8f1 r42ad917 32 32 perl_free(my_perl); 33 33 PERL_SYS_TERM(); 34 return 0;35 34 } 36 35 -
perlglue.xs
r5791bf7 r6f0fbe9 9 9 10 10 #define SV_IS_CODEREF(sv) (SvROK((sv)) && SvTYPE(SvRV((sv))) == SVt_PVCV) 11 12 typedef char utf8;13 11 14 12 /************************************************************* … … 31 29 MODULE = BarnOwl PACKAGE = BarnOwl 32 30 33 const utf8*31 const char * 34 32 command(cmd, ...) 35 33 const char *cmd … … 79 77 RETVAL 80 78 81 const utf8*79 const char * 82 80 zephyr_getrealm() 83 81 CODE: … … 86 84 RETVAL 87 85 88 const utf8*86 const char * 89 87 zephyr_getsender() 90 88 CODE: … … 102 100 i = owl_zwrite_create_and_send_from_line(cmd, msg); 103 101 104 const utf8*102 const char * 105 103 ztext_stylestrip(ztext) 106 104 const char *ztext … … 115 113 if (rv) owl_free(rv); 116 114 117 const utf8*115 const char * 118 116 zephyr_smartstrip_user(in) 119 117 const char *in … … 130 128 owl_free(rv); 131 129 132 const utf8*130 const char * 133 131 zephyr_getsubs() 134 132 PREINIT: … … 142 140 if (rv) owl_free(rv); 143 141 144 void 145 queue_message(msg) 142 void queue_message(msg) 146 143 SV *msg 147 144 PREINIT: … … 158 155 } 159 156 160 void 161 admin_message(header, body) 157 void admin_message(header, body) 162 158 const char *header 163 159 const char *body … … 167 163 } 168 164 169 void 170 start_question(line, callback) 165 void start_question(line, callback) 171 166 const char *line 172 167 SV *callback … … 183 178 } 184 179 185 void 186 start_password(line, callback) 180 void start_password(line, callback) 187 181 const char *line 188 182 SV *callback … … 199 193 } 200 194 201 void 202 start_edit_win(line, callback) 195 void start_edit_win(line, callback) 203 196 const char *line 204 197 SV *callback … … 316 309 } 317 310 318 const utf8*311 const char * 319 312 wordwrap(in, cols) 320 313 const char *in … … 328 321 RETVAL 329 322 CLEANUP: 330 if (rv) 331 owl_free(rv); 323 if (rv) owl_free(rv); 332 324 333 325 void … … 432 424 RETVAL 433 425 434 const utf8*426 const char * 435 427 skiptokens(str, n) 436 428 const char *str; … … 580 572 RETVAL 581 573 582 const utf8*574 const char * 583 575 get_region() 584 576 PREINIT: -
zephyr.c
rdca3b27 r32ad44d 912 912 #endif 913 913 914 char *owl_zephyr_zlocate(const char *user, int auth)914 void owl_zephyr_zlocate(const char *user, char *out, int auth) 915 915 { 916 916 #ifdef HAVE_LIBZEPHYR … … 919 919 ZLocations_t locations; 920 920 char *myuser; 921 char *p, *result;922 921 922 strcpy(out, ""); 923 923 ZResetAuthentication(); 924 ret = ZLocateUser(zstr(user), &numlocs, auth ? ZAUTH : ZNOAUTH); 925 if (ret != ZERR_NONE) 926 return owl_sprintf("Error locating user %s: %s\n", 927 user, error_message(ret)); 928 929 myuser = short_zuser(user); 930 if (numlocs == 0) { 931 result = owl_sprintf("%s: Hidden or not logged in\n", myuser); 932 } else { 933 result = owl_strdup(""); 934 for (; numlocs; numlocs--) { 935 ZGetLocations(&locations, &one); 936 p = owl_sprintf("%s%s: %s\t%s\t%s\n", 937 result, myuser, 938 locations.host ? locations.host : "?", 939 locations.tty ? locations.tty : "?", 940 locations.time ? locations.time : "?"); 941 owl_free(result); 942 result = p; 943 } 944 } 945 946 return result; 947 #else 948 return owl_strdup(""); 924 ret=ZLocateUser(zstr(user),&numlocs,auth?ZAUTH:ZNOAUTH); 925 if (ret != ZERR_NONE) { 926 sprintf(out, "Error locating user %s\n", user); 927 return; 928 } 929 930 if (numlocs==0) { 931 myuser=short_zuser(user); 932 sprintf(out, "%s: Hidden or not logged in\n", myuser); 933 owl_free(myuser); 934 return; 935 } 936 937 for (;numlocs;numlocs--) { 938 ZGetLocations(&locations,&one); 939 myuser=short_zuser(user); 940 sprintf(out + strlen(out), "%s: %s\t%s\t%s\n", myuser, 941 locations.host ? locations.host : "?", 942 locations.tty ? locations.tty : "?", 943 locations.time ? locations.time : "?"); 944 owl_free(myuser); 945 } 949 946 #endif 950 947 }
Note: See TracChangeset
for help on using the changeset viewer.