| | @@ -392,17 +392,18 @@ |
| 392 | 392 | const char *zUser /* User who owns it, or NULL if does not matter */ |
| 393 | 393 | ){ |
| 394 | 394 | Blob sql; |
| 395 | 395 | Stmt q; |
| 396 | 396 | int eState = -1; |
| 397 | + int eTranscript = 0; |
| 397 | 398 | char zENum[30]; |
| 398 | 399 | style_submenu_element("Index", "%s", url_render(pUrl,"id",0,0,0)); |
| 399 | 400 | webmail_f_submenu(); |
| 400 | 401 | blob_init(&sql, 0, 0); |
| 401 | 402 | db_begin_transaction(); |
| 402 | 403 | blob_append_sql(&sql, |
| 403 | | - "SELECT decompress(etxt), estate" |
| 404 | + "SELECT decompress(etxt), estate, emailblob.ets" |
| 404 | 405 | " FROM emailblob, emailbox" |
| 405 | 406 | " WHERE emailid=emsgid AND ebid=%d", |
| 406 | 407 | emailid |
| 407 | 408 | ); |
| 408 | 409 | if( zUser ) blob_append_sql(&sql, " AND euser=%Q", zUser); |
| | @@ -411,10 +412,11 @@ |
| 411 | 412 | style_header("Message %d",emailid); |
| 412 | 413 | if( db_step(&q)==SQLITE_ROW ){ |
| 413 | 414 | Blob msg = db_column_text_as_blob(&q, 0); |
| 414 | 415 | int eFormat = atoi(PD("f","0")); |
| 415 | 416 | eState = db_column_int(&q, 1); |
| 417 | + eTranscript = db_column_int(&q, 2); |
| 416 | 418 | if( eFormat==2 ){ |
| 417 | 419 | @ <pre>%h(db_column_text(&q, 0))</pre> |
| 418 | 420 | }else{ |
| 419 | 421 | EmailToc *p = emailtoc_from_email(&msg); |
| 420 | 422 | int i, j; |
| | @@ -458,10 +460,29 @@ |
| 458 | 460 | @ <pre>%h(p->aBody[i].zContent)</pre> |
| 459 | 461 | } |
| 460 | 462 | } |
| 461 | 463 | } |
| 462 | 464 | db_finalize(&q); |
| 465 | + |
| 466 | + /* Optionally show the SMTP transcript */ |
| 467 | + if( eTranscript>0 ){ |
| 468 | + if( P("ts")==0 ){ |
| 469 | + sqlite3_snprintf(sizeof(zENum), zENum, "%d", emailid); |
| 470 | + style_submenu_element("SMTP Transcript","%s", |
| 471 | + url_render(pUrl, "ts", "1", "id", zENum)); |
| 472 | + }else{ |
| 473 | + db_prepare(&q, |
| 474 | + "SELECT decompress(etxt) FROM emailblob WHERE emailid=%d", eTranscript |
| 475 | + ); |
| 476 | + if( db_step(&q)==SQLITE_ROW ){ |
| 477 | + const char *zTranscript = db_column_text(&q, 0); |
| 478 | + @ <hr> |
| 479 | + @ <pre>%h(zTranscript)</pre> |
| 480 | + } |
| 481 | + db_finalize(&q); |
| 482 | + } |
| 483 | + } |
| 463 | 484 | |
| 464 | 485 | if( eState==0 ){ |
| 465 | 486 | /* If is message is currently Unread, change it to Read */ |
| 466 | 487 | blob_append_sql(&sql, |
| 467 | 488 | "UPDATE emailbox SET estate=1 " |
| 468 | 489 | |