[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 | { |
---|
[25dd31a] | 227 | char *shorttimestr; |
---|
[09489b89] | 228 | #ifdef HAVE_LIBZEPHYR |
---|
[bd3f232] | 229 | char *body, *indent, *ptr, *zsigbuff, frombuff[LINE]; |
---|
| 230 | ZNotice_t *n; |
---|
[09489b89] | 231 | #endif |
---|
[bd3f232] | 232 | |
---|
[25dd31a] | 233 | shorttimestr=owl_message_get_shorttimestr(m); |
---|
| 234 | |
---|
[bd3f232] | 235 | if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { |
---|
[09489b89] | 236 | #ifdef HAVE_LIBZEPHYR |
---|
[bd3f232] | 237 | n=owl_message_get_notice(m); |
---|
[09489b89] | 238 | |
---|
[bd3f232] | 239 | /* get the body */ |
---|
| 240 | body=owl_malloc(strlen(owl_message_get_body(m))+30); |
---|
| 241 | strcpy(body, owl_message_get_body(m)); |
---|
| 242 | |
---|
| 243 | /* add a newline if we need to */ |
---|
| 244 | if (body[0]!='\0' && body[strlen(body)-1]!='\n') { |
---|
| 245 | strcat(body, "\n"); |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | /* do the indenting into indent */ |
---|
| 249 | indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); |
---|
| 250 | owl_text_indent(indent, body, OWL_MSGTAB); |
---|
| 251 | |
---|
| 252 | /* edit the from addr for printing */ |
---|
| 253 | strcpy(frombuff, owl_message_get_sender(m)); |
---|
| 254 | ptr=strchr(frombuff, '@'); |
---|
[09489b89] | 255 | if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) { |
---|
[bd3f232] | 256 | *ptr='\0'; |
---|
| 257 | } |
---|
| 258 | |
---|
| 259 | /* set the message for printing */ |
---|
| 260 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 261 | |
---|
[8b32593] | 262 | if (owl_message_is_ping(m) && owl_message_is_private(m)) { |
---|
[bd3f232] | 263 | owl_fmtext_append_bold(fm, "PING"); |
---|
| 264 | owl_fmtext_append_normal(fm, " from "); |
---|
| 265 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 266 | owl_fmtext_append_normal(fm, "\n"); |
---|
[8b32593] | 267 | } else if (owl_message_is_loginout(m)) { |
---|
[778d0a9] | 268 | char *ptr, *host, *tty; |
---|
[bd3f232] | 269 | int len; |
---|
[778d0a9] | 270 | |
---|
[bd3f232] | 271 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
[778d0a9] | 272 | host=owl_malloc(len+10); |
---|
[bd3f232] | 273 | strncpy(host, ptr, len); |
---|
| 274 | host[len]='\0'; |
---|
[778d0a9] | 275 | |
---|
[bd3f232] | 276 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
[778d0a9] | 277 | tty=owl_malloc(len+10); |
---|
[bd3f232] | 278 | strncpy(tty, ptr, len); |
---|
| 279 | tty[len]='\0'; |
---|
| 280 | |
---|
[8b32593] | 281 | if (owl_message_is_login(m)) { |
---|
[bd3f232] | 282 | owl_fmtext_append_bold(fm, "LOGIN"); |
---|
[8b32593] | 283 | } else if (owl_message_is_logout(m)) { |
---|
[bd3f232] | 284 | owl_fmtext_append_bold(fm, "LOGOUT"); |
---|
| 285 | } |
---|
| 286 | owl_fmtext_append_normal(fm, " for "); |
---|
[03955f3] | 287 | ptr=short_zuser(owl_message_get_instance(m)); |
---|
[bd3f232] | 288 | owl_fmtext_append_bold(fm, ptr); |
---|
| 289 | owl_free(ptr); |
---|
| 290 | owl_fmtext_append_normal(fm, " at "); |
---|
| 291 | owl_fmtext_append_normal(fm, host); |
---|
| 292 | owl_fmtext_append_normal(fm, " "); |
---|
| 293 | owl_fmtext_append_normal(fm, tty); |
---|
| 294 | owl_fmtext_append_normal(fm, "\n"); |
---|
[778d0a9] | 295 | |
---|
| 296 | owl_free(host); |
---|
| 297 | owl_free(tty); |
---|
[bd3f232] | 298 | } else { |
---|
| 299 | owl_fmtext_append_normal(fm, owl_message_get_class(m)); |
---|
| 300 | owl_fmtext_append_normal(fm, " / "); |
---|
| 301 | owl_fmtext_append_normal(fm, owl_message_get_instance(m)); |
---|
| 302 | owl_fmtext_append_normal(fm, " / "); |
---|
| 303 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 304 | if (strcasecmp(owl_message_get_realm(m), ZGetRealm())) { |
---|
| 305 | owl_fmtext_append_normal(fm, " {"); |
---|
| 306 | owl_fmtext_append_normal(fm, owl_message_get_realm(m)); |
---|
[25dd31a] | 307 | owl_fmtext_append_normal(fm, "}"); |
---|
[bd3f232] | 308 | } |
---|
[03955f3] | 309 | if (strcmp(owl_message_get_opcode(m), "")) { |
---|
[bd3f232] | 310 | owl_fmtext_append_normal(fm, " ["); |
---|
| 311 | owl_fmtext_append_normal(fm, owl_message_get_opcode(m)); |
---|
[25dd31a] | 312 | owl_fmtext_append_normal(fm, "]"); |
---|
[bd3f232] | 313 | } |
---|
[25dd31a] | 314 | |
---|
| 315 | owl_fmtext_append_normal(fm, " "); |
---|
| 316 | owl_fmtext_append_normal(fm, shorttimestr); |
---|
| 317 | |
---|
[bd3f232] | 318 | /* stick on the zsig */ |
---|
| 319 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 320 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 321 | owl_fmtext_append_normal(fm, " ("); |
---|
| 322 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 323 | owl_fmtext_append_normal(fm, ")"); |
---|
| 324 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 325 | owl_free(zsigbuff); |
---|
| 326 | |
---|
| 327 | /* then the indented message */ |
---|
| 328 | owl_fmtext_append_ztext(fm, indent); |
---|
| 329 | |
---|
| 330 | /* make private messages bold for smaat users */ |
---|
| 331 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { |
---|
| 332 | if (owl_message_is_personal(m)) { |
---|
| 333 | owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD); |
---|
| 334 | } |
---|
| 335 | } |
---|
| 336 | } |
---|
| 337 | |
---|
| 338 | owl_free(body); |
---|
| 339 | owl_free(indent); |
---|
[09489b89] | 340 | #endif |
---|
[bd3f232] | 341 | } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) { |
---|
| 342 | char *indent, *text, *zsigbuff, *foo; |
---|
| 343 | |
---|
| 344 | text=owl_message_get_body(m); |
---|
| 345 | |
---|
| 346 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 347 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 348 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 349 | owl_fmtext_append_normal(fm, "Zephyr sent to "); |
---|
| 350 | foo=short_zuser(owl_message_get_recipient(m)); |
---|
| 351 | owl_fmtext_append_normal(fm, foo); |
---|
| 352 | owl_free(foo); |
---|
[25dd31a] | 353 | |
---|
| 354 | owl_fmtext_append_normal(fm, " "); |
---|
| 355 | owl_fmtext_append_normal(fm, shorttimestr); |
---|
| 356 | |
---|
[bd3f232] | 357 | owl_fmtext_append_normal(fm, " (Zsig: "); |
---|
| 358 | |
---|
| 359 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 360 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 361 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 362 | owl_free(zsigbuff); |
---|
| 363 | |
---|
| 364 | owl_fmtext_append_normal(fm, ")"); |
---|
| 365 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 366 | owl_fmtext_append_ztext(fm, indent); |
---|
| 367 | if (text[strlen(text)-1]!='\n') { |
---|
| 368 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 369 | } |
---|
| 370 | |
---|
| 371 | owl_free(indent); |
---|
| 372 | } else if (owl_message_is_type_aim(m)) { |
---|
| 373 | char *indent; |
---|
| 374 | |
---|
| 375 | if (owl_message_is_loginout(m)) { |
---|
| 376 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 377 | if (owl_message_is_login(m)) { |
---|
| 378 | owl_fmtext_append_bold(fm, "AIM LOGIN"); |
---|
| 379 | } else { |
---|
| 380 | owl_fmtext_append_bold(fm, "AIM LOGOUT"); |
---|
| 381 | } |
---|
| 382 | owl_fmtext_append_normal(fm, " for "); |
---|
| 383 | owl_fmtext_append_normal(fm, owl_message_get_sender(m)); |
---|
| 384 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 385 | } else if (owl_message_is_direction_in(m)) { |
---|
| 386 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 387 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 388 | owl_fmtext_append_bold(fm, OWL_TABSTR); |
---|
| 389 | owl_fmtext_append_bold(fm, "AIM from "); |
---|
| 390 | owl_fmtext_append_bold(fm, owl_message_get_sender(m)); |
---|
[25dd31a] | 391 | |
---|
| 392 | owl_fmtext_append_normal(fm, " "); |
---|
| 393 | owl_fmtext_append_normal(fm, shorttimestr); |
---|
| 394 | |
---|
[bd3f232] | 395 | owl_fmtext_append_bold(fm, "\n"); |
---|
| 396 | owl_fmtext_append_bold(fm, indent); |
---|
| 397 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 398 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 399 | } |
---|
| 400 | owl_free(indent); |
---|
| 401 | } else if (owl_message_is_direction_out(m)) { |
---|
| 402 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 403 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 404 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 405 | owl_fmtext_append_normal(fm, "AIM sent to "); |
---|
| 406 | owl_fmtext_append_normal(fm, owl_message_get_recipient(m)); |
---|
[25dd31a] | 407 | owl_fmtext_append_normal(fm, " "); |
---|
| 408 | owl_fmtext_append_normal(fm, shorttimestr); |
---|
[bd3f232] | 409 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 410 | owl_fmtext_append_ztext(fm, indent); |
---|
| 411 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 412 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 413 | } |
---|
| 414 | owl_free(indent); |
---|
| 415 | } |
---|
| 416 | } else if (owl_message_is_type_admin(m)) { |
---|
| 417 | char *text, *header, *indent; |
---|
| 418 | |
---|
| 419 | text=owl_message_get_body(m); |
---|
| 420 | header=owl_message_get_attribute_value(m, "adminheader"); |
---|
| 421 | |
---|
| 422 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 423 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 424 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 425 | owl_fmtext_append_bold(fm, "OWL ADMIN "); |
---|
| 426 | owl_fmtext_append_ztext(fm, header); |
---|
| 427 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 428 | owl_fmtext_append_ztext(fm, indent); |
---|
| 429 | if (text[strlen(text)-1]!='\n') { |
---|
| 430 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | owl_free(indent); |
---|
[37eab7f] | 434 | } else { |
---|
| 435 | char *text, *header, *indent; |
---|
| 436 | |
---|
| 437 | text=owl_message_get_body(m); |
---|
| 438 | header=owl_sprintf("%s from: %s to: %s", |
---|
| 439 | owl_message_get_type(m), |
---|
| 440 | owl_message_get_sender(m), |
---|
| 441 | owl_message_get_recipient(m)); |
---|
| 442 | |
---|
| 443 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 444 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 445 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 446 | owl_fmtext_append_normal(fm, header); |
---|
[25dd31a] | 447 | owl_fmtext_append_normal(fm, " "); |
---|
| 448 | owl_fmtext_append_normal(fm, shorttimestr); |
---|
[37eab7f] | 449 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 450 | owl_fmtext_append_normal(fm, indent); |
---|
| 451 | if (text[strlen(text)-1]!='\n') { |
---|
| 452 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 453 | } |
---|
| 454 | |
---|
| 455 | owl_free(indent); |
---|
| 456 | owl_free(header); |
---|
[bd3f232] | 457 | } |
---|
[25dd31a] | 458 | owl_free(shorttimestr); |
---|
[bd3f232] | 459 | } |
---|
[8b32593] | 460 | |
---|
| 461 | void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m) |
---|
| 462 | { |
---|
| 463 | char *tmp; |
---|
[5ea6fea] | 464 | char *baseformat="%s %-13.13s %-11.11s %-12.12s "; |
---|
| 465 | char *sender, *recip; |
---|
[09489b89] | 466 | #ifdef HAVE_LIBZEPHYR |
---|
[778d0a9] | 467 | ZNotice_t *n; |
---|
[09489b89] | 468 | #endif |
---|
[8b32593] | 469 | |
---|
[5ea6fea] | 470 | sender=short_zuser(owl_message_get_sender(m)); |
---|
| 471 | recip=short_zuser(owl_message_get_recipient(m)); |
---|
| 472 | |
---|
[8b32593] | 473 | if (owl_message_is_type_zephyr(m)) { |
---|
[09489b89] | 474 | #ifdef HAVE_LIBZEPHYR |
---|
[778d0a9] | 475 | n=owl_message_get_notice(m); |
---|
| 476 | |
---|
[8b32593] | 477 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
[778d0a9] | 478 | |
---|
| 479 | if (owl_message_is_loginout(m)) { |
---|
| 480 | char *ptr, *host, *tty; |
---|
| 481 | int len; |
---|
| 482 | |
---|
| 483 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
| 484 | host=owl_malloc(len+10); |
---|
| 485 | strncpy(host, ptr, len); |
---|
| 486 | host[len]='\0'; |
---|
| 487 | |
---|
| 488 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
| 489 | tty=owl_malloc(len+10); |
---|
| 490 | strncpy(tty, ptr, len); |
---|
| 491 | tty[len]='\0'; |
---|
| 492 | |
---|
| 493 | if (owl_message_is_login(m)) { |
---|
| 494 | tmp=owl_sprintf(baseformat, "<", "LOGIN", "", sender); |
---|
| 495 | owl_fmtext_append_normal(fm, tmp); |
---|
| 496 | owl_free(tmp); |
---|
| 497 | } else if (owl_message_is_logout(m)) { |
---|
| 498 | tmp=owl_sprintf(baseformat, "<", "LOGOUT", "", sender); |
---|
| 499 | owl_fmtext_append_normal(fm, tmp); |
---|
| 500 | owl_free(tmp); |
---|
| 501 | } |
---|
| 502 | |
---|
| 503 | owl_fmtext_append_normal(fm, "at "); |
---|
| 504 | owl_fmtext_append_normal(fm, host); |
---|
| 505 | owl_fmtext_append_normal(fm, " "); |
---|
| 506 | owl_fmtext_append_normal(fm, tty); |
---|
[8b32593] | 507 | owl_fmtext_append_normal(fm, "\n"); |
---|
[778d0a9] | 508 | |
---|
| 509 | owl_free(host); |
---|
| 510 | owl_free(tty); |
---|
| 511 | |
---|
[8b32593] | 512 | } else if (owl_message_is_ping(m)) { |
---|
[5ea6fea] | 513 | tmp=owl_sprintf(baseformat, "<", "PING", "", sender); |
---|
[8b32593] | 514 | owl_fmtext_append_normal(fm, tmp); |
---|
| 515 | owl_fmtext_append_normal(fm, "\n"); |
---|
[5ea6fea] | 516 | owl_free(tmp); |
---|
[778d0a9] | 517 | |
---|
[8b32593] | 518 | } else { |
---|
| 519 | if (owl_message_is_direction_in(m)) { |
---|
[5ea6fea] | 520 | tmp=owl_sprintf(baseformat, "<", owl_message_get_class(m), owl_message_get_instance(m), sender); |
---|
[8b32593] | 521 | } else if (owl_message_is_direction_out(m)) { |
---|
[5ea6fea] | 522 | tmp=owl_sprintf(baseformat, ">", owl_message_get_class(m), owl_message_get_instance(m), recip); |
---|
[8b32593] | 523 | } else { |
---|
[5ea6fea] | 524 | tmp=owl_sprintf(baseformat, "-", owl_message_get_class(m), owl_message_get_instance(m), sender); |
---|
[8b32593] | 525 | } |
---|
| 526 | owl_fmtext_append_normal(fm, tmp); |
---|
| 527 | if (tmp) owl_free(tmp); |
---|
| 528 | |
---|
| 529 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 530 | owl_util_tr(tmp, '\n', ' '); |
---|
[65e3901] | 531 | owl_fmtext_append_ztext(fm, tmp); |
---|
[8b32593] | 532 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 533 | if (tmp) owl_free(tmp); |
---|
| 534 | } |
---|
| 535 | |
---|
| 536 | /* make personal messages bold for smaat users */ |
---|
[c3ab155] | 537 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && |
---|
| 538 | owl_message_is_personal(m) && |
---|
| 539 | owl_message_is_direction_in(m)) { |
---|
[8b32593] | 540 | owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); |
---|
| 541 | } |
---|
[5ea6fea] | 542 | |
---|
| 543 | owl_free(sender); |
---|
| 544 | owl_free(recip); |
---|
[09489b89] | 545 | #endif |
---|
[8b32593] | 546 | } else if (owl_message_is_type_aim(m)) { |
---|
| 547 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
| 548 | if (owl_message_is_login(m)) { |
---|
[5ea6fea] | 549 | tmp=owl_sprintf(baseformat, "<", "AIM LOGIN", "", owl_message_get_sender(m)); |
---|
[8b32593] | 550 | owl_fmtext_append_normal(fm, tmp); |
---|
| 551 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 552 | if (tmp) owl_free(tmp); |
---|
| 553 | } else if (owl_message_is_logout(m)) { |
---|
[5ea6fea] | 554 | tmp=owl_sprintf(baseformat, "<", "AIM LOGOUT", "", owl_message_get_sender(m)); |
---|
[8b32593] | 555 | owl_fmtext_append_normal(fm, tmp); |
---|
| 556 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 557 | if (tmp) owl_free(tmp); |
---|
| 558 | } else { |
---|
| 559 | if (owl_message_is_direction_in(m)) { |
---|
[5ea6fea] | 560 | tmp=owl_sprintf(baseformat, "<", "AIM", "", owl_message_get_sender(m)); |
---|
[8b32593] | 561 | owl_fmtext_append_normal(fm, tmp); |
---|
| 562 | if (tmp) owl_free(tmp); |
---|
| 563 | } else if (owl_message_is_direction_out(m)) { |
---|
[5ea6fea] | 564 | tmp=owl_sprintf(baseformat, ">", "AIM", "", owl_message_get_recipient(m)); |
---|
[8b32593] | 565 | owl_fmtext_append_normal(fm, tmp); |
---|
| 566 | if (tmp) owl_free(tmp); |
---|
| 567 | } |
---|
| 568 | |
---|
| 569 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 570 | owl_util_tr(tmp, '\n', ' '); |
---|
| 571 | owl_fmtext_append_normal(fm, tmp); |
---|
| 572 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 573 | if (tmp) owl_free(tmp); |
---|
| 574 | |
---|
[0c502e9] | 575 | /* make personal messages bold for smaat users */ |
---|
[9c4ec91] | 576 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_direction_in(m)) { |
---|
[0c502e9] | 577 | owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); |
---|
| 578 | } |
---|
[8b32593] | 579 | } |
---|
| 580 | } else if (owl_message_is_type_admin(m)) { |
---|
| 581 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
| 582 | owl_fmtext_append_normal(fm, "< ADMIN "); |
---|
| 583 | |
---|
| 584 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 585 | owl_util_tr(tmp, '\n', ' '); |
---|
| 586 | owl_fmtext_append_normal(fm, tmp); |
---|
| 587 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 588 | if (tmp) owl_free(tmp); |
---|
[37eab7f] | 589 | } else { |
---|
| 590 | owl_fmtext_append_spaces(fm, OWL_TAB); |
---|
| 591 | owl_fmtext_append_normal(fm, "< LOOPBACK "); |
---|
| 592 | |
---|
| 593 | tmp=owl_strdup(owl_message_get_body(m)); |
---|
| 594 | owl_util_tr(tmp, '\n', ' '); |
---|
| 595 | owl_fmtext_append_normal(fm, tmp); |
---|
| 596 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 597 | if (tmp) owl_free(tmp); |
---|
| 598 | } |
---|
[8b32593] | 599 | |
---|
| 600 | } |
---|
[ec6ff52] | 601 | |
---|
| 602 | void owl_stylefunc_vt(owl_fmtext *fm, owl_message *m) |
---|
| 603 | { |
---|
| 604 | #ifdef HAVE_LIBZEPHYR |
---|
| 605 | char *body, *indent, *ptr, *zsigbuff, frombuff[LINE]; |
---|
| 606 | owl_fmtext fm_first, fm_other, fm_tmp; |
---|
| 607 | ZNotice_t *n; |
---|
| 608 | #endif |
---|
| 609 | char *sender, *hostname, *timestr, *classinst1, *classinst2; |
---|
| 610 | |
---|
| 611 | if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { |
---|
| 612 | #ifdef HAVE_LIBZEPHYR |
---|
| 613 | n=owl_message_get_notice(m); |
---|
| 614 | |
---|
| 615 | /* get the body */ |
---|
| 616 | body=owl_malloc(strlen(owl_message_get_body(m))+30); |
---|
| 617 | strcpy(body, owl_message_get_body(m)); |
---|
| 618 | |
---|
| 619 | /* add a newline if we need to */ |
---|
| 620 | if (body[0]!='\0' && body[strlen(body)-1]!='\n') { |
---|
| 621 | strcat(body, "\n"); |
---|
| 622 | } |
---|
| 623 | |
---|
| 624 | owl_fmtext_init_null(&fm_tmp); |
---|
| 625 | owl_fmtext_append_ztext(&fm_tmp, body); |
---|
| 626 | owl_fmtext_init_null(&fm_first); |
---|
| 627 | owl_fmtext_truncate_lines(&fm_tmp, 0, 1, &fm_first); |
---|
| 628 | |
---|
| 629 | /* do the indenting into indent */ |
---|
| 630 | indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); |
---|
| 631 | owl_text_indent(indent, body, 31); |
---|
| 632 | |
---|
| 633 | owl_fmtext_free(&fm_tmp); |
---|
| 634 | owl_fmtext_init_null(&fm_tmp); |
---|
| 635 | owl_fmtext_append_ztext(&fm_tmp, indent); |
---|
| 636 | owl_fmtext_init_null(&fm_other); |
---|
| 637 | owl_fmtext_truncate_lines(&fm_tmp, 1, owl_fmtext_num_lines(&fm_tmp)-1, &fm_other); |
---|
| 638 | owl_fmtext_free(&fm_tmp); |
---|
| 639 | |
---|
| 640 | /* edit the from addr for printing */ |
---|
| 641 | strcpy(frombuff, owl_message_get_sender(m)); |
---|
| 642 | ptr=strchr(frombuff, '@'); |
---|
| 643 | if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) { |
---|
| 644 | *ptr='\0'; |
---|
| 645 | } |
---|
| 646 | sender=owl_sprintf("%-9.9s", frombuff); |
---|
| 647 | |
---|
| 648 | hostname=owl_sprintf("%-9.9s", owl_message_get_hostname(m)); |
---|
| 649 | timestr=owl_strdup("00:00"); |
---|
| 650 | classinst1=owl_sprintf("<%s>[%s]", owl_message_get_class(m), owl_message_get_instance(m)); |
---|
| 651 | classinst2=owl_sprintf("%-9.9s", classinst1); |
---|
| 652 | |
---|
| 653 | /* set the message for printing */ |
---|
| 654 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 655 | |
---|
| 656 | if (owl_message_is_ping(m) && owl_message_is_private(m)) { |
---|
| 657 | owl_fmtext_append_bold(fm, "PING"); |
---|
| 658 | owl_fmtext_append_normal(fm, " from "); |
---|
| 659 | owl_fmtext_append_bold(fm, frombuff); |
---|
| 660 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 661 | } else if (owl_message_is_loginout(m)) { |
---|
| 662 | char *ptr, *host, *tty; |
---|
| 663 | int len; |
---|
| 664 | |
---|
| 665 | ptr=owl_zephyr_get_field(n, 1, &len); |
---|
| 666 | host=owl_malloc(len+10); |
---|
| 667 | strncpy(host, ptr, len); |
---|
| 668 | host[len]='\0'; |
---|
| 669 | |
---|
| 670 | ptr=owl_zephyr_get_field(n, 3, &len); |
---|
| 671 | tty=owl_malloc(len+10); |
---|
| 672 | strncpy(tty, ptr, len); |
---|
| 673 | tty[len]='\0'; |
---|
| 674 | |
---|
| 675 | if (owl_message_is_login(m)) { |
---|
| 676 | owl_fmtext_append_bold(fm, "LOGIN"); |
---|
| 677 | } else if (owl_message_is_logout(m)) { |
---|
| 678 | owl_fmtext_append_bold(fm, "LOGOUT"); |
---|
| 679 | } |
---|
| 680 | owl_fmtext_append_normal(fm, " for "); |
---|
| 681 | ptr=short_zuser(owl_message_get_instance(m)); |
---|
| 682 | owl_fmtext_append_bold(fm, ptr); |
---|
| 683 | owl_free(ptr); |
---|
| 684 | owl_fmtext_append_normal(fm, " at "); |
---|
| 685 | owl_fmtext_append_normal(fm, host); |
---|
| 686 | owl_fmtext_append_normal(fm, " "); |
---|
| 687 | owl_fmtext_append_normal(fm, tty); |
---|
| 688 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 689 | |
---|
| 690 | owl_free(host); |
---|
| 691 | owl_free(tty); |
---|
| 692 | } else { |
---|
| 693 | owl_fmtext_append_normal(fm, sender); |
---|
| 694 | owl_fmtext_append_normal(fm, "|"); |
---|
| 695 | owl_fmtext_append_normal(fm, hostname); |
---|
| 696 | owl_fmtext_append_normal(fm, " "); |
---|
| 697 | owl_fmtext_append_normal(fm, timestr); |
---|
| 698 | owl_fmtext_append_normal(fm, " "); |
---|
| 699 | owl_fmtext_append_normal(fm, classinst2); |
---|
| 700 | |
---|
| 701 | owl_fmtext_append_normal(fm, " "); |
---|
| 702 | owl_fmtext_append_fmtext(fm, &fm_first); |
---|
| 703 | owl_fmtext_append_fmtext(fm, &fm_other); |
---|
| 704 | |
---|
| 705 | owl_fmtext_free(&fm_other); |
---|
| 706 | owl_fmtext_free(&fm_first); |
---|
| 707 | |
---|
| 708 | /* make private messages bold for smaat users */ |
---|
| 709 | if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { |
---|
| 710 | if (owl_message_is_personal(m)) { |
---|
| 711 | owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD); |
---|
| 712 | } |
---|
| 713 | } |
---|
| 714 | } |
---|
| 715 | |
---|
| 716 | owl_free(sender); |
---|
| 717 | owl_free(hostname); |
---|
| 718 | owl_free(timestr); |
---|
| 719 | owl_free(classinst1); |
---|
| 720 | owl_free(classinst2); |
---|
| 721 | |
---|
| 722 | owl_free(body); |
---|
| 723 | owl_free(indent); |
---|
| 724 | #endif |
---|
| 725 | } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) { |
---|
| 726 | char *indent, *text, *zsigbuff, *foo; |
---|
| 727 | |
---|
| 728 | text=owl_message_get_body(m); |
---|
| 729 | |
---|
| 730 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 731 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 732 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 733 | owl_fmtext_append_normal(fm, "Zephyr sent to "); |
---|
| 734 | foo=short_zuser(owl_message_get_recipient(m)); |
---|
| 735 | owl_fmtext_append_normal(fm, foo); |
---|
| 736 | owl_free(foo); |
---|
| 737 | owl_fmtext_append_normal(fm, " (Zsig: "); |
---|
| 738 | |
---|
| 739 | zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); |
---|
| 740 | owl_message_pretty_zsig(m, zsigbuff); |
---|
| 741 | owl_fmtext_append_ztext(fm, zsigbuff); |
---|
| 742 | owl_free(zsigbuff); |
---|
| 743 | |
---|
| 744 | owl_fmtext_append_normal(fm, ")"); |
---|
| 745 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 746 | owl_fmtext_append_ztext(fm, indent); |
---|
| 747 | if (text[strlen(text)-1]!='\n') { |
---|
| 748 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 749 | } |
---|
| 750 | |
---|
| 751 | owl_free(indent); |
---|
| 752 | } else if (owl_message_is_type_aim(m)) { |
---|
| 753 | char *indent; |
---|
| 754 | |
---|
| 755 | if (owl_message_is_loginout(m)) { |
---|
| 756 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 757 | if (owl_message_is_login(m)) { |
---|
| 758 | owl_fmtext_append_bold(fm, "AIM LOGIN"); |
---|
| 759 | } else { |
---|
| 760 | owl_fmtext_append_bold(fm, "AIM LOGOUT"); |
---|
| 761 | } |
---|
| 762 | owl_fmtext_append_normal(fm, " for "); |
---|
| 763 | owl_fmtext_append_normal(fm, owl_message_get_sender(m)); |
---|
| 764 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 765 | } else if (owl_message_is_direction_in(m)) { |
---|
| 766 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 767 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 768 | owl_fmtext_append_bold(fm, OWL_TABSTR); |
---|
| 769 | owl_fmtext_append_bold(fm, "AIM from "); |
---|
| 770 | owl_fmtext_append_bold(fm, owl_message_get_sender(m)); |
---|
| 771 | owl_fmtext_append_bold(fm, "\n"); |
---|
| 772 | owl_fmtext_append_bold(fm, indent); |
---|
| 773 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 774 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 775 | } |
---|
| 776 | owl_free(indent); |
---|
| 777 | } else if (owl_message_is_direction_out(m)) { |
---|
| 778 | indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); |
---|
| 779 | owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); |
---|
| 780 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 781 | owl_fmtext_append_normal(fm, "AIM sent to "); |
---|
| 782 | owl_fmtext_append_normal(fm, owl_message_get_recipient(m)); |
---|
| 783 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 784 | owl_fmtext_append_ztext(fm, indent); |
---|
| 785 | if (indent[strlen(indent)-1]!='\n') { |
---|
| 786 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 787 | } |
---|
| 788 | owl_free(indent); |
---|
| 789 | } |
---|
| 790 | } else if (owl_message_is_type_admin(m)) { |
---|
| 791 | char *text, *header, *indent; |
---|
| 792 | |
---|
| 793 | text=owl_message_get_body(m); |
---|
| 794 | header=owl_message_get_attribute_value(m, "adminheader"); |
---|
| 795 | |
---|
| 796 | indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); |
---|
| 797 | owl_text_indent(indent, text, OWL_MSGTAB); |
---|
| 798 | owl_fmtext_append_normal(fm, OWL_TABSTR); |
---|
| 799 | owl_fmtext_append_bold(fm, "OWL ADMIN "); |
---|
| 800 | owl_fmtext_append_ztext(fm, header); |
---|
| 801 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 802 | owl_fmtext_append_ztext(fm, indent); |
---|
| 803 | if (text[strlen(text)-1]!='\n') { |
---|
| 804 | owl_fmtext_append_normal(fm, "\n"); |
---|
| 805 | } |
---|
| 806 | |
---|
| 807 | owl_free(indent); |
---|
[37eab7f] | 808 | } else { |
---|
| 809 | |
---|
[ec6ff52] | 810 | } |
---|
| 811 | } |
---|