Changeset 5027:e9451c4c0092
- Timestamp:
- 2007-03-30 19:22:55 (22 months ago)
- Author:
- Brendan Cully <brendan@…>
- Branch:
- default
- Message:
-
Add function pointer for close hook in Context.
Slowly inch towards function pointers instead of switch statements.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5026
|
r5027
|
|
| 570 | 570 | /* once again the context is new */ |
| 571 | 571 | ctx->data = idata; |
| | 572 | ctx->mx_close = imap_close_mailbox; |
| 572 | 573 | |
| 573 | 574 | /* Clean up path and replace the one in the ctx */ |
-
|
r5011
|
r5027
|
|
| 857 | 857 | }; |
| 858 | 858 | |
| 859 | | typedef struct |
| | 859 | typedef struct _context |
| 860 | 860 | { |
| 861 | 861 | char *path; |
| … |
… |
|
| 883 | 883 | int flagged; /* how many flagged messages */ |
| 884 | 884 | int msgnotreadyet; /* which msg "new" in pager, -1 if none */ |
| 885 | | #if defined USE_POP || defined USE_IMAP |
| 886 | | void *data; /* driver specific data */ |
| 887 | | #endif /* USE_IMAP */ |
| 888 | 885 | |
| 889 | 886 | short magic; /* mailbox type */ |
| … |
… |
|
| 899 | 896 | unsigned int collapsed : 1; /* are all threads collapsed? */ |
| 900 | 897 | unsigned int closing : 1; /* mailbox is being closed */ |
| | 898 | |
| | 899 | /* driver hooks */ |
| | 900 | void *data; /* driver specific data */ |
| | 901 | int (*mx_close)(struct _context *); |
| 901 | 902 | } CONTEXT; |
| 902 | 903 | |
-
|
r5016
|
r5027
|
|
| 741 | 741 | if(!ctx) |
| 742 | 742 | return; |
| 743 | | |
| 744 | | #ifdef USE_IMAP |
| 745 | | if (ctx->magic == M_IMAP) |
| 746 | | imap_close_mailbox (ctx); |
| 747 | | #endif /* USE_IMAP */ |
| 748 | | #ifdef USE_POP |
| 749 | | if (ctx->magic == M_POP) |
| 750 | | pop_close_mailbox (ctx); |
| 751 | | #endif /* USE_POP */ |
| | 743 | |
| | 744 | if (ctx->mx_close) |
| | 745 | ctx->mx_close (ctx); |
| | 746 | |
| 752 | 747 | if (ctx->subj_hash) |
| 753 | 748 | hash_destroy (&ctx->subj_hash, NULL); |
-
|
r4886
|
r5027
|
|
| 373 | 373 | pop_data->conn = conn; |
| 374 | 374 | ctx->data = pop_data; |
| | 375 | ctx->mx_close = pop_close_mailbox; |
| 375 | 376 | |
| 376 | 377 | if (pop_open_connection (pop_data) < 0) |