Changeset aac889a
- Timestamp:
- Jun 5, 2003, 2:53:47 PM (20 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:
- 884c272
- Parents:
- 5789230
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r5789230 raac889a 90 90 improved 'info' function lists seperate info for zephyr, aim and 91 91 also prints all message attributes 92 AIM logging (both in and out) now works 93 Disabled 'addbuddy' and 'delbuddy' for aim since it doesn't work yet 92 94 93 95 1.2.8 -
commands.c
r65ad073 raac889a 892 892 return(NULL); 893 893 } 894 owl_function_makemsg("This function is not yet operational. Stay tuned."); 895 return(NULL); 894 896 owl_aim_addbuddy(argv[2]); 895 897 owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); … … 916 918 return(NULL); 917 919 } 920 owl_function_makemsg("This function is not yet operational. Stay tuned."); 921 return(NULL); 918 922 owl_aim_delbuddy(argv[2]); 919 923 owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); -
functions.c
r5789230 raac889a 296 296 j=owl_zwrite_get_numrecips(&z); 297 297 for (i=0; i<j; i++) { 298 owl_log_outgoing (owl_zwrite_get_recip_n(&z, i),298 owl_log_outgoing_zephyr(owl_zwrite_get_recip_n(&z, i), 299 299 owl_editwin_get_text(owl_global_get_typwin(&g))); 300 300 } … … 317 317 } 318 318 319 /* not yet */320 #if 0321 319 /* log it if we have logging turned on */ 322 320 if (owl_global_is_logging(&g)) { 323 owl_log_outgoing(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 324 } 325 #endif 321 owl_log_outgoing_aim(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 322 } 326 323 } 327 324 -
logging.c
rd09e5a1 raac889a 7 7 static const char fileIdent[] = "$Id$"; 8 8 9 void owl_log_outgoing (char *to, char *text) {9 void owl_log_outgoing_zephyr(char *to, char *text) { 10 10 FILE *file; 11 11 char filename[MAXPATHLEN], *logpath; … … 20 20 *ptr='\0'; 21 21 } 22 23 /* expand ~ in path names */ 24 logpath = owl_util_substitute(owl_global_get_logpath(&g), "~", 25 owl_global_get_homedir(&g)); 26 27 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); 28 file=fopen(filename, "a"); 29 if (!file) { 30 owl_function_makemsg("Unable to open file for outgoing logging"); 31 owl_free(logpath); 32 return; 33 } 34 fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); 35 if (text[strlen(text)-1]!='\n') { 36 fprintf(file, "\n"); 37 } 38 fclose(file); 39 40 snprintf(filename, MAXPATHLEN, "%s/all", logpath); 41 owl_free(logpath); 42 file=fopen(filename, "a"); 43 if (!file) { 44 owl_function_makemsg("Unable to open file for outgoing logging"); 45 return; 46 } 47 fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); 48 if (text[strlen(text)-1]!='\n') { 49 fprintf(file, "\n"); 50 } 51 fclose(file); 52 53 owl_free(tobuff); 54 } 55 56 void owl_log_outgoing_aim(char *to, char *text) { 57 FILE *file; 58 char filename[MAXPATHLEN], *logpath; 59 char *tobuff, *ptr; 60 61 tobuff=owl_sprintf("aim:%s", to); 22 62 23 63 /* expand ~ in path names */ … … 59 99 char *frombuff, *ptr, *from, *buff, *tmp; 60 100 int len, ch, i, personal; 61 62 /* we only do zephyrs right now */63 if (!owl_message_is_type_zephyr(m)) return;64 101 65 102 /* check for nolog */ … … 67 104 !strcasecmp(owl_message_get_instance(m), "nolog")) return; 68 105 69 if (owl_message_is_personal(m)) { 70 personal=1; 71 if (!owl_global_is_logging(&g)) return; 106 /* this is kind of a mess */ 107 if (owl_message_is_type_zephyr(m)) { 108 if (owl_message_is_personal(m)) { 109 personal=1; 110 if (!owl_global_is_logging(&g)) return; 111 } else { 112 personal=0; 113 if (!owl_global_is_classlogging(&g)) return; 114 } 72 115 } else { 73 personal=0; 74 if (!owl_global_is_classlogging(&g)) return; 75 } 76 77 if (personal) { 78 from=frombuff=owl_strdup(owl_message_get_sender(m)); 79 /* chop off a local realm */ 80 ptr=strchr(frombuff, '@'); 81 if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) { 82 *ptr='\0'; 83 } 84 } else { 85 from=frombuff=owl_strdup(owl_message_get_class(m)); 116 if (owl_message_is_private(m)) { 117 personal=1; 118 if (!owl_global_is_logging(&g)) return; 119 } else { 120 personal=0; 121 if (!owl_global_is_classlogging(&g)) return; 122 } 123 } 124 125 if (owl_message_is_type_zephyr(m)) { 126 /* chop off a local realm for personal zephyr messages */ 127 if (personal) { 128 if (owl_message_is_type_zephyr(m)) { 129 from=frombuff=owl_strdup(owl_message_get_sender(m)); 130 ptr=strchr(frombuff, '@'); 131 if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) { 132 *ptr='\0'; 133 } 134 } 135 } else { 136 /* we assume zephyr for now */ 137 from=frombuff=owl_strdup(owl_message_get_class(m)); 138 } 139 } else if (owl_message_is_type_aim(m)) { 140 /* we do not yet handle chat rooms */ 141 from=frombuff=owl_sprintf("aim:%s", owl_message_get_sender(m)); 86 142 } 87 143 … … 134 190 } 135 191 136 tmp=short_zuser(owl_message_get_sender(m)); 137 138 fprintf(file, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m)); 139 if (strcmp(owl_message_get_opcode(m), "")) fprintf(file, " Opcode: %s", owl_message_get_opcode(m)); 140 fprintf(file, "\n"); 141 fprintf(file, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m)); 142 ptr=owl_zephyr_get_zsig(owl_message_get_notice(m), &i); 143 buff=owl_malloc(i+10); 144 memcpy(buff, ptr, i); 145 buff[i]='\0'; 146 fprintf(file, "From: %s <%s>\n\n", buff, tmp); 147 fprintf(file, "%s\n", owl_message_get_body(m)); 148 fclose(file); 149 192 /* write to the main file */ 193 if (owl_message_is_type_zephyr(m)) { 194 tmp=short_zuser(owl_message_get_sender(m)); 195 fprintf(file, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m)); 196 if (strcmp(owl_message_get_opcode(m), "")) fprintf(file, " Opcode: %s", owl_message_get_opcode(m)); 197 fprintf(file, "\n"); 198 fprintf(file, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m)); 199 ptr=owl_zephyr_get_zsig(owl_message_get_notice(m), &i); 200 buff=owl_malloc(i+10); 201 memcpy(buff, ptr, i); 202 buff[i]='\0'; 203 fprintf(file, "From: %s <%s>\n\n", buff, tmp); 204 fprintf(file, "%s\n", owl_message_get_body(m)); 205 } else if (owl_message_is_type_aim(m)) { 206 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 207 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); 208 fprintf(file, "%s\n\n", owl_message_get_body(m)); 209 } 210 fclose(file); 211 212 /* if it's a personal message, also write to the 'all' file */ 150 213 if (personal) { 151 fprintf(allfile, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m)); 152 if (strcmp(owl_message_get_opcode(m), "")) fprintf(allfile, " Opcode: %s", owl_message_get_opcode(m)); 153 fprintf(allfile, "\n"); 154 fprintf(allfile, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m)); 155 fprintf(allfile, "From: %s <%s>\n\n", buff, tmp); 156 fprintf(allfile, "%s\n", owl_message_get_body(m)); 157 fclose(allfile); 158 } 159 160 owl_free(tmp); 161 owl_free(buff); 214 if (owl_message_is_type_zephyr(m)) { 215 fprintf(allfile, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m)); 216 if (strcmp(owl_message_get_opcode(m), "")) fprintf(allfile, " Opcode: %s", owl_message_get_opcode(m)); 217 fprintf(allfile, "\n"); 218 fprintf(allfile, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m)); 219 fprintf(allfile, "From: %s <%s>\n\n", buff, tmp); 220 fprintf(allfile, "%s\n", owl_message_get_body(m)); 221 fclose(allfile); 222 } else { 223 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 224 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); 225 fprintf(file, "%s\n\n", owl_message_get_body(m)); 226 } 227 } 228 229 if (owl_message_is_type_zephyr(m)) { 230 owl_free(tmp); 231 owl_free(buff); 232 } 162 233 owl_free(frombuff); 163 234 } -
owl.c
r5789230 raac889a 297 297 } 298 298 299 /* grab incoming zephyrs*/299 /* Grab incoming messages. */ 300 300 newmsgs=0; 301 301 zpendcount=0; … … 348 348 349 349 /* do we need to autoreply? */ 350 if (owl_ global_is_zaway(&g)) {350 if (owl_message_is_type_zephyr(m) && owl_global_is_zaway(&g)) { 351 351 owl_zephyr_zaway(m); 352 352 } … … 370 370 char *buff; 371 371 buff = owl_sprintf("@i(Burning ears message on class %s)", owl_message_get_class(m)); 372 /* owl_function_makemsg(buff); */373 372 owl_function_adminmsg(buff, ""); 374 373 owl_free(buff); -
owl_prototypes.h
r5789230 raac889a 567 567 568 568 /* -------------------------------- logging.c -------------------------------- */ 569 extern void owl_log_outgoing(char *to, char *text); 569 extern void owl_log_outgoing_zephyr(char *to, char *text); 570 extern void owl_log_outgoing_aim(char *to, char *text); 570 571 extern void owl_log_incoming(owl_message *m); 571 572
Note: See TracChangeset
for help on using the changeset viewer.