Revision 1788 trunk/plugins/unpack/plugin_unpack.c
| plugin_unpack.c (revision 1788) | ||
|---|---|---|
| 83 | 83 |
ng_plugin_create_event(plugin_data, "unpack_progress_update", 3); |
| 84 | 84 |
ng_plugin_create_event(plugin_data, "unpack_message_received", 3); |
| 85 | 85 |
ng_plugin_create_event(plugin_data, "unpack_working_archive_changed", 3); |
| 86 |
ng_plugin_create_event(plugin_data, "unpack_success", 2); |
|
| 87 |
ng_plugin_create_event(plugin_data, "unpack_failure", 3); |
|
| 86 | 88 |
|
| 87 | 89 |
/* Add a dependency on the NNTPGrab Core and the PAR2 plugin */ |
| 88 | 90 |
ng_plugin_set_required_event(plugin_data, "collection_downloaded"); |
| ... | ... | |
| 242 | 244 |
unpack_data->error_type = error->type; |
| 243 | 245 |
unpack_data->error_occured = (error->status != 0 || error->type != 0); |
| 244 | 246 |
|
| 245 |
if (error->gerror && error->gerror->message) {
|
|
| 247 |
if (error->gerror && error->gerror->message && strlen(error->gerror->message) > 0) {
|
|
| 246 | 248 |
strncpy(unpack_data->errmsg, error->gerror->message, sizeof(unpack_data->errmsg) - 1); |
| 247 | 249 |
} else if (error->status != 0) {
|
| 248 | 250 |
snprintf(unpack_data->errmsg, sizeof(unpack_data->errmsg) - 1, "Unknown error occured while unpacking, error->status = %i, error->type = %i", error->status, error->type); |
| ... | ... | |
| 492 | 494 |
while (list) {
|
| 493 | 495 |
UnpackFile *file = (UnpackFile*) list->data; |
| 494 | 496 |
char *total_filename = g_build_filename(target_directory, file->filename, NULL); |
| 495 |
|
|
| 496 | 497 |
ng_plugin_emit_log_msg(plugin_data, NG_LOG_LEVEL_INFO, _("Now unpacking '%s'"), file->filename);
|
| 497 | 498 |
|
| 498 | 499 |
if (!unpack_do_unpack(plugin_data, collection_name, total_filename, target_directory, &errmsg)) {
|
| 500 |
char *params[4]; |
|
| 501 |
|
|
| 502 |
if (!errmsg || strlen(errmsg) == 0) {
|
|
| 503 |
errmsg = g_strdup_printf(_("process stopped unexpectedly"));
|
|
| 504 |
} |
|
| 505 |
|
|
| 506 |
params[0] = collection_name; |
|
| 507 |
params[1] = file->filename; |
|
| 508 |
params[2] = errmsg; |
|
| 509 |
params[3] = NULL; |
|
| 510 |
ng_plugin_emit_event(plugin_data, "unpack_failure", params); |
|
| 511 |
|
|
| 499 | 512 |
ng_plugin_emit_log_msg(plugin_data, NG_LOG_LEVEL_WARNING, _("Automatic unpack failed due to an error: %s"), errmsg);
|
| 500 | 513 |
g_free(errmsg); |
| 514 |
} else {
|
|
| 515 |
char *params[3]; |
|
| 516 |
params[0] = collection_name; |
|
| 517 |
params[1] = file->filename; |
|
| 518 |
params[2] = NULL; |
|
| 519 |
ng_plugin_emit_event(plugin_data, "unpack_success", params); |
|
| 501 | 520 |
} |
| 502 | 521 |
|
| 503 | 522 |
ng_plugin_emit_log_msg(plugin_data, NG_LOG_LEVEL_INFO, _("Unpack of '%s' finished"), file->filename);
|
Also available in: Unified diff
NNTPGrab

