Mercurial > noffle
comparison src/client.c @ 120:05f50c1761d9 noffle
[svn] Applied patch from Matija Nalis:
Counters for monitoring --fetch progress.
author | enz |
---|---|
date | Wed, 19 Jul 2000 08:02:45 +0100 |
parents | dd2fbc88601d |
children | ec190bad201b |
comparison
equal
deleted
inserted
replaced
119:f50cc311e29a | 120:05f50c1761d9 |
---|---|
1 /* | 1 /* |
2 client.c | 2 client.c |
3 | 3 |
4 $Id: client.c 156 2000-06-24 20:29:52Z bears $ | 4 $Id: client.c 174 2000-07-19 07:02:45Z enz $ |
5 */ | 5 */ |
6 | 6 |
7 #if HAVE_CONFIG_H | 7 #if HAVE_CONFIG_H |
8 #include <config.h> | 8 #include <config.h> |
9 #endif | 9 #endif |
955 Pseudo_retrievingFailed( msgId, reason ); | 955 Pseudo_retrievingFailed( msgId, reason ); |
956 Db_setStatus( msgId, status | DB_RETRIEVING_FAILED ); | 956 Db_setStatus( msgId, status | DB_RETRIEVING_FAILED ); |
957 } | 957 } |
958 | 958 |
959 static Bool | 959 static Bool |
960 retrieveAndStoreArt( const char *msgId ) | 960 retrieveAndStoreArt( const char *msgId, int artcnt, int artmax ) |
961 { | 961 { |
962 Bool err; | 962 Bool err; |
963 DynStr *s = NULL; | 963 DynStr *s = NULL; |
964 Str line; | 964 Str line; |
965 | 965 |
966 Log_inf( "Retrieving %s", msgId ); | 966 Log_inf( "[%d/%d] Retrieving %s", artcnt, artmax, msgId ); |
967 s = new_DynStr( 5000 ); | 967 s = new_DynStr( 5000 ); |
968 while ( getTxtLn( line, &err ) && ! err ) | 968 while ( getTxtLn( line, &err ) && ! err ) |
969 DynStr_appLn( s, line ); | 969 DynStr_appLn( s, line ); |
970 if ( ! err ) | 970 if ( ! err ) |
971 { | 971 { |
1013 if ( ! putCmd( "ARTICLE %s", msgId ) ) | 1013 if ( ! putCmd( "ARTICLE %s", msgId ) ) |
1014 retrievingFailed( msgId, "Connection broke down" ); | 1014 retrievingFailed( msgId, "Connection broke down" ); |
1015 else if ( getStat() != STAT_ART_FOLLOWS ) | 1015 else if ( getStat() != STAT_ART_FOLLOWS ) |
1016 retrievingFailed( msgId, client.lastStat ); | 1016 retrievingFailed( msgId, client.lastStat ); |
1017 else | 1017 else |
1018 retrieveAndStoreArt( msgId ); | 1018 retrieveAndStoreArt( msgId, 0, 0 ); |
1019 } | 1019 } |
1020 | 1020 |
1021 void | 1021 void |
1022 Client_retrieveArtList( const char *list ) | 1022 Client_retrieveArtList( const char *list, int *artcnt, int artmax ) |
1023 { | 1023 { |
1024 Str msgId; | 1024 Str msgId; |
1025 DynStr *s; | 1025 DynStr *s; |
1026 const char *p; | 1026 const char *p; |
1027 | 1027 |
1047 p = DynStr_str( s ); | 1047 p = DynStr_str( s ); |
1048 while ( ( p = Utl_getLn( msgId, p ) ) ) | 1048 while ( ( p = Utl_getLn( msgId, p ) ) ) |
1049 { | 1049 { |
1050 if ( getStat() != STAT_ART_FOLLOWS ) | 1050 if ( getStat() != STAT_ART_FOLLOWS ) |
1051 retrievingFailed( msgId, client.lastStat ); | 1051 retrievingFailed( msgId, client.lastStat ); |
1052 else if ( ! retrieveAndStoreArt( msgId ) ) | 1052 else if ( ! retrieveAndStoreArt( msgId, ++(*artcnt), artmax ) ) |
1053 break; | 1053 break; |
1054 } | 1054 } |
1055 del_DynStr( s ); | 1055 del_DynStr( s ); |
1056 } | 1056 } |
1057 | 1057 |