| 578 | } |
| 579 | |
| 580 | static void logger(mailimap * imap, int log_type, const char * buffer, size_t size, void * context) |
| 581 | { |
| 582 | IMAPSession * session = (IMAPSession *) context; |
| 583 | session->lockConnectionLogger(); |
| 584 | |
| 585 | if (session->connectionLoggerNoLock() == NULL) { |
| 586 | session->unlockConnectionLogger(); |
| 587 | return; |
| 588 | } |
| 589 | |
| 590 | ConnectionLogType type = getConnectionType(log_type); |
| 591 | if ((int) type == -1) { |
| 592 | session->unlockConnectionLogger(); |
| 593 | return; |
| 594 | } |
| 595 | |
| 596 | bool isBuffer = isBufferFromLogType(log_type); |
| 597 | |
| 598 | if (isBuffer) { |
| 599 | AutoreleasePool * pool = new AutoreleasePool(); |
| 600 | Data * data = Data::dataWithBytes(buffer, (unsigned int) size); |
| 601 | session->connectionLoggerNoLock()->log(session, type, data); |
| 602 | pool->release(); |
| 603 | } |
| 604 | else { |
| 605 | session->connectionLoggerNoLock()->log(session, type, NULL); |
| 606 | } |
| 607 | session->unlockConnectionLogger(); |
| 608 | } |
| 609 | |
| 610 | void IMAPSession::setup() |
| 611 | { |
nothing calls this directly
no test coverage detected