[bd3f232] | 1 | #include "owl.h" |
---|
| 2 | |
---|
| 3 | static const char fileIdent[] = "$Id$"; |
---|
| 4 | |
---|
[5639bf2] | 5 | /* In all of these functions, 'fm' is expected to already be |
---|
| 6 | * initialized. |
---|
| 7 | */ |
---|
| 8 | |
---|
[bd3f232] | 9 | void owl_stylefunc_basic(owl_fmtext *fm, owl_message *m) |
---|
| 10 | { |
---|
[09489b89] | 11 | #ifdef HAVE_LIBZEPHYR |
---|
[bd3f232] | 12 | char *body, *indent, *ptr, *zsigbuff, frombuff[LINE]; |
---|
| 13 | ZNotice_t *n; |
---|
[09489b89] | 14 | #endif |
---|
[bd3f232] | 15 | |
---|
| 16 | if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { |
---|
[09489b89] | 17 | #ifdef HAVE_LIBZEPHYR |
---|
[bd3f232] | 18 | n=owl_message_get_notice(m); |
---|
[09489b89] | 19 | |
---|
[bd3f232] | 20 | /* get the body */ |
---|
| 21 | body=owl_strdup(owl_message_get_body(m)); |
---|
| 22 | body=realloc(body, strlen(body)+30); |
---|
| 23 | |
---|
| 24 | /* add a newline if we need to */ |
---|
| 25 | if (body[0]!='\0' && body[strlen(body)-1]!='\n') { |
---|
| 26 | strcat(body, "\n"); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | /* do the indenting into indent */ |
---|
| 30 | indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); |
---|
| 31 | owl_text_indent(indent, body, OWL_MSGTAB); |
---|
| 32 | |
---|
| 33 | /* edit the from addr for printing */ |
---|
| 34 | strcpy(frombuff, owl_message_get_sender(m)); |
---|
| 35 | ptr=strchr(frombuff, '@'); |
---|
[09489b89] | 36 | if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) { |
---|
[bd3f232] | 37 | *ptr='\0'; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | /* set the message for printing */ |
---|
| 41 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 42 | |
---|
[8b32593] | 43 | if (owl_message_is_ping(m)) { |
---|
[bd3f232] | 44 | owl_fmtext_append_bold(fm, "PING"); |
---|
| 45 | owl_fmtext_append_normal(fm, " from "); |
---|
| 46 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 47 | owl_fmtext_append_normal(fm, "\n"); |
---|
[8b32593] | 48 | } else if (owl_message_is_loginout(m)) { |
---|
[778d0a9] | 49 | char *ptr, *host, *tty; |
---|
[bd3f232] | 50 | int len; |
---|
[778d0a9] | 51 | |
---|
[bd3f232] | 52 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
[778d0a9] | 53 | host=owl_malloc(len+10); |
---|
[bd3f232] | 54 | strncpy(host, ptr, len); |
---|
| 55 | host[len]='\0'; |
---|
[778d0a9] | 56 | |
---|
[bd3f232] | 57 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
[778d0a9] | 58 | tty=owl_malloc(len+10); |
---|
[bd3f232] | 59 | strncpy(tty, ptr, len); |
---|
| 60 | tty[len]='\0'; |
---|
[8b32593] | 61 | |
---|
| 62 | if (owl_message_is_login(m)) { |
---|
[bd3f232] | 63 | owl_fmtext_append_bold(fm, "LOGIN"); |
---|
[8b32593] | 64 | } else if (owl_message_is_logout(m)) { |
---|
[bd3f232] | 65 | owl_fmtext_append_bold(fm, "LOGOUT"); |
---|
| 66 | } |
---|
| 67 | owl_fmtext_append_normal(fm, " for "); |
---|
| 68 | ptr=short_zuser(owl_message_get_instance(m)); |
---|
| 69 | owl_fmtext_append_bold(fm, ptr); |
---|
| 70 | owl_free(ptr); |
---|
| 71 | owl_fmtext_append_normal(fm, " at "); |
---|
| 72 | owl_fmtext_append_normal(fm, host); |
---|
| 73 | owl_fmtext_append_normal(fm, " "); |
---|
| 74 | owl_fmtext_append_normal(fm, tty); |
---|
| 75 | owl_fmtext_append_normal(fm, "\n"); |
---|
[778d0a9] | 76 | |
---|
| 77 | owl_free(host); |
---|
| 78 | owl_free(tty); |
---|
[bd3f232] | 79 | } else { |
---|
| 80 | owl_fmtext_append_normal(fm, "From: "); |
---|
| 81 | if (strcasecmp(owl_message_get_class(m), "message")) { |
---|
| 82 | owl_fmtext_append_normal(fm, "Class "); |
---|
| 83 | owl_fmtext_append_normal(fm, owl_message_get_class(m)); |
---|
| 84 | owl_fmtext_append_normal(fm, " / Instance "); |
---|
| 85 | owl_fmtext_append_normal(fm, owl_message_get_instance(m)); |
---|
| 86 | owl_fmtext_append_normal(fm, " / "); |
---|
| 87 | } |
---|
| 88 | owl_fmtext_append_normal(fm, frombuff); |
---|
[03955f3] | 89 | if (strcasecmp(owl_message_get_realm(m), owl_zephyr_get_realm())) { |
---|
[bd3f232] | 90 | owl_fmtext_append_normal(fm, " {"); |
---|
| 91 | owl_fmtext_append_normal(fm, owl_message_get_realm(m)); |
---|
| 92 | owl_fmtext_append_normal(fm, "} "); |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | /* stick on the zsig */ |
---|
| 96 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 97 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 98 | owl_fmtext_append_normal(fm, " ("); |
---|
| 99 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 100 | owl_fmtext_append_normal(fm, ")"); |
---|
| 101 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 102 | owl_free(zsigbuff); |
---|
| 103 | |
---|
| 104 | /* then the indented message */ |
---|
| 105 | owl_fmtext_append_ztext(fm, indent); |
---|
| 106 | |
---|
| 107 | /* make personal messages bold for smaat users */ |
---|
| 108 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { |
---|
| 109 | if (owl_message_is_personal(m)) { |
---|
| 110 | owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD); |
---|
| 111 | } |
---|
| 112 | } |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | owl_free(body); |
---|
| 116 | owl_free(indent); |
---|
[09489b89] | 117 | #endif |
---|
[bd3f232] | 118 | } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) { |
---|
| 119 | char *indent, *text, *zsigbuff, *foo; |
---|
| 120 | |
---|
| 121 | text=owl_message_get_body(m); |
---|
| 122 | |
---|
| 123 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 124 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 125 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 126 | owl_fmtext_append_normal(fm, "To: "); |
---|
| 127 | foo=short_zuser(owl_message_get_recipient(m)); |
---|
| 128 | owl_fmtext_append_normal(fm, foo); |
---|
| 129 | owl_free(foo); |
---|
| 130 | owl_fmtext_append_normal(fm, " (Zsig: "); |
---|
| 131 | |
---|
| 132 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 133 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 134 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 135 | owl_free(zsigbuff); |
---|
| 136 | |
---|
| 137 | owl_fmtext_append_normal(fm, ")"); |
---|
| 138 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 139 | owl_fmtext_append_ztext(fm, indent); |
---|
| 140 | if (text[strlen(text)-1]!='\n') { |
---|
| 141 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | owl_free(indent); |
---|
| 145 | } else if (owl_message_is_type_aim(m)) { |
---|
| 146 | char *indent; |
---|
| 147 | |
---|
| 148 | if (owl_message_is_loginout(m)) { |
---|
| 149 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 150 | if (owl_message_is_login(m)) { |
---|
| 151 | owl_fmtext_append_bold(fm, "AIM LOGIN"); |
---|
| 152 | } else { |
---|
| 153 | owl_fmtext_append_bold(fm, "AIM LOGOUT"); |
---|
| 154 | } |
---|
| 155 | owl_fmtext_append_normal(fm, " for "); |
---|
| 156 | owl_fmtext_append_normal(fm, owl_message_get_sender(m)); |
---|
| 157 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 158 | } else if (owl_message_is_direction_in(m)) { |
---|
| 159 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 160 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 161 | owl_fmtext_append_bold(fm, OWL_TABSTR); |
---|
| 162 | owl_fmtext_append_bold(fm, "AIM from "); |
---|
| 163 | owl_fmtext_append_bold(fm, owl_message_get_sender(m)); |
---|
| 164 | owl_fmtext_append_bold(fm, "\n"); |
---|
| 165 | owl_fmtext_append_bold(fm, indent); |
---|
| 166 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 167 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 168 | } |
---|
| 169 | owl_free(indent); |
---|
| 170 | } else if (owl_message_is_direction_out(m)) { |
---|
| 171 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 172 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 173 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 174 | owl_fmtext_append_normal(fm, "AIM sent to "); |
---|
| 175 | owl_fmtext_append_normal(fm, owl_message_get_recipient(m)); |
---|
| 176 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 177 | owl_fmtext_append_ztext(fm, indent); |
---|
| 178 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 179 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 180 | } |
---|
| 181 | owl_free(indent); |
---|
| 182 | } |
---|
| 183 | } else if (owl_message_is_type_admin(m)) { |
---|
| 184 | char *text, *header, *indent; |
---|
| 185 | |
---|
| 186 | text=owl_message_get_body(m); |
---|
| 187 | header=owl_message_get_attribute_value(m, "adminheader"); |
---|
| 188 | |
---|
| 189 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 190 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 191 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 192 | owl_fmtext_append_bold(fm, "OWL ADMIN "); |
---|
| 193 | owl_fmtext_append_ztext(fm, header); |
---|
| 194 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 195 | owl_fmtext_append_ztext(fm, indent); |
---|
| 196 | if (text[strlen(text)-1]!='\n') { |
---|
| 197 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 198 | } |
---|
| 199 | |
---|
| 200 | owl_free(indent); |
---|
[37eab7f] | 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); |
---|
[bd3f232] | 222 | } |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | void owl_stylefunc_default(owl_fmtext *fm, owl_message *m) |
---|
| 226 | { |
---|
[09489b89] | 227 | #ifdef HAVE_LIBZEPHYR |
---|
[bd3f232] | 228 | char *body, *indent, *ptr, *zsigbuff, frombuff[LINE]; |
---|
| 229 | ZNotice_t *n; |
---|
[09489b89] | 230 | #endif |
---|
[bd3f232] | 231 | |
---|
| 232 | if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { |
---|
[09489b89] | 233 | #ifdef HAVE_LIBZEPHYR |
---|
[bd3f232] | 234 | n=owl_message_get_notice(m); |
---|
[09489b89] | 235 | |
---|
[bd3f232] | 236 | /* get the body */ |
---|
| 237 | body=owl_malloc(strlen(owl_message_get_body(m))+30); |
---|
| 238 | strcpy(body, owl_message_get_body(m)); |
---|
| 239 | |
---|
| 240 | /* add a newline if we need to */ |
---|
| 241 | if (body[0]!='\0' && body[strlen(body)-1]!='\n') { |
---|
| 242 | strcat(body, "\n"); |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | /* do the indenting into indent */ |
---|
| 246 | indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); |
---|
| 247 | owl_text_indent(indent, body, OWL_MSGTAB); |
---|
| 248 | |
---|
| 249 | /* edit the from addr for printing */ |
---|
| 250 | strcpy(frombuff, owl_message_get_sender(m)); |
---|
| 251 | ptr=strchr(frombuff, '@'); |
---|
[09489b89] | 252 | if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) { |
---|
[bd3f232] | 253 | *ptr='\0'; |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | /* set the message for printing */ |
---|
| 257 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 258 | |
---|
[8b32593] | 259 | if (owl_message_is_ping(m) && owl_message_is_private(m)) { |
---|
[bd3f232] | 260 | owl_fmtext_append_bold(fm, "PING"); |
---|
| 261 | owl_fmtext_append_normal(fm, " from "); |
---|
| 262 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 263 | owl_fmtext_append_normal(fm, "\n"); |
---|
[8b32593] | 264 | } else if (owl_message_is_loginout(m)) { |
---|
[778d0a9] | 265 | char *ptr, *host, *tty; |
---|
[bd3f232] | 266 | int len; |
---|
[778d0a9] | 267 | |
---|
[bd3f232] | 268 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
[778d0a9] | 269 | host=owl_malloc(len+10); |
---|
[bd3f232] | 270 | strncpy(host, ptr, len); |
---|
| 271 | host[len]='\0'; |
---|
[778d0a9] | 272 | |
---|
[bd3f232] | 273 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
[778d0a9] | 274 | tty=owl_malloc(len+10); |
---|
[bd3f232] | 275 | strncpy(tty, ptr, len); |
---|
| 276 | tty[len]='\0'; |
---|
| 277 | |
---|
[8b32593] | 278 | if (owl_message_is_login(m)) { |
---|
[bd3f232] | 279 | owl_fmtext_append_bold(fm, "LOGIN"); |
---|
[8b32593] | 280 | } else if (owl_message_is_logout(m)) { |
---|
[bd3f232] | 281 | owl_fmtext_append_bold(fm, "LOGOUT"); |
---|
| 282 | } |
---|
| 283 | owl_fmtext_append_normal(fm, " for "); |
---|
[03955f3] | 284 | ptr=short_zuser(owl_message_get_instance(m)); |
---|
[bd3f232] | 285 | owl_fmtext_append_bold(fm, ptr); |
---|
| 286 | owl_free(ptr); |
---|
| 287 | owl_fmtext_append_normal(fm, " at "); |
---|
| 288 | owl_fmtext_append_normal(fm, host); |
---|
| 289 | owl_fmtext_append_normal(fm, " "); |
---|
| 290 | owl_fmtext_append_normal(fm, tty); |
---|
| 291 | owl_fmtext_append_normal(fm, "\n"); |
---|
[778d0a9] | 292 | |
---|
| 293 | owl_free(host); |
---|
| 294 | owl_free(tty); |
---|
[bd3f232] | 295 | } else { |
---|
| 296 | owl_fmtext_append_normal(fm, owl_message_get_class(m)); |
---|
| 297 | owl_fmtext_append_normal(fm, " / "); |
---|
| 298 | owl_fmtext_append_normal(fm, owl_message_get_instance(m)); |
---|
| 299 | owl_fmtext_append_normal(fm, " / "); |
---|
| 300 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 301 | if (strcasecmp(owl_message_get_realm(m), ZGetRealm())) { |
---|
| 302 | owl_fmtext_append_normal(fm, " {"); |
---|
| 303 | owl_fmtext_append_normal(fm, owl_message_get_realm(m)); |
---|
| 304 | owl_fmtext_append_normal(fm, "} "); |
---|
| 305 | } |
---|
[03955f3] | 306 | if (strcmp(owl_message_get_opcode(m), "")) { |
---|
[bd3f232] | 307 | owl_fmtext_append_normal(fm, " ["); |
---|
| 308 | owl_fmtext_append_normal(fm, owl_message_get_opcode(m)); |
---|
| 309 | owl_fmtext_append_normal(fm, "] "); |
---|
| 310 | } |
---|
| 311 | |
---|
| 312 | /* stick on the zsig */ |
---|
| 313 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 314 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 315 | owl_fmtext_append_normal(fm, " ("); |
---|
| 316 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 317 | owl_fmtext_append_normal(fm, ")"); |
---|
| 318 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 319 | owl_free(zsigbuff); |
---|
| 320 | |
---|
| 321 | /* then the indented message */ |
---|
| 322 | owl_fmtext_append_ztext(fm, indent); |
---|
| 323 | |
---|
| 324 | /* make private messages bold for smaat users */ |
---|
| 325 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { |
---|
| 326 | if (owl_message_is_personal(m)) { |
---|
| 327 | owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD); |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | owl_free(body); |
---|
| 333 | owl_free(indent); |
---|
[09489b89] | 334 | #endif |
---|
[bd3f232] | 335 | } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) { |
---|
| 336 | char *indent, *text, *zsigbuff, *foo; |
---|
| 337 | |
---|
| 338 | text=owl_message_get_body(m); |
---|
| 339 | |
---|
| 340 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 341 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 342 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 343 | owl_fmtext_append_normal(fm, "Zephyr sent to "); |
---|
| 344 | foo=short_zuser(owl_message_get_recipient(m)); |
---|
| 345 | owl_fmtext_append_normal(fm, foo); |
---|
| 346 | owl_free(foo); |
---|
| 347 | owl_fmtext_append_normal(fm, " (Zsig: "); |
---|
| 348 | |
---|
| 349 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 350 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 351 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 352 | owl_free(zsigbuff); |
---|
| 353 | |
---|
| 354 | owl_fmtext_append_normal(fm, ")"); |
---|
| 355 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 356 | owl_fmtext_append_ztext(fm, indent); |
---|
| 357 | if (text[strlen(text)-1]!='\n') { |
---|
| 358 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 359 | } |
---|
| 360 | |
---|
| 361 | owl_free(indent); |
---|
| 362 | } else if (owl_message_is_type_aim(m)) { |
---|
| 363 | char *indent; |
---|
| 364 | |
---|
| 365 | if (owl_message_is_loginout(m)) { |
---|
| 366 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 367 | if (owl_message_is_login(m)) { |
---|
| 368 | owl_fmtext_append_bold(fm, "AIM LOGIN"); |
---|
| 369 | } else { |
---|
| 370 | owl_fmtext_append_bold(fm, "AIM LOGOUT"); |
---|
| 371 | } |
---|
| 372 | owl_fmtext_append_normal(fm, " for "); |
---|
| 373 | owl_fmtext_append_normal(fm, owl_message_get_sender(m)); |
---|
| 374 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 375 | } else if (owl_message_is_direction_in(m)) { |
---|
| 376 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 377 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 378 | owl_fmtext_append_bold(fm, OWL_TABSTR); |
---|
| 379 | owl_fmtext_append_bold(fm, "AIM from "); |
---|
| 380 | owl_fmtext_append_bold(fm, owl_message_get_sender(m)); |
---|
| 381 | owl_fmtext_append_bold(fm, "\n"); |
---|
| 382 | owl_fmtext_append_bold(fm, indent); |
---|
| 383 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 384 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 385 | } |
---|
| 386 | owl_free(indent); |
---|
| 387 | } else if (owl_message_is_direction_out(m)) { |
---|
| 388 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 389 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 390 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 391 | owl_fmtext_append_normal(fm, "AIM sent to "); |
---|
| 392 | owl_fmtext_append_normal(fm, owl_message_get_recipient(m)); |
---|
| 393 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 394 | owl_fmtext_append_ztext(fm, indent); |
---|
| 395 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 396 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 397 | } |
---|
| 398 | owl_free(indent); |
---|
| 399 | } |
---|
| 400 | } else if (owl_message_is_type_admin(m)) { |
---|
| 401 | char *text, *header, *indent; |
---|
| 402 | |
---|
| 403 | text=owl_message_get_body(m); |
---|
| 404 | header=owl_message_get_attribute_value(m, "adminheader"); |
---|
| 405 | |
---|
| 406 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 407 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 408 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 409 | owl_fmtext_append_bold(fm, "OWL ADMIN "); |
---|
| 410 | owl_fmtext_append_ztext(fm, header); |
---|
| 411 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 412 | owl_fmtext_append_ztext(fm, indent); |
---|
| 413 | if (text[strlen(text)-1]!='\n') { |
---|
| 414 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | owl_free(indent); |
---|
[37eab7f] | 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); |
---|
[bd3f232] | 439 | } |
---|
| 440 | } |
---|
[8b32593] | 441 | |
---|
| 442 | void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m) |
---|
| 443 | { |
---|
| 444 | char *tmp; |
---|
[5ea6fea] | 445 | char *baseformat="%s %-13.13s %-11.11s %-12.12s "; |
---|
| 446 | char *sender, *recip; |
---|
[09489b89] | 447 | #ifdef HAVE_LIBZEPHYR |
---|
[778d0a9] | 448 | ZNotice_t *n; |
---|
[09489b89] | 449 | #endif |
---|
[8b32593] | 450 | |
---|
[5ea6fea] | 451 | sender=short_zuser(owl_message_get_sender(m)); |
---|
| 452 | recip=short_zuser(owl_message_get_recipient(m)); |
---|
| 453 | |
---|
[8b32593] | 454 | if (owl_message_is_type_zephyr(m)) { |
---|
[09489b89] | 455 | #ifdef HAVE_LIBZEPHYR |
---|
[778d0a9] | 456 | n=owl_message_get_notice(m); |
---|
| 457 | |
---|
[8b32593] | 458 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
[778d0a9] | 459 | |
---|
| 460 | if (owl_message_is_loginout(m)) { |
---|
| 461 | char *ptr, *host, *tty; |
---|
| 462 | int len; |
---|
| 463 | |
---|
| 464 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
| 465 | host=owl_malloc(len+10); |
---|
| 466 | strncpy(host, ptr, len); |
---|
| 467 | host[len]='\0'; |
---|
| 468 | |
---|
| 469 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
| 470 | tty=owl_malloc(len+10); |
---|
| 471 | strncpy(tty, ptr, len); |
---|
| 472 | tty[len]='\0'; |
---|
| 473 | |
---|
| 474 | if (owl_message_is_login(m)) { |
---|
| 475 | tmp=owl_sprintf(baseformat, "<", "LOGIN", "", sender); |
---|
| 476 | owl_fmtext_append_normal(fm, tmp); |
---|
| 477 | owl_free(tmp); |
---|
| 478 | } else if (owl_message_is_logout(m)) { |
---|
| 479 | tmp=owl_sprintf(baseformat, "<", "LOGOUT", "", sender); |
---|
| 480 | owl_fmtext_append_normal(fm, tmp); |
---|
| 481 | owl_free(tmp); |
---|
| 482 | } |
---|
| 483 | |
---|
| 484 | owl_fmtext_append_normal(fm, "at "); |
---|
| 485 | owl_fmtext_append_normal(fm, host); |
---|
| 486 | owl_fmtext_append_normal(fm, " "); |
---|
| 487 | owl_fmtext_append_normal(fm, tty); |
---|
[8b32593] | 488 | owl_fmtext_append_normal(fm, "\n"); |
---|
[778d0a9] | 489 | |
---|
| 490 | owl_free(host); |
---|
| 491 | owl_free(tty); |
---|
| 492 | |
---|
[8b32593] | 493 | } else if (owl_message_is_ping(m)) { |
---|
[5ea6fea] | 494 | tmp=owl_sprintf(baseformat, "<", "PING", "", sender); |
---|
[8b32593] | 495 | owl_fmtext_append_normal(fm, tmp); |
---|
| 496 | owl_fmtext_append_normal(fm, "\n"); |
---|
[5ea6fea] | 497 | owl_free(tmp); |
---|
[778d0a9] | 498 | |
---|
[8b32593] | 499 | } else { |
---|
| 500 | if (owl_message_is_direction_in(m)) { |
---|
[5ea6fea] | 501 | tmp=owl_sprintf(baseformat, "<", owl_message_get_class(m), owl_message_get_instance(m), sender); |
---|
[8b32593] | 502 | } else if (owl_message_is_direction_out(m)) { |
---|
[5ea6fea] | 503 | tmp=owl_sprintf(baseformat, ">", owl_message_get_class(m), owl_message_get_instance(m), recip); |
---|
[8b32593] | 504 | } else { |
---|
[5ea6fea] | 505 | tmp=owl_sprintf(baseformat, "-", owl_message_get_class(m), owl_message_get_instance(m), sender); |
---|
[8b32593] | 506 | } |
---|
| 507 | owl_fmtext_append_normal(fm, tmp); |
---|
| 508 | if (tmp) owl_free(tmp); |
---|
| 509 | |
---|
| 510 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 511 | owl_util_tr(tmp, '\n', ' '); |
---|
[65e3901] | 512 | owl_fmtext_append_ztext(fm, tmp); |
---|
[8b32593] | 513 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 514 | if (tmp) owl_free(tmp); |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | /* make personal messages bold for smaat users */ |
---|
[c3ab155] | 518 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && |
---|
| 519 | owl_message_is_personal(m) && |
---|
| 520 | owl_message_is_direction_in(m)) { |
---|
[8b32593] | 521 | owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); |
---|
| 522 | } |
---|
[5ea6fea] | 523 | |
---|
| 524 | owl_free(sender); |
---|
| 525 | owl_free(recip); |
---|
[09489b89] | 526 | #endif |
---|
[8b32593] | 527 | } else if (owl_message_is_type_aim(m)) { |
---|
| 528 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
| 529 | if (owl_message_is_login(m)) { |
---|
[5ea6fea] | 530 | tmp=owl_sprintf(baseformat, "<", "AIM LOGIN", "", owl_message_get_sender(m)); |
---|
[8b32593] | 531 | owl_fmtext_append_normal(fm, tmp); |
---|
| 532 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 533 | if (tmp) owl_free(tmp); |
---|
| 534 | } else if (owl_message_is_logout(m)) { |
---|
[5ea6fea] | 535 | tmp=owl_sprintf(baseformat, "<", "AIM LOGOUT", "", owl_message_get_sender(m)); |
---|
[8b32593] | 536 | owl_fmtext_append_normal(fm, tmp); |
---|
| 537 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 538 | if (tmp) owl_free(tmp); |
---|
| 539 | } else { |
---|
| 540 | if (owl_message_is_direction_in(m)) { |
---|
[5ea6fea] | 541 | tmp=owl_sprintf(baseformat, "<", "AIM", "", owl_message_get_sender(m)); |
---|
[8b32593] | 542 | owl_fmtext_append_normal(fm, tmp); |
---|
| 543 | if (tmp) owl_free(tmp); |
---|
| 544 | } else if (owl_message_is_direction_out(m)) { |
---|
[5ea6fea] | 545 | tmp=owl_sprintf(baseformat, ">", "AIM", "", owl_message_get_recipient(m)); |
---|
[8b32593] | 546 | owl_fmtext_append_normal(fm, tmp); |
---|
| 547 | if (tmp) owl_free(tmp); |
---|
| 548 | } |
---|
| 549 | |
---|
| 550 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 551 | owl_util_tr(tmp, '\n', ' '); |
---|
| 552 | owl_fmtext_append_normal(fm, tmp); |
---|
| 553 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 554 | if (tmp) owl_free(tmp); |
---|
| 555 | |
---|
[0c502e9] | 556 | /* make personal messages bold for smaat users */ |
---|
[9c4ec91] | 557 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_direction_in(m)) { |
---|
[0c502e9] | 558 | owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); |
---|
| 559 | } |
---|
[8b32593] | 560 | } |
---|
| 561 | } else if (owl_message_is_type_admin(m)) { |
---|
| 562 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
| 563 | owl_fmtext_append_normal(fm, "< ADMIN "); |
---|
| 564 | |
---|
| 565 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 566 | owl_util_tr(tmp, '\n', ' '); |
---|
| 567 | owl_fmtext_append_normal(fm, tmp); |
---|
| 568 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 569 | if (tmp) owl_free(tmp); |
---|
[37eab7f] | 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 | } |
---|
[8b32593] | 580 | |
---|
| 581 | } |
---|
[ec6ff52] | 582 | |
---|
| 583 | void owl_stylefunc_vt(owl_fmtext *fm, owl_message *m) |
---|
| 584 | { |
---|
| 585 | #ifdef HAVE_LIBZEPHYR |
---|
| 586 | char *body, *indent, *ptr, *zsigbuff, frombuff[LINE]; |
---|
| 587 | owl_fmtext fm_first, fm_other, fm_tmp; |
---|
| 588 | ZNotice_t *n; |
---|
| 589 | #endif |
---|
| 590 | char *sender, *hostname, *timestr, *classinst1, *classinst2; |
---|
| 591 | |
---|
| 592 | if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { |
---|
| 593 | #ifdef HAVE_LIBZEPHYR |
---|
| 594 | n=owl_message_get_notice(m); |
---|
| 595 | |
---|
| 596 | /* get the body */ |
---|
| 597 | body=owl_malloc(strlen(owl_message_get_body(m))+30); |
---|
| 598 | strcpy(body, owl_message_get_body(m)); |
---|
| 599 | |
---|
| 600 | /* add a newline if we need to */ |
---|
| 601 | if (body[0]!='\0' && body[strlen(body)-1]!='\n') { |
---|
| 602 | strcat(body, "\n"); |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | owl_fmtext_init_null(&fm_tmp); |
---|
| 606 | owl_fmtext_append_ztext(&fm_tmp, body); |
---|
| 607 | owl_fmtext_init_null(&fm_first); |
---|
| 608 | owl_fmtext_truncate_lines(&fm_tmp, 0, 1, &fm_first); |
---|
| 609 | |
---|
| 610 | /* do the indenting into indent */ |
---|
| 611 | indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); |
---|
| 612 | owl_text_indent(indent, body, 31); |
---|
| 613 | |
---|
| 614 | owl_fmtext_free(&fm_tmp); |
---|
| 615 | owl_fmtext_init_null(&fm_tmp); |
---|
| 616 | owl_fmtext_append_ztext(&fm_tmp, indent); |
---|
| 617 | owl_fmtext_init_null(&fm_other); |
---|
| 618 | owl_fmtext_truncate_lines(&fm_tmp, 1, owl_fmtext_num_lines(&fm_tmp)-1, &fm_other); |
---|
| 619 | owl_fmtext_free(&fm_tmp); |
---|
| 620 | |
---|
| 621 | /* edit the from addr for printing */ |
---|
| 622 | strcpy(frombuff, owl_message_get_sender(m)); |
---|
| 623 | ptr=strchr(frombuff, '@'); |
---|
| 624 | if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) { |
---|
| 625 | *ptr='\0'; |
---|
| 626 | } |
---|
| 627 | sender=owl_sprintf("%-9.9s", frombuff); |
---|
| 628 | |
---|
| 629 | hostname=owl_sprintf("%-9.9s", owl_message_get_hostname(m)); |
---|
| 630 | timestr=owl_strdup("00:00"); |
---|
| 631 | classinst1=owl_sprintf("<%s>[%s]", owl_message_get_class(m), owl_message_get_instance(m)); |
---|
| 632 | classinst2=owl_sprintf("%-9.9s", classinst1); |
---|
| 633 | |
---|
| 634 | /* set the message for printing */ |
---|
| 635 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 636 | |
---|
| 637 | if (owl_message_is_ping(m) && owl_message_is_private(m)) { |
---|
| 638 | owl_fmtext_append_bold(fm, "PING"); |
---|
| 639 | owl_fmtext_append_normal(fm, " from "); |
---|
| 640 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 641 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 642 | } else if (owl_message_is_loginout(m)) { |
---|
| 643 | char *ptr, *host, *tty; |
---|
| 644 | int len; |
---|
| 645 | |
---|
| 646 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
| 647 | host=owl_malloc(len+10); |
---|
| 648 | strncpy(host, ptr, len); |
---|
| 649 | host[len]='\0'; |
---|
| 650 | |
---|
| 651 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
| 652 | tty=owl_malloc(len+10); |
---|
| 653 | strncpy(tty, ptr, len); |
---|
| 654 | tty[len]='\0'; |
---|
| 655 | |
---|
| 656 | if (owl_message_is_login(m)) { |
---|
| 657 | owl_fmtext_append_bold(fm, "LOGIN"); |
---|
| 658 | } else if (owl_message_is_logout(m)) { |
---|
| 659 | owl_fmtext_append_bold(fm, "LOGOUT"); |
---|
| 660 | } |
---|
| 661 | owl_fmtext_append_normal(fm, " for "); |
---|
| 662 | ptr=short_zuser(owl_message_get_instance(m)); |
---|
| 663 | owl_fmtext_append_bold(fm, ptr); |
---|
| 664 | owl_free(ptr); |
---|
| 665 | owl_fmtext_append_normal(fm, " at "); |
---|
| 666 | owl_fmtext_append_normal(fm, host); |
---|
| 667 | owl_fmtext_append_normal(fm, " "); |
---|
| 668 | owl_fmtext_append_normal(fm, tty); |
---|
| 669 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 670 | |
---|
| 671 | owl_free(host); |
---|
| 672 | owl_free(tty); |
---|
| 673 | } else { |
---|
| 674 | owl_fmtext_append_normal(fm, sender); |
---|
| 675 | owl_fmtext_append_normal(fm, "|"); |
---|
| 676 | owl_fmtext_append_normal(fm, hostname); |
---|
| 677 | owl_fmtext_append_normal(fm, " "); |
---|
| 678 | owl_fmtext_append_normal(fm, timestr); |
---|
| 679 | owl_fmtext_append_normal(fm, " "); |
---|
| 680 | owl_fmtext_append_normal(fm, classinst2); |
---|
| 681 | |
---|
| 682 | owl_fmtext_append_normal(fm, " "); |
---|
| 683 | owl_fmtext_append_fmtext(fm, &fm_first); |
---|
| 684 | owl_fmtext_append_fmtext(fm, &fm_other); |
---|
| 685 | |
---|
| 686 | owl_fmtext_free(&fm_other); |
---|
| 687 | owl_fmtext_free(&fm_first); |
---|
| 688 | |
---|
| 689 | /* make private messages bold for smaat users */ |
---|
| 690 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { |
---|
| 691 | if (owl_message_is_personal(m)) { |
---|
| 692 | owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD); |
---|
| 693 | } |
---|
| 694 | } |
---|
| 695 | } |
---|
| 696 | |
---|
| 697 | owl_free(sender); |
---|
| 698 | owl_free(hostname); |
---|
| 699 | owl_free(timestr); |
---|
| 700 | owl_free(classinst1); |
---|
| 701 | owl_free(classinst2); |
---|
| 702 | |
---|
| 703 | owl_free(body); |
---|
| 704 | owl_free(indent); |
---|
| 705 | #endif |
---|
| 706 | } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) { |
---|
| 707 | char *indent, *text, *zsigbuff, *foo; |
---|
| 708 | |
---|
| 709 | text=owl_message_get_body(m); |
---|
| 710 | |
---|
| 711 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 712 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 713 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 714 | owl_fmtext_append_normal(fm, "Zephyr sent to "); |
---|
| 715 | foo=short_zuser(owl_message_get_recipient(m)); |
---|
| 716 | owl_fmtext_append_normal(fm, foo); |
---|
| 717 | owl_free(foo); |
---|
| 718 | owl_fmtext_append_normal(fm, " (Zsig: "); |
---|
| 719 | |
---|
| 720 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 721 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 722 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 723 | owl_free(zsigbuff); |
---|
| 724 | |
---|
| 725 | owl_fmtext_append_normal(fm, ")"); |
---|
| 726 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 727 | owl_fmtext_append_ztext(fm, indent); |
---|
| 728 | if (text[strlen(text)-1]!='\n') { |
---|
| 729 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 730 | } |
---|
| 731 | |
---|
| 732 | owl_free(indent); |
---|
| 733 | } else if (owl_message_is_type_aim(m)) { |
---|
| 734 | char *indent; |
---|
| 735 | |
---|
| 736 | if (owl_message_is_loginout(m)) { |
---|
| 737 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 738 | if (owl_message_is_login(m)) { |
---|
| 739 | owl_fmtext_append_bold(fm, "AIM LOGIN"); |
---|
| 740 | } else { |
---|
| 741 | owl_fmtext_append_bold(fm, "AIM LOGOUT"); |
---|
| 742 | } |
---|
| 743 | owl_fmtext_append_normal(fm, " for "); |
---|
| 744 | owl_fmtext_append_normal(fm, owl_message_get_sender(m)); |
---|
| 745 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 746 | } else if (owl_message_is_direction_in(m)) { |
---|
| 747 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 748 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 749 | owl_fmtext_append_bold(fm, OWL_TABSTR); |
---|
| 750 | owl_fmtext_append_bold(fm, "AIM from "); |
---|
| 751 | owl_fmtext_append_bold(fm, owl_message_get_sender(m)); |
---|
| 752 | owl_fmtext_append_bold(fm, "\n"); |
---|
| 753 | owl_fmtext_append_bold(fm, indent); |
---|
| 754 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 755 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 756 | } |
---|
| 757 | owl_free(indent); |
---|
| 758 | } else if (owl_message_is_direction_out(m)) { |
---|
| 759 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 760 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 761 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 762 | owl_fmtext_append_normal(fm, "AIM sent to "); |
---|
| 763 | owl_fmtext_append_normal(fm, owl_message_get_recipient(m)); |
---|
| 764 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 765 | owl_fmtext_append_ztext(fm, indent); |
---|
| 766 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 767 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 768 | } |
---|
| 769 | owl_free(indent); |
---|
| 770 | } |
---|
| 771 | } else if (owl_message_is_type_admin(m)) { |
---|
| 772 | char *text, *header, *indent; |
---|
| 773 | |
---|
| 774 | text=owl_message_get_body(m); |
---|
| 775 | header=owl_message_get_attribute_value(m, "adminheader"); |
---|
| 776 | |
---|
| 777 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 778 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 779 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 780 | owl_fmtext_append_bold(fm, "OWL ADMIN "); |
---|
| 781 | owl_fmtext_append_ztext(fm, header); |
---|
| 782 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 783 | owl_fmtext_append_ztext(fm, indent); |
---|
| 784 | if (text[strlen(text)-1]!='\n') { |
---|
| 785 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 786 | } |
---|
| 787 | |
---|
| 788 | owl_free(indent); |
---|
[37eab7f] | 789 | } else { |
---|
| 790 | |
---|
[ec6ff52] | 791 | } |
---|
| 792 | } |
---|