Mercurial > noffle
comparison src/noffle.c @ 482:a04c52f87b6e noffle
[svn] * docs/noffle.1,src/database.h,src/database.c,src/noffle.c,src/server.c:
Add new '-U, --uninteresting' option. This removes an article from the
list of requested articles and removes its INTERESTING marker.
| author | bears |
|---|---|
| date | Thu, 14 Oct 2004 00:26:48 +0100 |
| parents | 48be71391b9d |
| children |
comparison
equal
deleted
inserted
replaced
| 481:0a5dc5f69746 | 482:a04c52f87b6e |
|---|---|
| 8 not as server. If noffle runs as server, locking is performed while | 8 not as server. If noffle runs as server, locking is performed while |
| 9 executing NNTP commands, but temporarily released if no new command is | 9 executing NNTP commands, but temporarily released if no new command is |
| 10 received for some seconds (to allow multiple clients connect at the same | 10 received for some seconds (to allow multiple clients connect at the same |
| 11 time). | 11 time). |
| 12 | 12 |
| 13 $Id: noffle.c 624 2004-07-09 15:27:20Z bears $ | 13 $Id: noffle.c 629 2004-10-13 23:26:48Z bears $ |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #if HAVE_CONFIG_H | 16 #if HAVE_CONFIG_H |
| 17 #include <config.h> | 17 #include <config.h> |
| 18 #endif | 18 #endif |
| 572 else | 572 else |
| 573 fprintf( stderr, "Could not save fetchlist.\n" ); | 573 fprintf( stderr, "Could not save fetchlist.\n" ); |
| 574 } | 574 } |
| 575 | 575 |
| 576 static void | 576 static void |
| 577 doUninteresting( const char *msgId ) | |
| 578 { | |
| 579 unsigned status; | |
| 580 Str server; | |
| 581 | |
| 582 if ( ! Db_contains( msgId ) ) | |
| 583 fprintf( stderr, "Not in database.\n" ); | |
| 584 else | |
| 585 { | |
| 586 /* Remove INTERESTING status */ | |
| 587 status = Db_status( msgId ); | |
| 588 status &= ~DB_INTERESTING; | |
| 589 Db_setStatus( msgId, status ); | |
| 590 | |
| 591 /* And remove from requested articles queue if server is not local */ | |
| 592 if ( ! Db_findServer( msgId, server ) ) | |
| 593 Log_err( "No server for message %s", msgId ); | |
| 594 else if ( strcmp( server, GRP_LOCAL_SERVER_NAME ) != 0 ) | |
| 595 Req_remove( server, msgId ); | |
| 596 } | |
| 597 } | |
| 598 | |
| 599 static void | |
| 577 printUsage( void ) | 600 printUsage( void ) |
| 578 { | 601 { |
| 579 static const char *msg = | 602 static const char *msg = |
| 580 "Usage: noffle <option>\n" | 603 "Usage: noffle <option>\n" |
| 581 "Option is one of the following:\n" | 604 "Option is one of the following:\n" |
| 602 " -R | --requested List articles marked for download\n" | 625 " -R | --requested List articles marked for download\n" |
| 603 " -s | --subscribe-over <grp> Add group to fetch list (overview)\n" | 626 " -s | --subscribe-over <grp> Add group to fetch list (overview)\n" |
| 604 " -S | --subscribe-full <grp> Add group to fetch list (full)\n" | 627 " -S | --subscribe-full <grp> Add group to fetch list (full)\n" |
| 605 " -t | --subscribe-thread <grp> Add group to fetch list (thread)\n" | 628 " -t | --subscribe-thread <grp> Add group to fetch list (thread)\n" |
| 606 " -u | --unsubscribe <grp> Remove group from fetch list\n" | 629 " -u | --unsubscribe <grp> Remove group from fetch list\n" |
| 630 " -U | --uninteresting <msg id> Article must be read again for download\n" | |
| 607 " -v | --version Print version\n"; | 631 " -v | --version Print version\n"; |
| 608 fprintf( stderr, "%s", msg ); | 632 fprintf( stderr, "%s", msg ); |
| 609 } | 633 } |
| 610 | 634 |
| 611 | 635 |
| 867 { "--server", "-r" }, | 891 { "--server", "-r" }, |
| 868 { "--requested", "-R" }, | 892 { "--requested", "-R" }, |
| 869 { "--subscribe-over", "-s" }, | 893 { "--subscribe-over", "-s" }, |
| 870 { "--subscribe-full", "-S" }, | 894 { "--subscribe-full", "-S" }, |
| 871 { "--subscribe-thread", "-t" }, | 895 { "--subscribe-thread", "-t" }, |
| 896 { "--uninteresting", "-U" }, | |
| 872 { "--unsubscribe", "-u" }, | 897 { "--unsubscribe", "-u" }, |
| 873 { "--version", "-v" }, | 898 { "--version", "-v" }, |
| 874 { NULL, NULL } | 899 { NULL, NULL } |
| 875 | 900 |
| 876 }; | 901 }; |
| 1126 result = EXIT_FAILURE; | 1151 result = EXIT_FAILURE; |
| 1127 } | 1152 } |
| 1128 else | 1153 else |
| 1129 doUnsubscribe( *argv ); | 1154 doUnsubscribe( *argv ); |
| 1130 break; | 1155 break; |
| 1156 case 'U': | |
| 1157 if ( *argv == NULL ) | |
| 1158 { | |
| 1159 fprintf( stderr, "Option -U needs argument.\n" ); | |
| 1160 result = EXIT_FAILURE; | |
| 1161 } | |
| 1162 else | |
| 1163 doUninteresting( *argv ); | |
| 1164 break; | |
| 1131 case '?': | 1165 case '?': |
| 1132 /* Error message already printed by getopt_long */ | 1166 /* Error message already printed by getopt_long */ |
| 1133 result = EXIT_FAILURE; | 1167 result = EXIT_FAILURE; |
| 1134 break; | 1168 break; |
| 1135 case 'v': | 1169 case 'v': |
