aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-06-10 08:11:08 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-06-10 08:11:08 +0000
commitca06cd994b09cbb500b35af30c8bd75dc3e0e5b7 (patch)
tree3474db42cb4b1c42007cfb84ec24ca8331b50dba /libsylph
parent81f0f7394f9c47a30314f2884be6d4bdae302673 (diff)
merged plugin-test branch into trunk.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2164 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/Makefile.am145
-rw-r--r--libsylph/defs.h1
-rw-r--r--libsylph/folder.c3
-rw-r--r--libsylph/imap.c2
-rw-r--r--libsylph/libsylph-0.def653
-rw-r--r--libsylph/mh.c22
-rw-r--r--libsylph/prefs_common.c7
-rw-r--r--libsylph/prefs_common.h7
-rw-r--r--libsylph/procheader.c4
-rw-r--r--libsylph/procmsg.c27
-rw-r--r--libsylph/syl-marshal.c131
-rw-r--r--libsylph/syl-marshal.h34
-rw-r--r--libsylph/syl-marshal.list4
-rw-r--r--libsylph/sylmain.c327
-rw-r--r--libsylph/sylmain.h57
15 files changed, 1368 insertions, 56 deletions
diff --git a/libsylph/Makefile.am b/libsylph/Makefile.am
index 5df644bd..eecc144b 100644
--- a/libsylph/Makefile.am
+++ b/libsylph/Makefile.am
@@ -1,50 +1,113 @@
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"LibSylph\" \
- -DSYSCONFDIR=\""$(sysconfdir)"\"
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DLOCALEDIR=\""$(localedir)"\"
INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir) -I$(includedir)
-#lib_LTLIBRARIES = libsylph.la
-noinst_LTLIBRARIES = libsylph.la
+lib_LTLIBRARIES = libsylph-0.la
+#noinst_LTLIBRARIES = libsylph.la
-libsylph_la_SOURCES = \
+libsylph_0_la_SOURCES = \
+ account.c \
+ base64.c \
+ codeconv.c \
+ customheader.c \
+ displayheader.c \
+ filter.c \
+ folder.c \
+ html.c \
+ imap.c \
+ mbox.c \
+ md5.c \
+ md5_hmac.c \
+ mh.c \
+ news.c \
+ nntp.c \
+ pop.c \
+ prefs.c \
+ prefs_account.c \
+ prefs_common.c \
+ procheader.c \
+ procmime.c \
+ procmsg.c \
+ quoted-printable.c \
+ recv.c \
+ session.c \
+ smtp.c \
+ socket.c \
+ ssl.c \
+ stringtable.c \
+ sylmain.c \
+ unmime.c \
+ utils.c \
+ uuencode.c \
+ virtual.c \
+ xml.c \
+ syl-marshal.c
+
+libsylph_0includedir=$(includedir)/sylpheed/sylph
+libsylph_0include_HEADERS = \
defs.h \
enums.h \
- account.c account.h \
- base64.c base64.h \
- codeconv.c codeconv.h \
- customheader.c customheader.h \
- displayheader.c displayheader.h \
- filter.c filter.h \
- folder.c folder.h \
- html.c html.h \
- imap.c imap.h \
- mbox.c mbox.h \
- md5.c md5.h \
- md5_hmac.c md5_hmac.h \
- mh.c mh.h \
- news.c news.h \
- nntp.c nntp.h \
- pop.c pop.h \
- prefs.c prefs.h \
- prefs_account.c prefs_account.h \
- prefs_common.c prefs_common.h \
- procheader.c procheader.h \
- procmime.c procmime.h \
- procmsg.c procmsg.h \
- quoted-printable.c quoted-printable.h \
- recv.c recv.h \
- session.c session.h \
- smtp.c smtp.h \
- socket.c socket.h \
- ssl.c ssl.h \
- stringtable.c stringtable.h \
- unmime.c unmime.h \
- utils.c utils.h \
- uuencode.c uuencode.h \
- virtual.c virtual.h \
- xml.c xml.h
-
-libsylph_la_LDFLAGS =
-libsylph_la_LIBADD = $(GLIB_LIBS)
+ account.h \
+ base64.h \
+ codeconv.h \
+ customheader.h \
+ displayheader.h \
+ filter.h \
+ folder.h \
+ html.h \
+ imap.h \
+ mbox.h \
+ md5.h \
+ md5_hmac.h \
+ mh.h \
+ news.h \
+ nntp.h \
+ pop.h \
+ prefs.h \
+ prefs_account.h \
+ prefs_common.h \
+ procheader.h \
+ procmime.h \
+ procmsg.h \
+ quoted-printable.h \
+ recv.h \
+ session.h \
+ smtp.h \
+ socket.h \
+ ssl.h \
+ stringtable.h \
+ sylmain.h \
+ unmime.h \
+ utils.h \
+ uuencode.h \
+ virtual.h \
+ xml.h \
+ syl-marshal.h
+
+BUILT_SOURCES = \
+ syl-marshal.c \
+ syl-marshal.h
+
+EXTRA_DIST = \
+ syl-marshal.list \
+ libsylph-0.def
+
+if NATIVE_WIN32
+no_undefined = -no-undefined
+export_symbols = -export-symbols libsylph-0.def
+endif
+
+libsylph_0_la_LDFLAGS = \
+ -export-dynamic $(no_undefined) $(export_symbols)
+
+libsylph_0_la_LIBADD = $(GLIB_LIBS)
+
+syl-marshal.h: syl-marshal.list
+ $(GLIB_GENMARSHAL) $< --header --prefix=syl_marshal > $@
+
+syl-marshal.c: syl-marshal.list
+ $(GLIB_GENMARSHAL) $< --body --prefix=syl_marshal > $@
diff --git a/libsylph/defs.h b/libsylph/defs.h
index 973242a2..baa7c676 100644
--- a/libsylph/defs.h
+++ b/libsylph/defs.h
@@ -70,6 +70,7 @@
#define MANUAL_HTML_INDEX "sylpheed.html"
#define FAQ_HTML_INDEX "sylpheed-faq.html"
#define HOMEPAGE_URI "http://sylpheed.sraoss.jp/"
+#define VERSION_URI "http://sylpheed.sraoss.jp/version.txt"
#define FOLDER_LIST "folderlist.xml"
#define CACHE_FILE ".sylpheed_cache"
#define MARK_FILE ".sylpheed_mark"
diff --git a/libsylph/folder.c b/libsylph/folder.c
index ea8dbe6d..0f6d054c 100644
--- a/libsylph/folder.c
+++ b/libsylph/folder.c
@@ -41,6 +41,7 @@
#include "prefs.h"
#include "account.h"
#include "prefs_account.h"
+#include "sylmain.h"
static GList *folder_list = NULL;
@@ -472,6 +473,8 @@ void folder_write_list(void)
if (prefs_file_close(pfile) < 0)
g_warning("failed to write folder list.\n");
+
+ g_signal_emit_by_name(syl_app_get(), "folderlist-updated");
}
struct TotalMsgStatus
diff --git a/libsylph/imap.c b/libsylph/imap.c
index 502fcc39..6213f273 100644
--- a/libsylph/imap.c
+++ b/libsylph/imap.c
@@ -433,6 +433,8 @@ static void imap_folder_destroy(Folder *folder)
{
gchar *dir;
+ g_return_if_fail(folder->account != NULL);
+
dir = folder_get_path(folder);
if (is_dir_exist(dir))
remove_dir_recursive(dir);
diff --git a/libsylph/libsylph-0.def b/libsylph/libsylph-0.def
new file mode 100644
index 00000000..bd571d98
--- /dev/null
+++ b/libsylph/libsylph-0.def
@@ -0,0 +1,653 @@
+; c:\MinGW\bin\dlltool.exe -z libsylph-0.def --export-all-symbols --exclude-symbols _s_tempnam .libs/account.o .libs/base64.o .libs/codeconv.o .libs/customheader.o .libs/displayheader.o .libs/filter.o .libs/folder.o .libs/html.o .libs/imap.o .libs/mbox.o .libs/md5.o .libs/md5_hmac.o .libs/mh.o .libs/news.o .libs/nntp.o .libs/pop.o .libs/prefs.o .libs/prefs_account.o .libs/prefs_common.o .libs/procheader.o .libs/procmime.o .libs/procmsg.o .libs/quoted-printable.o .libs/recv.o .libs/session.o .libs/smtp.o .libs/socket.o .libs/ssl.o .libs/stringtable.o .libs/syl-marshal.o .libs/sylmain.o .libs/unmime.o .libs/utils.o .libs/uuencode.o .libs/virtual.o .libs/xml.o
+EXPORTS
+ account_address_exist @ 1
+ account_append @ 2
+ account_destroy @ 3
+ account_find_from_address @ 4
+ account_find_from_id @ 5
+ account_find_from_item @ 6
+ account_find_from_item_property @ 7
+ account_find_from_message_file @ 8
+ account_find_from_msginfo @ 9
+ account_find_from_smtp_server @ 10
+ account_foreach @ 11
+ account_get_current_account @ 12
+ account_get_default @ 13
+ account_get_list @ 14
+ account_get_special_folder @ 15
+ account_list_free @ 16
+ account_read_config_all @ 17
+ account_set_as_default @ 18
+ account_updated @ 19
+ account_write_config_all @ 20
+ add_history @ 21
+ address_equal @ 22
+ address_list_append @ 23
+ address_list_append_orig @ 24
+ address_table @ 25 DATA
+ base64_decode @ 26
+ base64_decoder_decode @ 27
+ base64_decoder_free @ 28
+ base64_decoder_new @ 29
+ base64_encode @ 30
+ canonicalize_file @ 31
+ canonicalize_file_replace @ 32
+ canonicalize_file_stream @ 33
+ canonicalize_str @ 34
+ change_dir @ 35
+ change_file_mode_rw @ 36
+ check_line_length @ 37
+ close_log_file @ 38
+ conv_check_file_encoding @ 39
+ conv_code_converter_destroy @ 40
+ conv_code_converter_new @ 41
+ conv_codeset_strdup_full @ 42
+ conv_convert @ 43
+ conv_copy_dir @ 44
+ conv_copy_file @ 45
+ conv_encode_filename @ 46
+ conv_encode_header @ 47
+ conv_filename_from_utf8 @ 48
+ conv_filename_to_utf8 @ 49
+ conv_get_autodetect_type @ 50
+ conv_get_charset_from_str @ 51
+ conv_get_charset_str @ 52
+ conv_get_code_conv_func @ 53
+ conv_get_current_locale @ 54
+ conv_get_internal_charset @ 55
+ conv_get_internal_charset_str @ 56
+ conv_get_locale_charset @ 57
+ conv_get_locale_charset_str @ 58
+ conv_get_outgoing_charset @ 59
+ conv_get_outgoing_charset_str @ 60
+ conv_guess_ja_encoding @ 61
+ conv_iconv_strdup @ 62
+ conv_iconv_strdup_with_cd @ 63
+ conv_is_ja_locale @ 64
+ conv_is_multibyte_encoding @ 65
+ conv_localetodisp @ 66
+ conv_mb_alnum @ 67
+ conv_set_autodetect_type @ 68
+ conv_unmime_header @ 69
+ conv_utf8todisp @ 70
+ copy_dir @ 71
+ copy_file @ 72
+ copy_file_part @ 73
+ copy_mbox @ 74
+ cur_account @ 75 DATA
+ custom_header_find @ 76
+ custom_header_free @ 77
+ custom_header_get_str @ 78
+ custom_header_read_config @ 79
+ custom_header_read_str @ 80
+ custom_header_write_config @ 81
+ debug_print @ 82
+ decode_uri @ 83
+ decode_xdigit_encoded_str @ 84
+ dirent_is_directory @ 85
+ dirent_is_regular_file @ 86
+ display_header_prop_free @ 87
+ display_header_prop_get_str @ 88
+ display_header_prop_read_str @ 89
+ eliminate_address_comment @ 90
+ eliminate_parenthesis @ 91
+ eliminate_quote @ 92
+ empty_mbox @ 93
+ encode_uri @ 94
+ execute_async @ 95
+ execute_command_line @ 96
+ execute_open_file @ 97
+ execute_print_file @ 98
+ execute_sync @ 99
+ export_to_mbox @ 100
+ extract_address @ 101
+ extract_list_id_str @ 102
+ extract_parenthesis @ 103
+ extract_parenthesis_with_escape @ 104
+ extract_parenthesis_with_skip_quote @ 105
+ extract_quote @ 106
+ extract_quote_with_escape @ 107
+ fd_accept @ 108
+ fd_close @ 109
+ fd_connect_inet @ 110
+ fd_connect_unix @ 111
+ fd_getline @ 112
+ fd_gets @ 113
+ fd_open_inet @ 114
+ fd_open_unix @ 115
+ fd_read @ 116
+ fd_recv @ 117
+ fd_write @ 118
+ fd_write_all @ 119
+ file_exist @ 120
+ file_read_stream_to_str @ 121
+ file_read_to_str @ 122
+ filter_action_exec @ 123
+ filter_action_list_free @ 124
+ filter_action_new @ 125
+ filter_apply @ 126
+ filter_apply_msginfo @ 127
+ filter_cond_list_free @ 128
+ filter_cond_new @ 129
+ filter_get_keyword_from_msg @ 130
+ filter_get_str @ 131
+ filter_info_free @ 132
+ filter_info_new @ 133
+ filter_list_delete_path @ 134
+ filter_list_rename_path @ 135
+ filter_match_rule @ 136
+ filter_read_config @ 137
+ filter_read_file @ 138
+ filter_read_str @ 139
+ filter_rule_delete_action_by_dest_path @ 140
+ filter_rule_free @ 141
+ filter_rule_list_free @ 142
+ filter_rule_match_type_str_to_enum @ 143
+ filter_rule_new @ 144
+ filter_rule_rename_dest_path @ 145
+ filter_rule_requires_full_headers @ 146
+ filter_write_config @ 147
+ filter_write_file @ 148
+ filter_xml_node_to_filter_list @ 149
+ folder_add @ 150
+ folder_create_tree @ 151
+ folder_destroy @ 152
+ folder_find_child_item_by_name @ 153
+ folder_find_from_name @ 154
+ folder_find_from_path @ 155
+ folder_find_item_and_num_from_id @ 156
+ folder_find_item_from_identifier @ 157
+ folder_find_item_from_path @ 158
+ folder_get_default_draft @ 159
+ folder_get_default_folder @ 160
+ folder_get_default_inbox @ 161
+ folder_get_default_outbox @ 162
+ folder_get_default_queue @ 163
+ folder_get_default_trash @ 164
+ folder_get_identifier @ 165
+ folder_get_list @ 166
+ folder_get_path @ 167
+ folder_get_status @ 168
+ folder_item_add_msg @ 169
+ folder_item_add_msgs @ 170
+ folder_item_append @ 171
+ folder_item_close @ 172
+ folder_item_compare @ 173
+ folder_item_copy @ 174
+ folder_item_copy_msg @ 175
+ folder_item_copy_msgs @ 176
+ folder_item_destroy @ 177
+ folder_item_fetch_all_msg @ 178
+ folder_item_fetch_msg @ 179
+ folder_item_get_cache_file @ 180
+ folder_item_get_identifier @ 181
+ folder_item_get_mark_file @ 182
+ folder_item_get_msg_list @ 183
+ folder_item_get_msginfo @ 184
+ folder_item_get_path @ 185
+ folder_item_get_uncached_msg_list @ 186
+ folder_item_is_msg_changed @ 187
+ folder_item_move_msg @ 188
+ folder_item_move_msgs @ 189
+ folder_item_new @ 190
+ folder_item_remove @ 191
+ folder_item_remove_all_msg @ 192
+ folder_item_remove_children @ 193
+ folder_item_remove_msg @ 194
+ folder_item_remove_msgs @ 195
+ folder_item_scan @ 196
+ folder_item_scan_foreach @ 197
+ folder_local_folder_destroy @ 198
+ folder_local_folder_init @ 199
+ folder_new @ 200
+ folder_read_list @ 201
+ folder_remote_folder_destroy @ 202
+ folder_remote_folder_init @ 203
+ folder_scan_tree @ 204
+ folder_set_missing_folders @ 205
+ folder_set_name @ 206
+ folder_set_ui_func @ 207
+ folder_tree_destroy @ 208
+ folder_unref_account_all @ 209
+ folder_write_list @ 210
+ fromuutobits @ 211
+ generate_mime_boundary @ 212
+ get_abbrev_newsgroup_name @ 213
+ get_alt_filename @ 214
+ get_command_output @ 215
+ get_debug_mode @ 216
+ get_document_dir @ 217
+ get_domain_name @ 218
+ get_file_size @ 219
+ get_file_size_as_crlf @ 220
+ get_home_dir @ 221
+ get_imap_cache_dir @ 222
+ get_left_file_size @ 223
+ get_mail_base_dir @ 224
+ get_mime_tmp_dir @ 225
+ get_news_cache_dir @ 226
+ get_next_word_len @ 227
+ get_old_rc_dir @ 228
+ get_outgoing_rfc2822_file @ 229
+ get_outgoing_rfc2822_str @ 230
+ get_quote_level @ 231
+ get_rc_dir @ 232
+ get_rfc822_date @ 233
+ get_startup_dir @ 234
+ get_template_dir @ 235
+ get_tmp_dir @ 236
+ get_tmp_file @ 237
+ get_uri_len @ 238
+ get_uri_path @ 239
+ hash_free_strings @ 240
+ hash_free_value_mem @ 241
+ html_parse @ 242
+ html_parser_destroy @ 243
+ html_parser_new @ 244
+ imap_get_class @ 245
+ imap_msg_list_set_perm_flags @ 246
+ imap_msg_list_unset_perm_flags @ 247
+ imap_msg_set_perm_flags @ 248
+ imap_msg_unset_perm_flags @ 249
+ input_query_password @ 250
+ is_ascii_str @ 251
+ is_dir_exist @ 252
+ is_file_entry_exist @ 253
+ is_header_line @ 254
+ is_next_nonascii @ 255
+ is_uri_string @ 256
+ itos @ 257
+ itos_buf @ 258
+ list_free_strings @ 259
+ lock_mbox @ 260
+ log_error @ 261
+ log_message @ 262
+ log_print @ 263
+ log_warning @ 264
+ log_write @ 265
+ make_dir @ 266
+ make_dir_hier @ 267
+ md5_hex_hmac @ 268
+ md5_hmac @ 269
+ mh_get_class @ 270
+ move_file @ 271
+ my_gethostbyname @ 272
+ my_memmem @ 273
+ my_strftime @ 274
+ my_tmpfile @ 275
+ news_get_class @ 276
+ news_get_group_list @ 277
+ news_group_list_free @ 278
+ news_post @ 279
+ news_post_stream @ 280
+ news_remove_group_list_cache @ 281
+ newsgroup_list_append @ 282
+ nntp_article @ 283
+ nntp_body @ 284
+ nntp_get_article @ 285
+ nntp_group @ 286
+ nntp_head @ 287
+ nntp_list @ 288
+ nntp_mode @ 289
+ nntp_newgroups @ 290
+ nntp_newnews @ 291
+ nntp_next @ 292
+ nntp_post @ 293
+ nntp_session_new @ 294
+ nntp_stat @ 295
+ nntp_xhdr @ 296
+ nntp_xover @ 297
+ normalize_address_field @ 298
+ normalize_newlines @ 299
+ open_uri @ 300
+ path_cmp @ 301
+ pop3_delete_recv @ 302
+ pop3_delete_send @ 303
+ pop3_gen_send @ 304
+ pop3_get_uidl_table @ 305
+ pop3_getauth_apop_send @ 306
+ pop3_getauth_pass_send @ 307
+ pop3_getauth_user_send @ 308
+ pop3_getrange_last_recv @ 309
+ pop3_getrange_last_send @ 310
+ pop3_getrange_stat_recv @ 311
+ pop3_getrange_stat_send @ 312
+ pop3_getrange_uidl_recv @ 313
+ pop3_getrange_uidl_send @ 314
+ pop3_getsize_list_recv @ 315
+ pop3_getsize_list_send @ 316
+ pop3_greeting_recv @ 317
+ pop3_logout_send @ 318
+ pop3_ok @ 319
+ pop3_retr_recv @ 320
+ pop3_retr_send @ 321
+ pop3_session_new @ 322
+ pop3_stls_recv @ 323
+ pop3_stls_send @ 324
+ pop3_write_msg_to_file @ 325
+ pop3_write_uidl_list @ 326
+ prefs_account_apply_tmp_prefs @ 327
+ prefs_account_free @ 328
+ prefs_account_get_params @ 329
+ prefs_account_get_tmp_prefs @ 330
+ prefs_account_new @ 331
+ prefs_account_read_config @ 332
+ prefs_account_set_tmp_prefs @ 333
+ prefs_account_write_config_all @ 334
+ prefs_common @ 335 DATA
+ prefs_common_get @ 336
+ prefs_common_get_params @ 337
+ prefs_common_junk_filter_list_set @ 338
+ prefs_common_junk_folder_rename_path @ 339
+ prefs_common_read_config @ 340
+ prefs_common_write_config @ 341
+ prefs_file_close @ 342
+ prefs_file_close_revert @ 343
+ prefs_file_get_backup_generation @ 344
+ prefs_file_open @ 345
+ prefs_file_set_backup_generation @ 346
+ prefs_file_write_param @ 347
+ prefs_free @ 348
+ prefs_param_table_destroy @ 349
+ prefs_param_table_get @ 350
+ prefs_read_config @ 351
+ prefs_set_default @ 352
+ prefs_write_config @ 353
+ proc_mbox @ 354
+ proc_mbox_full @ 355
+ procheader_add_header_list @ 356
+ procheader_copy_header_list @ 357
+ procheader_date_get_localtime @ 358
+ procheader_date_parse @ 359
+ procheader_find_header_list @ 360
+ procheader_get_fromname @ 361
+ procheader_get_header_array @ 362
+ procheader_get_header_array_asis @ 363
+ procheader_get_header_array_for_display @ 364
+ procheader_get_header_fields @ 365
+ procheader_get_header_list @ 366
+ procheader_get_header_list_from_file @ 367
+ procheader_get_header_list_from_msginfo @ 368
+ procheader_get_one_field @ 369
+ procheader_get_toname @ 370
+ procheader_get_unfolded_line @ 371
+ procheader_header_array_destroy @ 372
+ procheader_header_free @ 373
+ procheader_header_list_destroy @ 374
+ procheader_merge_header_list @ 375
+ procheader_merge_header_list_dup @ 376
+ procheader_parse_file @ 377
+ procheader_parse_str @ 378
+ procheader_parse_stream @ 379
+ procmime_decode_content @ 380
+ procmime_execute_open_file @ 381
+ procmime_find_string @ 382
+ procmime_find_string_part @ 383
+ procmime_get_all_parts @ 384
+ procmime_get_encoding_for_charset @ 385
+ procmime_get_encoding_for_str @ 386
+ procmime_get_encoding_for_text_file @ 387
+ procmime_get_encoding_str @ 388
+ procmime_get_first_text_content @ 389
+ procmime_get_mime_type @ 390
+ procmime_get_part @ 391
+ procmime_get_part_file_name @ 392
+ procmime_get_part_fp @ 393
+ procmime_get_text_content @ 394
+ procmime_get_tmp_file_name @ 395
+ procmime_mimeinfo_free_all @ 396
+ procmime_mimeinfo_insert @ 397
+ procmime_mimeinfo_new @ 398
+ procmime_mimeinfo_next @ 399
+ procmime_scan_content_disposition @ 400
+ procmime_scan_content_type @ 401
+ procmime_scan_content_type_str @ 402
+ procmime_scan_encoding @ 403
+ procmime_scan_message @ 404
+ procmime_scan_mime_header @ 405
+ procmime_scan_mime_type @ 406
+ procmime_scan_multipart_message @ 407
+ procmsg_add_flags @ 408
+ procmsg_add_mark_queue @ 409
+ procmsg_clear_cache @ 410
+ procmsg_clear_mark @ 411
+ procmsg_cmp_msgnum_for_sort @ 412
+ procmsg_copy_messages @ 413
+ procmsg_empty_all_trash @ 414
+ procmsg_empty_trash @ 415
+ procmsg_flush_mark_queue @ 416
+ procmsg_get_last_num_in_msg_list @ 417
+ procmsg_get_mark_sum @ 418
+ procmsg_get_message_file @ 419
+ procmsg_get_message_file_list @ 420
+ procmsg_get_message_file_path @ 421
+ procmsg_get_msginfo @ 422
+ procmsg_get_thread_date @ 423
+ procmsg_get_thread_tree @ 424
+ procmsg_mark_all_read @ 425
+ procmsg_message_file_list_free @ 426
+ procmsg_move_messages @ 427
+ procmsg_msg_exist @ 428
+ procmsg_msg_hash_table_append @ 429
+ procmsg_msg_hash_table_create @ 430
+ procmsg_msg_list_free @ 431
+ procmsg_msginfo_copy @ 432
+ procmsg_msginfo_equal @ 433
+ procmsg_msginfo_free @ 434
+ procmsg_msginfo_get_full_info @ 435
+ procmsg_open_cache_file @ 436
+ procmsg_open_data_file @ 437
+ procmsg_open_mark_file @ 438
+ procmsg_open_message @ 439
+ procmsg_open_message_decrypted @ 440
+ procmsg_print_message @ 441
+ procmsg_print_message_part @ 442
+ procmsg_read_cache @ 443
+ procmsg_read_cache_data_str @ 444
+ procmsg_remove_all_cached_messages @ 445
+ procmsg_save_to_outbox @ 446
+ procmsg_set_auto_decrypt_message @ 447
+ procmsg_set_decrypt_message_func @ 448
+ procmsg_set_flags @ 449
+ procmsg_sort_msg_list @ 450
+ procmsg_to_folder_hash_table_create @ 451
+ procmsg_trash_messages_exist @ 452
+ procmsg_write_cache @ 453
+ procmsg_write_cache_list @ 454
+ procmsg_write_flags @ 455
+ procmsg_write_flags_for_multiple_folders @ 456
+ procmsg_write_flags_list @ 457
+ progress_show @ 458
+ ptr_array_free_strings @ 459
+ qp_decode_line @ 460
+ qp_decode_q_encoding @ 461
+ qp_encode_line @ 462
+ qp_get_q_encoding_len @ 463
+ qp_q_encode @ 464
+ recv_bytes @ 465
+ recv_bytes_write @ 466
+ recv_bytes_write_to_file @ 467
+ recv_set_ui_func @ 468
+ recv_write @ 469
+ recv_write_to_file @ 470
+ references_list_append @ 471
+ references_list_prepend @ 472
+ remote_tzoffset_sec @ 473
+ remove_all_files @ 474
+ remove_all_numbered_files @ 475
+ remove_dir_recursive @ 476
+ remove_expired_files @ 477
+ remove_numbered_files @ 478
+ remove_return @ 479
+ remove_space @ 480
+ rename_force @ 481
+ s_gnet_md5_clone @ 482
+ s_gnet_md5_copy_string @ 483
+ s_gnet_md5_delete @ 484
+ s_gnet_md5_equal @ 485
+ s_gnet_md5_final @ 486
+ s_gnet_md5_get_digest @ 487
+ s_gnet_md5_get_string @ 488
+ s_gnet_md5_hash @ 489
+ s_gnet_md5_new @ 490
+ s_gnet_md5_new_incremental @ 491
+ s_gnet_md5_new_string @ 492
+ s_gnet_md5_update @ 493
+ scan_mailto_url @ 494
+ session_connect @ 495
+ session_destroy @ 496
+ session_disconnect @ 497
+ session_init @ 498
+ session_is_connected @ 499
+ session_recv_data @ 500
+ session_recv_data_as_file @ 501
+ session_recv_msg @ 502
+ session_send_data @ 503
+ session_send_msg @ 504
+ session_set_access_time @ 505
+ session_set_recv_data_notify @ 506
+ session_set_recv_data_progressive_notify @ 507
+ session_set_recv_message_notify @ 508
+ session_set_send_data_notify @ 509
+ session_set_send_data_progressive_notify @ 510
+ session_set_timeout @ 511
+ session_start_tls @ 512
+ set_debug_mode @ 513
+ set_input_query_password_func @ 514
+ set_log_file @ 515
+ set_log_show_status_func @ 516
+ set_log_ui_func @ 517
+ set_log_verbosity @ 518
+ set_progress_func @ 519
+ set_rc_dir @ 520
+ set_startup_dir @ 521
+ set_ui_update_func @ 522
+ sinfo_equal @ 523
+ sinfo_hash @ 524
+ slist_free_strings @ 525
+ smtp_session_new @ 526
+ sock_add_watch @ 527
+ sock_add_watch_poll @ 528
+ sock_cleanup @ 529
+ sock_close @ 530
+ sock_connect @ 531
+ sock_getline @ 532
+ sock_gets @ 533
+ sock_has_read_data @ 534
+ sock_init @ 535
+ sock_is_nonblocking_mode @ 536
+ sock_peek @ 537
+ sock_printf @ 538
+ sock_puts @ 539
+ sock_read @ 540
+ sock_set_io_timeout @ 541
+ sock_set_nonblocking_mode @ 542
+ sock_watch_funcs @ 543 DATA
+ sock_write @ 544
+ sock_write_all @ 545
+ ssl_done @ 546
+ ssl_done_socket @ 547
+ ssl_getline @ 548
+ ssl_gets @ 549
+ ssl_init @ 550
+ ssl_init_socket @ 551
+ ssl_init_socket_with_method @ 552
+ ssl_peek @ 553
+ ssl_read @ 554
+ ssl_set_verify_func @ 555
+ ssl_write @ 556
+ ssl_write_all @ 557
+ status_print @ 558
+ str_case_equal @ 559
+ str_case_find @ 560
+ str_case_find_equal @ 561
+ str_case_hash @ 562
+ str_find @ 563
+ str_find_equal @ 564
+ str_find_format_times @ 565
+ str_has_suffix_case @ 566
+ str_open_as_stream @ 567
+ str_write_to_file @ 568
+ strcasestr @ 569
+ strchomp_all @ 570
+ strchr_parenthesis_close @ 571
+ strchr_with_skip_quote @ 572
+ strcmp2 @ 573
+ strcrchomp @ 574
+ string_table_free @ 575
+ string_table_free_string @ 576
+ string_table_get_stats @ 577
+ string_table_insert_string @ 578
+ string_table_lookup_string @ 579
+ string_table_new @ 580
+ strncpy2 @ 581
+ strrchr_with_skip_quote @ 582
+ strretchomp @ 583
+ strsplit_csv @ 584
+ strsplit_parenthesis @ 585
+ strsplit_with_quote @ 586
+ strstr_with_skip_quote @ 587
+ strtailchomp @ 588
+ subject_compare @ 589
+ subject_compare_for_sort @ 590
+ subst_char @ 591
+ subst_chars @ 592
+ subst_control @ 593
+ subst_for_filename @ 594
+ subst_null @ 595
+ syl_app_create @ 596
+ syl_app_get @ 597
+ syl_app_get_type @ 598
+ syl_cleanup @ 599
+ syl_init @ 600
+ syl_init_gettext @ 601
+ syl_link @ 602
+ syl_marshal_VOID__POINTER_STRING_UINT @ 603
+ syl_save_all_state @ 604
+ syl_setup_rc_dir @ 605
+ to_human_readable @ 606
+ to_number @ 607
+ touufrombits @ 608
+ trim_string @ 609
+ trim_string_before @ 610
+ trim_subject @ 611
+ trim_subject_for_compare @ 612
+ trim_subject_for_sort @ 613
+ tzoffset @ 614
+ tzoffset_sec @ 615
+ ui_update @ 616
+ uncanonicalize_file @ 617
+ uncanonicalize_file_replace @ 618
+ unfold_line @ 619
+ unlock_mbox @ 620
+ unmime_header @ 621
+ uri_list_extract_filenames @ 622
+ uriencode_for_filename @ 623
+ uriencode_for_mailto @ 624
+ uudigit @ 625 DATA
+ virtual_get_class @ 626
+ xml_attr_new @ 627
+ xml_close_file @ 628
+ xml_compare_tag @ 629
+ xml_copy_attr @ 630
+ xml_copy_tag @ 631
+ xml_file_put_escape_str @ 632
+ xml_file_put_node @ 633
+ xml_file_put_xml_decl @ 634
+ xml_free_node @ 635
+ xml_free_tree @ 636
+ xml_get_current_tag @ 637
+ xml_get_current_tag_attr @ 638
+ xml_get_dtd @ 639
+ xml_get_element @ 640
+ xml_node_new @ 641
+ xml_open_file @ 642
+ xml_parse_file @ 643
+ xml_parse_next_tag @ 644
+ xml_pop_tag @ 645
+ xml_push_tag @ 646
+ xml_read_line @ 647
+ xml_tag_add_attr @ 648
+ xml_tag_new @ 649
+ xml_truncate_buf @ 650
+ xml_unescape_str @ 651
diff --git a/libsylph/mh.c b/libsylph/mh.c
index abbfc23d..ae5475ac 100644
--- a/libsylph/mh.c
+++ b/libsylph/mh.c
@@ -38,6 +38,7 @@
#undef MEASURE_TIME
+#include "sylmain.h"
#include "folder.h"
#include "mh.h"
#include "procmsg.h"
@@ -468,6 +469,8 @@ static gint mh_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list,
}
}
+ g_signal_emit_by_name(syl_app_get(), "add-msg", dest, destfile, dest->last_num + 1);
+
g_free(destfile);
dest->last_num++;
dest->total++;
@@ -551,12 +554,16 @@ static gint mh_do_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
if (!destfile) break;
srcfile = procmsg_get_message_file(msginfo);
+ g_signal_emit_by_name(syl_app_get(), "remove-msg", src, srcfile, msginfo->msgnum);
+
if (move_file(srcfile, destfile, FALSE) < 0) {
g_free(srcfile);
g_free(destfile);
break;
}
+ g_signal_emit_by_name(syl_app_get(), "add-msg", dest, destfile, dest->last_num + 1);
+
g_free(srcfile);
g_free(destfile);
src->total--;
@@ -679,6 +686,8 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
break;
}
+ g_signal_emit_by_name(syl_app_get(), "add-msg", dest, destfile, dest->last_num + 1);
+
g_free(srcfile);
g_free(destfile);
dest->last_num++;
@@ -711,6 +720,8 @@ static gint mh_remove_msg(Folder *folder, FolderItem *item, MsgInfo *msginfo)
file = mh_fetch_msg(folder, item, msginfo->msgnum);
g_return_val_if_fail(file != NULL, -1);
+ g_signal_emit_by_name(syl_app_get(), "remove-msg", item, file, msginfo->msgnum);
+
if (g_unlink(file) < 0) {
FILE_OP_ERROR(file, "unlink");
g_free(file);
@@ -742,6 +753,7 @@ static gint mh_remove_all_msg(Folder *folder, FolderItem *item)
path = folder_item_get_path(item);
g_return_val_if_fail(path != NULL, -1);
+ g_signal_emit_by_name(syl_app_get(), "remove-all-msg", item);
val = remove_all_numbered_files(path);
g_free(path);
if (val == 0) {
@@ -1088,6 +1100,7 @@ static gint mh_move_folder_real(Folder *folder, FolderItem *item,
gchar *name_;
gchar *utf8_name;
gchar *paths[2];
+ gchar *old_id, *new_id;
g_return_val_if_fail(folder != NULL, -1);
g_return_val_if_fail(item != NULL, -1);
@@ -1163,6 +1176,8 @@ static gint mh_move_folder_real(Folder *folder, FolderItem *item,
g_free(oldpath);
g_free(newpath);
+ old_id = folder_item_get_identifier(item);
+
if (new_parent) {
g_node_unlink(item->node);
g_node_append(new_parent->node, item->node);
@@ -1196,6 +1211,12 @@ static gint mh_move_folder_real(Folder *folder, FolderItem *item,
g_free(paths[0]);
g_free(paths[1]);
+ new_id = folder_item_get_identifier(item);
+ g_signal_emit_by_name(syl_app_get(), "move-folder", item, old_id,
+ new_id);
+ g_free(new_id);
+ g_free(old_id);
+
return 0;
}
@@ -1227,6 +1248,7 @@ static gint mh_remove_folder(Folder *folder, FolderItem *item)
}
g_free(path);
+ g_signal_emit_by_name(syl_app_get(), "remove-folder", item);
folder_item_remove(item);
return 0;
}
diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c
index be37ba90..815584aa 100644
--- a/libsylph/prefs_common.c
+++ b/libsylph/prefs_common.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2008 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2009 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -462,6 +462,11 @@ static PrefParam param[] = {
{"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD, &prefs_common.extsend_cmd,
P_STRING},
+ /* Update check */
+ {"auto_update_check", "TRUE", &prefs_common.auto_update_check, P_BOOL},
+ {"use_http_proxy", "FALSE", &prefs_common.use_http_proxy, P_BOOL},
+ {"http_proxy_host", NULL, &prefs_common.http_proxy_host, P_STRING},
+
/* Advanced */
{"strict_cache_check", "FALSE", &prefs_common.strict_cache_check,
P_BOOL},
diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h
index f072e97e..09dadb16 100644
--- a/libsylph/prefs_common.h
+++ b/libsylph/prefs_common.h
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2008 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2009 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -289,6 +289,11 @@ struct _PrefsCommon
gboolean use_extsend;
gchar *extsend_cmd;
+ /* Update check */
+ gboolean auto_update_check;
+ gboolean use_http_proxy;
+ gchar *http_proxy_host;
+
/* Advanced */
gboolean strict_cache_check;
gint io_timeout_secs;
diff --git a/libsylph/procheader.c b/libsylph/procheader.c
index 22a8acc5..955f5a63 100644
--- a/libsylph/procheader.c
+++ b/libsylph/procheader.c
@@ -214,7 +214,7 @@ GSList *procheader_get_header_list_from_file(const gchar *file)
GSList *hlist;
if ((fp = g_fopen(file, "rb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procheader_get_header_list_from_file: fopen");
return NULL;
}
@@ -531,7 +531,7 @@ MsgInfo *procheader_parse_file(const gchar *file, MsgFlags flags,
return NULL;
if ((fp = g_fopen(file, "rb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procheader_parse_file: fopen");
return NULL;
}
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index 2f7c4e74..1be7d722 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -790,8 +790,10 @@ static void procmsg_write_mark_file(FolderItem *item, GHashTable *mark_table)
{
FILE *fp;
- if ((fp = procmsg_open_mark_file(item, DATA_WRITE)) == NULL)
+ if ((fp = procmsg_open_mark_file(item, DATA_WRITE)) == NULL) {
+ g_warning("procmsg_write_mark_file: cannot open mark file.");
return;
+ }
g_hash_table_foreach(mark_table, write_mark_func, fp);
fclose(fp);
}
@@ -809,11 +811,11 @@ FILE *procmsg_open_data_file(const gchar *file, guint version,
if (errno == EACCES) {
change_file_mode_rw(NULL, file);
if ((fp = g_fopen(file, "wb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
return NULL;
}
} else {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
return NULL;
}
}
@@ -829,7 +831,7 @@ FILE *procmsg_open_data_file(const gchar *file, guint version,
if (errno == EACCES) {
change_file_mode_rw(NULL, file);
if ((fp = g_fopen(file, "rb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
}
} else {
debug_print("Mark/Cache file '%s' not found\n", file);
@@ -839,8 +841,11 @@ FILE *procmsg_open_data_file(const gchar *file, guint version,
if (fp) {
if (buf && buf_size > 0)
setvbuf(fp, buf, _IOFBF, buf_size);
- if (fread(&data_ver, sizeof(data_ver), 1, fp) != 1 ||
- version != data_ver) {
+ if (fread(&data_ver, sizeof(data_ver), 1, fp) != 1) {
+ g_warning("%s: cannot read mark/cache file (truncated?)\n", file);
+ fclose(fp);
+ fp = NULL;
+ } else if (version != data_ver) {
g_message("%s: Mark/Cache version is different (%u != %u). Discarding it.\n",
file, data_ver, version);
fclose(fp);
@@ -858,10 +863,10 @@ FILE *procmsg_open_data_file(const gchar *file, guint version,
if (errno == EACCES) {
change_file_mode_rw(NULL, file);
if ((fp = g_fopen(file, "ab")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
}
} else {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
}
}
} else {
@@ -1196,7 +1201,7 @@ FILE *procmsg_open_message(MsgInfo *msginfo)
}
if ((fp = g_fopen(file, "rb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "procmsg_open_message: fopen");
g_free(file);
return NULL;
}
@@ -1413,7 +1418,7 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline,
print_id++);
if ((prfp = g_fopen(prtmp, "wb")) == NULL) {
- FILE_OP_ERROR(prtmp, "fopen");
+ FILE_OP_ERROR(prtmp, "procmsg_print_message: fopen");
g_free(prtmp);
fclose(tmpfp);
return;
@@ -1506,7 +1511,7 @@ void procmsg_print_message_part(MsgInfo *msginfo, MimeInfo *partinfo,
get_mime_tmp_dir(), G_DIR_SEPARATOR,
print_id++);
if ((prfp = g_fopen(prtmp, "wb")) == NULL) {
- FILE_OP_ERROR(prtmp, "fopen");
+ FILE_OP_ERROR(prtmp, "procmsg_print_message_part: fopen");
g_free(prtmp);
fclose(tmpfp);
return;
diff --git a/libsylph/syl-marshal.c b/libsylph/syl-marshal.c
new file mode 100644
index 00000000..3d177498
--- /dev/null
+++ b/libsylph/syl-marshal.c
@@ -0,0 +1,131 @@
+
+#include <glib-object.h>
+
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v) g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v) g_value_get_int (v)
+#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
+#define g_marshal_value_peek_long(v) g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
+#define g_marshal_value_peek_float(v) g_value_get_float (v)
+#define g_marshal_value_peek_double(v) g_value_get_double (v)
+#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v) g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v) g_value_get_object (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ * Do not access GValues directly in your code. Instead, use the
+ * g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
+#define g_marshal_value_peek_char(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v) (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v) (v)->data[0].v_float
+#define g_marshal_value_peek_double(v) (v)->data[0].v_double
+#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+/* VOID:VOID (syl-marshal.list:1) */
+
+/* VOID:POINTER,STRING,UINT (syl-marshal.list:2) */
+void
+syl_marshal_VOID__POINTER_STRING_UINT (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__POINTER_STRING_UINT) (gpointer data1,
+ gpointer arg_1,
+ gpointer arg_2,
+ guint arg_3,
+ gpointer data2);
+ register GMarshalFunc_VOID__POINTER_STRING_UINT callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 4);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__POINTER_STRING_UINT) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_pointer (param_values + 1),
+ g_marshal_value_peek_string (param_values + 2),
+ g_marshal_value_peek_uint (param_values + 3),
+ data2);
+}
+
+/* VOID:POINTER (syl-marshal.list:3) */
+
+/* VOID:POINTER,STRING,STRING (syl-marshal.list:4) */
+void
+syl_marshal_VOID__POINTER_STRING_STRING (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__POINTER_STRING_STRING) (gpointer data1,
+ gpointer arg_1,
+ gpointer arg_2,
+ gpointer arg_3,
+ gpointer data2);
+ register GMarshalFunc_VOID__POINTER_STRING_STRING callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 4);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__POINTER_STRING_STRING) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_pointer (param_values + 1),
+ g_marshal_value_peek_string (param_values + 2),
+ g_marshal_value_peek_string (param_values + 3),
+ data2);
+}
+
diff --git a/libsylph/syl-marshal.h b/libsylph/syl-marshal.h
new file mode 100644
index 00000000..5bf87141
--- /dev/null
+++ b/libsylph/syl-marshal.h
@@ -0,0 +1,34 @@
+
+#ifndef __syl_marshal_MARSHAL_H__
+#define __syl_marshal_MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* VOID:VOID (syl-marshal.list:1) */
+#define syl_marshal_VOID__VOID g_cclosure_marshal_VOID__VOID
+
+/* VOID:POINTER,STRING,UINT (syl-marshal.list:2) */
+extern void syl_marshal_VOID__POINTER_STRING_UINT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+/* VOID:POINTER (syl-marshal.list:3) */
+#define syl_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER
+
+/* VOID:POINTER,STRING,STRING (syl-marshal.list:4) */
+extern void syl_marshal_VOID__POINTER_STRING_STRING (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+G_END_DECLS
+
+#endif /* __syl_marshal_MARSHAL_H__ */
+
diff --git a/libsylph/syl-marshal.list b/libsylph/syl-marshal.list
new file mode 100644
index 00000000..983f5ad5
--- /dev/null
+++ b/libsylph/syl-marshal.list
@@ -0,0 +1,4 @@
+VOID:VOID
+VOID:POINTER,STRING,UINT
+VOID:POINTER
+VOID:POINTER,STRING,STRING
diff --git a/libsylph/sylmain.c b/libsylph/sylmain.c
new file mode 100644
index 00000000..649c4d3a
--- /dev/null
+++ b/libsylph/sylmain.c
@@ -0,0 +1,327 @@
+/*
+ * LibSylph -- E-Mail client library
+ * Copyright (C) 1999-2009 Hiroyuki Yamamoto
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#ifdef G_OS_UNIX
+# include <signal.h>
+#endif
+
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#include "sylmain.h"
+#include "syl-marshal.h"
+#include "prefs_common.h"
+#include "account.h"
+#include "filter.h"
+#include "folder.h"
+#include "socket.h"
+#include "codeconv.h"
+#include "utils.h"
+
+#if USE_SSL
+# include "ssl.h"
+#endif
+
+#ifndef PACKAGE
+# define PACKAGE GETTEXT_PACKAGE
+#endif
+
+G_DEFINE_TYPE(SylApp, syl_app, G_TYPE_OBJECT);
+
+enum {
+ INIT_DONE,
+ APP_EXIT,
+ ADD_MSG,
+ REMOVE_MSG,
+ REMOVE_ALL_MSG,
+ REMOVE_FOLDER,
+ MOVE_FOLDER,
+ FOLDERLIST_UPDATED,
+ LAST_SIGNAL
+};
+
+static guint app_signals[LAST_SIGNAL] = { 0 };
+
+static GObject *app = NULL;
+
+
+static void syl_app_init(SylApp *self)
+{
+}
+
+static void syl_app_class_init(SylAppClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
+ app_signals[INIT_DONE] =
+ g_signal_new("init-done",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ app_signals[APP_EXIT] =
+ g_signal_new("app-exit",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ app_signals[ADD_MSG] =
+ g_signal_new("add-msg",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__POINTER_STRING_UINT,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_POINTER,
+ G_TYPE_STRING,
+ G_TYPE_UINT);
+ app_signals[REMOVE_MSG] =
+ g_signal_new("remove-msg",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__POINTER_STRING_UINT,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_POINTER,
+ G_TYPE_STRING,
+ G_TYPE_UINT);
+ app_signals[REMOVE_ALL_MSG] =
+ g_signal_new("remove-all-msg",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_POINTER);
+ app_signals[REMOVE_FOLDER] =
+ g_signal_new("remove-folder",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_POINTER);
+ app_signals[MOVE_FOLDER] =
+ g_signal_new("move-folder",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__POINTER_STRING_STRING,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_POINTER,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+ app_signals[FOLDERLIST_UPDATED] =
+ g_signal_new("folderlist-updated",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ syl_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+GObject *syl_app_create(void)
+{
+ if (!app)
+ app = g_object_new(SYL_TYPE_APP, NULL);
+ return app;
+}
+
+GObject *syl_app_get(void)
+{
+ return app;
+}
+
+void syl_init(void)
+{
+#ifdef G_OS_WIN32
+ gchar *newpath;
+ const gchar *lang_env;
+
+ /* disable locale variable such as "LANG=1041" */
+
+#define DISABLE_DIGIT_LOCALE(envstr) \
+{ \
+ lang_env = g_getenv(envstr); \
+ if (lang_env && g_ascii_isdigit(lang_env[0])) \
+ g_unsetenv(envstr); \
+}
+
+ DISABLE_DIGIT_LOCALE("LC_ALL");
+ DISABLE_DIGIT_LOCALE("LANG");
+ DISABLE_DIGIT_LOCALE("LC_CTYPE");
+ DISABLE_DIGIT_LOCALE("LC_MESSAGES");
+
+#undef DISABLE_DIGIT_LOCALE
+
+ g_unsetenv("LANGUAGE");
+#endif /* G_OS_WIN32 */
+
+#ifdef HAVE_LOCALE_H
+ setlocale(LC_ALL, "");
+#endif
+
+ set_startup_dir();
+
+#ifdef G_OS_WIN32
+ /* include startup directory into %PATH% for GSpawn */
+ newpath = g_strconcat(get_startup_dir(), ";", g_getenv("PATH"), NULL);
+ g_setenv("PATH", newpath, TRUE);
+ g_free(newpath);
+#endif
+
+#ifdef ENABLE_NLS
+ syl_init_gettext(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
+ sock_init();
+#if USE_SSL
+ ssl_init();
+#endif
+
+#ifdef G_OS_UNIX
+ /* ignore SIGPIPE signal for preventing sudden death of program */
+ signal(SIGPIPE, SIG_IGN);
+#endif
+}
+
+#define MAKE_DIR_IF_NOT_EXIST(dir) \
+{ \
+ if (!is_dir_exist(dir)) { \
+ if (is_file_exist(dir)) { \
+ g_warning("File '%s' already exists. " \
+ "Can't create folder.", dir); \
+ return -1; \
+ } \
+ if (make_dir(dir) < 0) \
+ return -1; \
+ } \
+}
+
+void syl_init_gettext(const gchar *package, const gchar *dirname)
+{
+#ifdef ENABLE_NLS
+ if (g_path_is_absolute(dirname))
+ bindtextdomain(package, dirname);
+ else {
+ gchar *locale_dir;
+
+ locale_dir = g_strconcat(get_startup_dir(), G_DIR_SEPARATOR_S,
+ dirname, NULL);
+#ifdef G_OS_WIN32
+ {
+ gchar *locale_dir_;
+
+ locale_dir_ = g_locale_from_utf8(locale_dir, -1,
+ NULL, NULL, NULL);
+ if (locale_dir_) {
+ g_free(locale_dir);
+ locale_dir = locale_dir_;
+ }
+ }
+#endif /* G_OS_WIN32 */
+ bindtextdomain(package, locale_dir);
+ g_free(locale_dir);
+ }
+
+ bind_textdomain_codeset(package, CS_UTF_8);
+#endif /* ENABLE_NLS */
+}
+
+gint syl_setup_rc_dir(void)
+{
+ if (!is_dir_exist(get_rc_dir())) {
+ if (make_dir_hier(get_rc_dir()) < 0)
+ return -1;
+ }
+
+ MAKE_DIR_IF_NOT_EXIST(get_mail_base_dir());
+
+ CHDIR_RETURN_VAL_IF_FAIL(get_rc_dir(), -1);
+
+ MAKE_DIR_IF_NOT_EXIST(get_imap_cache_dir());
+ MAKE_DIR_IF_NOT_EXIST(get_news_cache_dir());
+ MAKE_DIR_IF_NOT_EXIST(get_mime_tmp_dir());
+ MAKE_DIR_IF_NOT_EXIST(get_tmp_dir());
+ MAKE_DIR_IF_NOT_EXIST(UIDL_DIR);
+
+ /* remove temporary files */
+ remove_all_files(get_tmp_dir());
+ remove_all_files(get_mime_tmp_dir());
+
+ return 0;
+}
+
+void syl_save_all_state(void)
+{
+ folder_write_list();
+ prefs_common_write_config();
+ filter_write_config();
+ account_write_config_all();
+}
+
+void syl_cleanup(void)
+{
+ /* remove temporary files */
+ remove_all_files(get_tmp_dir());
+ remove_all_files(get_mime_tmp_dir());
+#if GLIB_CHECK_VERSION(2, 6, 0)
+ g_log_set_default_handler(g_log_default_handler, NULL);
+#endif
+ close_log_file();
+
+#if USE_SSL
+ ssl_done();
+#endif
+ sock_cleanup();
+
+ if (app) {
+ g_object_unref(app);
+ app = NULL;
+ }
+}
diff --git a/libsylph/sylmain.h b/libsylph/sylmain.h
new file mode 100644
index 00000000..e09a604c
--- /dev/null
+++ b/libsylph/sylmain.h
@@ -0,0 +1,57 @@
+/*
+ * LibSylph -- E-Mail client library
+ * Copyright (C) 1999-2009 Hiroyuki Yamamoto
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __SYLMAIN_H__
+#define __SYLMAIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+/* SylApp object */
+
+#define SYL_TYPE_APP (syl_app_get_type())
+#define SYL_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_APP, SylApp))
+#define SYL_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_APP))
+#define SYL_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SYL_TYPE_APP, SylAppClass))
+#define SYL_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SYL_TYPE_APP))
+#define SYL_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SYL_TYPE_APP, SylAppClass))
+
+typedef struct _SylApp SylApp;
+typedef struct _SylAppClass SylAppClass;
+
+struct _SylApp
+{
+ GObject parent_instance;
+};
+
+struct _SylAppClass
+{
+ GObjectClass parent_class;
+};
+
+GObject *syl_app_create (void);
+GObject *syl_app_get (void);
+
+void syl_init (void);
+void syl_init_gettext (const gchar *package, const gchar *dirname);
+gint syl_setup_rc_dir (void);
+void syl_save_all_state (void);
+void syl_cleanup (void);
+
+#endif /* __SYLMAIN_H__ */