Changeset 37eab7f
- Timestamp:
- Oct 25, 2003, 11:53:43 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- eec69e1
- Parents:
- 8c92848
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r8c92848 r37eab7f 6 6 More AIM logout detection 7 7 Don't proclaim "interfaces changed" on first build. 8 Added the 'loopback' message type 9 Added the 'loopwrite' command 8 10 9 11 2.0.10 -
commands.c
r8c92848 r37eab7f 134 134 "aimzwrite <user>", 135 135 "Send an aim message to a user.\n"), 136 137 OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE, 138 "send a loopback message", 139 "loopwrite", 140 "Send a local message.\n"), 136 141 137 142 OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE, … … 1725 1730 owl_function_aimwrite_setup(newbuff); 1726 1731 owl_free(newbuff); 1732 return(NULL); 1733 } 1734 1735 char *owl_command_loopwrite(int argc, char **argv, char *buff) 1736 { 1737 owl_function_loopwrite_setup(); 1727 1738 return(NULL); 1728 1739 } -
filter.c
r49d467c r37eab7f 162 162 match=owl_message_get_realm(m); 163 163 } else if (!strcasecmp(field, "type")) { 164 match=owl_message_ type_to_string(m);164 match=owl_message_get_type(m); 165 165 } else if (!strcasecmp(field, "hostname")) { 166 166 match=owl_message_get_hostname(m); -
functions.c
r8c92848 r37eab7f 208 208 } 209 209 210 int owl_function_make_outgoing_loopback(char *body) 211 { 212 owl_message *m; 213 int followlast; 214 215 followlast=owl_global_should_followlast(&g); 216 217 /* create the message */ 218 m=owl_malloc(sizeof(owl_message)); 219 owl_message_create_loopback(m, body); 220 owl_message_set_direction_out(m); 221 222 /* add it to the global list and current view */ 223 owl_messagelist_append_element(owl_global_get_msglist(&g), m); 224 owl_view_consider_message(owl_global_get_current_view(&g), m); 225 226 if (followlast) owl_function_lastmsg_noredisplay(); 227 228 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 229 if (owl_popwin_is_active(owl_global_get_popwin(&g))) { 230 owl_popwin_refresh(owl_global_get_popwin(&g)); 231 } 232 233 wnoutrefresh(owl_global_get_curs_recwin(&g)); 234 owl_global_set_needrefresh(&g); 235 return(0); 236 } 237 210 238 void owl_function_zwrite_setup(char *line) 211 239 { … … 280 308 281 309 owl_global_set_buffercommand(&g, line); 310 } 311 312 void owl_function_loopwrite_setup() 313 { 314 owl_editwin *e; 315 316 /* create and setup the editwin */ 317 e=owl_global_get_typwin(&g); 318 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, owl_global_get_msg_history(&g)); 319 320 if (!owl_global_get_lockout_ctrld(&g)) { 321 owl_function_makemsg("Type your message below. End with ^D or a dot on a line by itself. ^C will quit."); 322 } else { 323 owl_function_makemsg("Type your message below. End with a dot on a line by itself. ^C will quit."); 324 } 325 326 owl_editwin_clear(e); 327 owl_editwin_set_dotsend(e); 328 owl_editwin_set_locktext(e, "----> loopwrite\n"); 329 330 /* make it active */ 331 owl_global_set_typwin_active(&g); 332 333 owl_global_set_buffercommand(&g, "loopwrite"); 282 334 } 283 335 … … 397 449 if (owl_global_is_logging(&g)) { 398 450 owl_log_outgoing_aim(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 451 } 452 } 453 454 void owl_function_loopwrite() 455 { 456 owl_message *m; 457 458 /* create a message and put it on the message queue. This simulates 459 * an incoming message */ 460 m=owl_malloc(sizeof(owl_message)); 461 owl_message_create_loopback(m, owl_editwin_get_text(owl_global_get_typwin(&g))); 462 owl_message_set_direction_out(m); 463 owl_global_messagequeue_addmsg(&g, m); 464 465 /* display the message as an outgoing message in the receive window */ 466 if (owl_global_is_displayoutgoing(&g)) { 467 owl_function_make_outgoing_loopback(owl_editwin_get_text(owl_global_get_typwin(&g))); 468 } 469 470 /* fake a makemsg */ 471 owl_function_makemsg("loopback message sent"); 472 473 /* log it if we have logging turned on */ 474 if (owl_global_is_logging(&g)) { 475 owl_log_outgoing_loopback(owl_editwin_get_text(owl_global_get_typwin(&g))); 399 476 } 400 477 } … … 1079 1156 } else if (!strncmp(buff, "aimwrite ", 9)) { 1080 1157 owl_function_aimwrite(buff+9); 1158 } else if (!strncmp(buff, "loopwrite", 9) || !strncmp(buff, "loopwrite ", 10)) { 1159 owl_function_loopwrite(); 1081 1160 } else if (!strncmp(buff, "aimlogin ", 9)) { 1082 1161 ptr=owl_sprintf("%s %s", buff, owl_global_get_response(&g)); 1083 1162 owl_function_command(ptr); 1084 1163 owl_free(ptr); 1164 } else { 1165 owl_function_error("Internal error: invalid buffercommand %s", buff); 1085 1166 } 1086 1167 } … … 1282 1363 1283 1364 owl_fmtext_append_normal(&fm, " Type : "); 1284 owl_fmtext_append_bold(&fm, owl_message_ type_to_string(m));1365 owl_fmtext_append_bold(&fm, owl_message_get_type(m)); 1285 1366 owl_fmtext_append_normal(&fm, "\n"); 1286 1367 … … 1946 2027 owl_context_set_editline(owl_global_get_context(&g), tw); 1947 2028 owl_function_activate_keymap("editline"); 1948 1949 2029 } 1950 2030 -
logging.c
r15283bb r37eab7f 55 55 } 56 56 57 void owl_log_outgoing_aim(char *to, char *text) { 57 void owl_log_outgoing_aim(char *to, char *text) 58 { 58 59 FILE *file; 59 60 char filename[MAXPATHLEN], *logpath; … … 61 62 62 63 tobuff=owl_sprintf("aim:%s", to); 64 65 /* expand ~ in path names */ 66 logpath = owl_util_substitute(owl_global_get_logpath(&g), "~", 67 owl_global_get_homedir(&g)); 68 69 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); 70 file=fopen(filename, "a"); 71 if (!file) { 72 owl_function_error("Unable to open file for outgoing logging"); 73 owl_free(logpath); 74 return; 75 } 76 fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); 77 if (text[strlen(text)-1]!='\n') { 78 fprintf(file, "\n"); 79 } 80 fclose(file); 81 82 snprintf(filename, MAXPATHLEN, "%s/all", logpath); 83 owl_free(logpath); 84 file=fopen(filename, "a"); 85 if (!file) { 86 owl_function_error("Unable to open file for outgoing logging"); 87 return; 88 } 89 fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); 90 if (text[strlen(text)-1]!='\n') { 91 fprintf(file, "\n"); 92 } 93 fclose(file); 94 95 owl_free(tobuff); 96 } 97 98 void owl_log_outgoing_loopback(char *text) 99 { 100 FILE *file; 101 char filename[MAXPATHLEN], *logpath; 102 char *tobuff; 103 104 tobuff=owl_sprintf("loopback:%s", "loppback"); 63 105 64 106 /* expand ~ in path names */ … … 142 184 /* we do not yet handle chat rooms */ 143 185 from=frombuff=owl_sprintf("aim:%s", owl_message_get_sender(m)); 186 } else if (owl_message_is_type_loopback(m)) { 187 from=frombuff=owl_strdup("loopback"); 144 188 } else { 145 189 from=frombuff=owl_strdup("unknown"); … … 220 264 if (owl_message_is_login(m)) fprintf(file, "LOGIN\n\n"); 221 265 if (owl_message_is_logout(m)) fprintf(file, "LOGOUT\n\n"); 222 } 266 } else { 267 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 268 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); 269 fprintf(file, "%s\n\n", owl_message_get_body(m)); 270 } 271 223 272 fclose(file); 224 273 … … 245 294 if (owl_message_is_login(m)) fprintf(allfile, "LOGIN\n\n"); 246 295 if (owl_message_is_logout(m)) fprintf(allfile, "LOGOUT\n\n"); 296 } else { 297 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 298 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); 299 fprintf(file, "%s\n\n", owl_message_get_body(m)); 247 300 } 248 301 fclose(allfile); -
mainwin.c
rf2f9314 r37eab7f 3 3 static const char fileIdent[] = "$Id$"; 4 4 5 void owl_mainwin_init(owl_mainwin *mw) { 5 void owl_mainwin_init(owl_mainwin *mw) 6 { 6 7 mw->curtruncated=0; 7 8 mw->lastdisplayed=-1; 8 9 } 9 10 10 void owl_mainwin_redisplay(owl_mainwin *mw) { 11 void owl_mainwin_redisplay(owl_mainwin *mw) 12 { 11 13 owl_message *m; 12 14 int i, p, q, lines, isfull, viewsize; … … 136 138 137 139 138 int owl_mainwin_is_curmsg_truncated(owl_mainwin *mw) { 140 int owl_mainwin_is_curmsg_truncated(owl_mainwin *mw) 141 { 139 142 if (mw->curtruncated) return(1); 140 143 return(0); 141 144 } 142 145 143 int owl_mainwin_is_last_msg_truncated(owl_mainwin *mw) { 146 int owl_mainwin_is_last_msg_truncated(owl_mainwin *mw) 147 { 144 148 if (mw->lasttruncated) return(1); 145 149 return(0); 146 150 } 147 151 148 int owl_mainwin_get_last_msg(owl_mainwin *mw) { 152 int owl_mainwin_get_last_msg(owl_mainwin *mw) 153 { 149 154 /* return the number of the last message displayed. -1 if none */ 150 155 return(mw->lastdisplayed); -
message.c
rf4d0975 r37eab7f 313 313 } 314 314 315 void owl_message_set_type_loopback(owl_message *m) 316 { 317 m->type=OWL_MESSAGE_TYPE_LOOPBACK; 318 } 319 315 320 void owl_message_set_type_zephyr(owl_message *m) 316 321 { … … 329 334 } 330 335 336 int owl_message_is_type_loopback(owl_message *m) 337 { 338 if (m->type==OWL_MESSAGE_TYPE_LOOPBACK) return(1); 339 return(0); 340 } 341 331 342 int owl_message_is_type_zephyr(owl_message *m) 332 343 { … … 345 356 if (m->type==OWL_MESSAGE_TYPE_GENERIC) return(1); 346 357 return(0); 347 }348 349 char *owl_message_type_to_string(owl_message *m)350 {351 if (m->type==OWL_MESSAGE_TYPE_ADMIN) return("admin");352 if (m->type==OWL_MESSAGE_TYPE_GENERIC) return("generic");353 if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) return("zephyr");354 if (m->type==OWL_MESSAGE_TYPE_AIM) return("aim");355 if (m->type==OWL_MESSAGE_TYPE_JABBER) return("jabber");356 if (m->type==OWL_MESSAGE_TYPE_ICQ) return("icq");357 if (m->type==OWL_MESSAGE_TYPE_MSN) return("msn");358 return("unknown");359 358 } 360 359 … … 449 448 return(m->hostname); 450 449 } 451 452 450 453 451 void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color) … … 597 595 case OWL_MESSAGE_TYPE_MSN: 598 596 return("msn"); 597 case OWL_MESSAGE_TYPE_LOOPBACK: 598 return("loopback"); 599 599 default: 600 600 return("unknown"); … … 677 677 owl_message_set_body(m, text); 678 678 owl_message_set_attribute(m, "adminheader", header); /* just a hack for now */ 679 } 680 681 /* caller should set the direction */ 682 void owl_message_create_loopback(owl_message *m, char *text) 683 { 684 owl_message_init(m); 685 owl_message_set_type_loopback(m); 686 owl_message_set_body(m, text); 687 owl_message_set_sender(m, "loopback-sender"); 688 owl_message_set_recipient(m, "loopback-recipient"); 689 owl_message_set_isprivate(m); 679 690 } 680 691 … … 817 828 } 818 829 819 820 830 void owl_message_pretty_zsig(owl_message *m, char *buff) 821 831 { -
owl.h
r15283bb r37eab7f 65 65 #define OWL_MESSAGE_TYPE_YAHOO 6 66 66 #define OWL_MESSAGE_TYPE_MSN 7 67 #define OWL_MESSAGE_TYPE_LOOPBACK 8 67 68 68 69 #define OWL_MESSAGE_DIRECTION_NONE 0 -
stylefunc.c
rec6ff52 r37eab7f 199 199 200 200 owl_free(indent); 201 } else { 202 char *text, *header, *indent; 203 204 text=owl_message_get_body(m); 205 header=owl_sprintf("%s from: %s to: %s", 206 owl_message_get_type(m), 207 owl_message_get_sender(m), 208 owl_message_get_recipient(m)); 209 210 indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); 211 owl_text_indent(indent, text, OWL_MSGTAB); 212 owl_fmtext_append_normal(fm, OWL_TABSTR); 213 owl_fmtext_append_normal(fm, header); 214 owl_fmtext_append_normal(fm, "\n"); 215 owl_fmtext_append_normal(fm, indent); 216 if (text[strlen(text)-1]!='\n') { 217 owl_fmtext_append_normal(fm, "\n"); 218 } 219 220 owl_free(indent); 221 owl_free(header); 201 222 } 202 223 } … … 395 416 396 417 owl_free(indent); 418 } else { 419 char *text, *header, *indent; 420 421 text=owl_message_get_body(m); 422 header=owl_sprintf("%s from: %s to: %s", 423 owl_message_get_type(m), 424 owl_message_get_sender(m), 425 owl_message_get_recipient(m)); 426 427 indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); 428 owl_text_indent(indent, text, OWL_MSGTAB); 429 owl_fmtext_append_normal(fm, OWL_TABSTR); 430 owl_fmtext_append_normal(fm, header); 431 owl_fmtext_append_normal(fm, "\n"); 432 owl_fmtext_append_normal(fm, indent); 433 if (text[strlen(text)-1]!='\n') { 434 owl_fmtext_append_normal(fm, "\n"); 435 } 436 437 owl_free(indent); 438 owl_free(header); 397 439 } 398 440 } … … 526 568 owl_fmtext_append_normal(fm, "\n"); 527 569 if (tmp) owl_free(tmp); 528 } 570 } else { 571 owl_fmtext_append_spaces(fm, OWL_TAB); 572 owl_fmtext_append_normal(fm, "< LOOPBACK "); 573 574 tmp=owl_strdup(owl_message_get_body(m)); 575 owl_util_tr(tmp, '\n', ' '); 576 owl_fmtext_append_normal(fm, tmp); 577 owl_fmtext_append_normal(fm, "\n"); 578 if (tmp) owl_free(tmp); 579 } 529 580 530 581 } … … 736 787 737 788 owl_free(indent); 789 } else { 790 738 791 } 739 792 }
Note: See TracChangeset
for help on using the changeset viewer.