Commit 59c6ecdc 59c6ecdc410336c82e15af70242c5cb532176a24 by Sergey Poznyakoff

Minor changes. The screen is 80x24!

1 parent 57386437
...@@ -50,60 +50,101 @@ extern int mu_nntp_stls (mu_nntp_t nntp); ...@@ -50,60 +50,101 @@ extern int mu_nntp_stls (mu_nntp_t nntp);
50 50
51 extern int mu_nntp_mode_reader (mu_nntp_t nntp); 51 extern int mu_nntp_mode_reader (mu_nntp_t nntp);
52 52
53 /* An iterator is return with the multi-line answer. It is the responsability of 53 /* An iterator is return with the multi-line answer. It is the responsibility
54 the caller to call iterator_destroy() to dispose of the iterator. */ 54 of the caller to call iterator_destroy() to dispose of the iterator. */
55 extern int mu_nntp_list_extensions (mu_nntp_t nntp, iterator_t *iterator); 55 extern int mu_nntp_list_extensions (mu_nntp_t nntp, iterator_t *iterator);
56 56
57 extern int mu_nntp_quit (mu_nntp_t nntp); 57 extern int mu_nntp_quit (mu_nntp_t nntp);
58 58
59 /* The argument name is allocated with malloc(3). The caller is responsable to call free(3) */ 59 /* The argument name is allocated with malloc(3). The caller is responsible
60 extern int mu_nntp_group (mu_nntp_t nntp, const char *group, unsigned long *total, unsigned long *first, 60 to call free(3) */
61 extern int mu_nntp_group (mu_nntp_t nntp,
62 const char *group,
63 unsigned long *total,
64 unsigned long *first,
61 unsigned long *last, char **name); 65 unsigned long *last, char **name);
62 66
63 /* The argument mid is allocated with malloc(3). The caller is responsable to call free(3) */ 67 /* The argument mid is allocated with malloc(3). The caller is responsible
64 extern int mu_nntp_last (mu_nntp_t nntp, unsigned long *number, char **mid); 68 to call free(3) */
65 extern int mu_nntp_next (mu_nntp_t nntp, unsigned long *number, char **mid); 69 extern int mu_nntp_last (mu_nntp_t nntp,
66 70 unsigned long *number, char **mid);
67 /* The argument mid is allocated with malloc(3). The caller is responsable to call free(3). 71 extern int mu_nntp_next (mu_nntp_t nntp,
68 The caller must call stream_destoy() when done, no other commands are permitted until the stream is destroyed. */ 72 unsigned long *number, char **mid);
69 extern int mu_nntp_article (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid, stream_t *stream); 73
70 extern int mu_nntp_article_id (mu_nntp_t nntp, const char *id, unsigned long *pnum, char **mid, stream_t *stream); 74 /* The argument mid is allocated with malloc(3). The caller is responsible
71 extern int mu_nntp_head (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid, stream_t *stream); 75 to call free(3). The caller must call stream_destoy() when done, no
72 extern int mu_nntp_head_id (mu_nntp_t nntp, const char *name, unsigned long *pnum, char **mid, stream_t *stream); 76 other commands are permitted until the stream is destroyed. */
73 extern int mu_nntp_body (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid, stream_t *stream); 77 extern int mu_nntp_article (mu_nntp_t nntp, unsigned long number,
74 extern int mu_nntp_body_id (mu_nntp_t nntp, const char *id, unsigned long *pnum, char **mid, stream_t *stream); 78 unsigned long *pnum, char **mid,
75 79 stream_t *stream);
76 /* The argument mid is allocated with malloc(3). The caller is responsable to call free(3) */ 80 extern int mu_nntp_article_id (mu_nntp_t nntp, const char *id,
77 extern int mu_nntp_stat (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid); 81 unsigned long *pnum, char **mid,
78 extern int mu_nntp_stat_id (mu_nntp_t nntp, const char *id, unsigned long *pnum, char **mid); 82 stream_t *stream);
79 83 extern int mu_nntp_head (mu_nntp_t nntp, unsigned long number,
80 extern int mu_nntp_date (mu_nntp_t nntp, unsigned int *year, unsigned int *month, unsigned int *day, 84 unsigned long *pnum, char **mid,
81 unsigned int *hour, unsigned int *minute, unsigned int *second); 85 stream_t *stream);
82 86 extern int mu_nntp_head_id (mu_nntp_t nntp, const char *name,
83 /* The caller must call stream_destoy() when done, no other commands are permitted until the stream is destroyed. */ 87 unsigned long *pnum, char **mid,
88 stream_t *stream);
89 extern int mu_nntp_body (mu_nntp_t nntp, unsigned long number,
90 unsigned long *pnum, char **mid,
91 stream_t *stream);
92 extern int mu_nntp_body_id (mu_nntp_t nntp, const char *id,
93 unsigned long *pnum, char **mid,
94 stream_t *stream);
95
96 /* The argument mid is allocated with malloc(3). The caller is responsible
97 to call free(3) */
98 extern int mu_nntp_stat (mu_nntp_t nntp, unsigned long number,
99 unsigned long *pnum, char **mid);
100 extern int mu_nntp_stat_id (mu_nntp_t nntp, const char *id,
101 unsigned long *pnum, char **mid);
102
103 extern int mu_nntp_date (mu_nntp_t nntp, unsigned int *year,
104 unsigned int *month, unsigned int *day,
105 unsigned int *hour, unsigned int *minute,
106 unsigned int *second);
107
108 /* The caller must call stream_destoy() when done, no other commands are
109 permitted until the stream is destroyed. */
84 extern int mu_nntp_help (mu_nntp_t nntp, stream_t *stream); 110 extern int mu_nntp_help (mu_nntp_t nntp, stream_t *stream);
85 111
86 112
87 /* An iterator is return with the multi-line answer. It is the responsability of 113 /* An iterator is return with the multi-line answer. It is the responsibility
88 the caller to call iterator_destroy() to dispose of the iterator. */ 114 of the caller to call iterator_destroy() to dispose of the iterator. */
89 extern int mu_nntp_newgroups (mu_nntp_t nntp, unsigned int year, unsigned int month, unsigned int day, 115 extern int mu_nntp_newgroups (mu_nntp_t nntp, unsigned int year,
90 unsigned int hour, unsigned int minute, unsigned int second, int is_gmt, iterator_t *iterator); 116 unsigned int month, unsigned int day,
91 /* A iterator is return with the multi-line answer. It is the responsability of 117 unsigned int hour, unsigned int minute,
92 the caller to call iterator_destroy() to dispose of the iterator. */ 118 unsigned int second, int is_gmt,
93 extern int mu_nntp_newnews (mu_nntp_t nntp, const char *wildmat, unsigned int year, unsigned int month, unsigned int day, 119 iterator_t *iterator);
94 unsigned int hour, unsigned int minute, unsigned int second, int is_gmt, iterator_t *iterator); 120
121 /* A iterator is return with the multi-line answer. It is the responsibility
122 of the caller to call iterator_destroy() to dispose of the iterator. */
123 extern int mu_nntp_newnews (mu_nntp_t nntp, const char *wildmat,
124 unsigned int year, unsigned int month,
125 unsigned int day, unsigned int hour,
126 unsigned int minute, unsigned int second,
127 int is_gmt, iterator_t *iterator);
95 128
96 extern int mu_nntp_post (mu_nntp_t nntp, stream_t stream); 129 extern int mu_nntp_post (mu_nntp_t nntp, stream_t stream);
97 extern int mu_nntp_ihave (mu_nntp_t nntp, const char *mid, stream_t stream); 130 extern int mu_nntp_ihave (mu_nntp_t nntp, const char *mid,
98 131 stream_t stream);
99 132
100 /* A iterator is return with the multi-line answer. It is the responsability of 133
101 the caller to call iterator_destroy() to dispose of the iterator. */ 134 /* A iterator is return with the multi-line answer. It is the responsibility
102 extern int mu_nntp_list_active (mu_nntp_t nntp, const char *wildmat, iterator_t *iterator); 135 of the caller to call iterator_destroy() to dispose of the iterator. */
103 extern int mu_nntp_list_active_times (mu_nntp_t nntp, const char *wildmat, iterator_t *iterator); 136 extern int mu_nntp_list_active (mu_nntp_t nntp, const char *wildmat,
104 extern int mu_nntp_list_distributions (mu_nntp_t nntp, const char *wildmat, iterator_t *iterator); 137 iterator_t *iterator);
138 extern int mu_nntp_list_active_times (mu_nntp_t nntp,
139 const char *wildmat,
140 iterator_t *iterator);
141 extern int mu_nntp_list_distributions (mu_nntp_t nntp,
142 const char *wildmat,
143 iterator_t *iterator);
105 extern int mu_nntp_list_distrib_pats (mu_nntp_t nntp, iterator_t *iterator); 144 extern int mu_nntp_list_distrib_pats (mu_nntp_t nntp, iterator_t *iterator);
106 extern int mu_nntp_list_newsgroups (mu_nntp_t nntp, const char *wildmat, iterator_t *iterator); 145 extern int mu_nntp_list_newsgroups (mu_nntp_t nntp,
146 const char *wildmat,
147 iterator_t *iterator);
107 148
108 149
109 /* Parse the list active response. 150 /* Parse the list active response.
...@@ -116,50 +157,74 @@ extern int mu_nntp_list_newsgroups (mu_nntp_t nntp, const char *wildmat, ite ...@@ -116,50 +157,74 @@ extern int mu_nntp_list_newsgroups (mu_nntp_t nntp, const char *wildmat, ite
116 'm': posting is not permitted 157 'm': posting is not permitted
117 'm': postings will be moderated 158 'm': postings will be moderated
118 159
119 The argument group is allocated with malloc(3). The caller is responsable to call free(3). 160 The argument group is allocated with malloc(3). The caller is responsible
161 to call free(3).
120 */ 162 */
121 extern int mu_nntp_parse_list_active (const char *buffer, char **group, unsigned long *high, unsigned long *low, char *status); 163
122 extern int mu_nntp_parse_newgroups (const char *buffer, char **group, unsigned long *high, unsigned long *low, char *status); 164 extern int mu_nntp_parse_list_active (const char *buffer, char **group,
165 unsigned long *high, unsigned long *low,
166 char *status);
167 extern int mu_nntp_parse_newgroups (const char *buffer, char **group,
168 unsigned long *high, unsigned long *low,
169 char *status);
170
123 /* Parse the list active.times response. 171 /* Parse the list active.times response.
124 "group time creator" 172 "group time creator"
125 group: is the name of the group 173 group: is the name of the group
126 time: measure in seconds since Jan 1 1970 174 time: measure in seconds since Jan 1 1970
127 creator: entity taht created the newsgroup 175 creator: entity taht created the newsgroup
128 176
129 The argument group/creator is allocated with malloc(3). The caller is responsable to call free(3). 177 The argument group/creator is allocated with malloc(3). The caller is
178 responsible to call free(3).
130 */ 179 */
131 extern int mu_nntp_parse_list_active_times (const char *buffer, char **group, unsigned long *time, char **creator); 180
181 extern int mu_nntp_parse_list_active_times (const char *buffer, char **group,
182 unsigned long *time,
183 char **creator);
132 /* Parse the list distributions response. 184 /* Parse the list distributions response.
133 "key value" 185 "key value"
134 key: field key. 186 key: field key.
135 value: short explaination of key 187 value: short explaination of key
136 188
137 The argument key/value is allocated with malloc(3). The caller is responsable to call free(3). 189 The argument key/value is allocated with malloc(3). The caller is responsible
190 to call free(3).
138 */ 191 */
139 extern int mu_nntp_parse_list_distributions (const char *buffer, char **key, char **value); 192 extern int mu_nntp_parse_list_distributions (const char *buffer,
193 char **key, char **value);
194
140 /* Parse the list distributions response. 195 /* Parse the list distributions response.
141 "weight:wildmat:distrib" 196 "weight:wildmat:distrib"
142 weight: 197 weight:
143 wildmat: 198 wildmat:
144 distrib: 199 distrib:
145 200
146 The argument wildmat/distrib is allocated with malloc(3). The caller is responsable to call free(3). 201 The argument wildmat/distrib is allocated with malloc(3). The caller is
202 responsible to call free(3).
147 */ 203 */
148 extern int mu_nntp_parse_list_distrib_pats (const char *buffer, unsigned long *weight, char **wildmat, char **distrib); 204 extern int mu_nntp_parse_list_distrib_pats (const char *buffer,
205 unsigned long *weight,
206 char **wildmat, char **distrib);
207
149 /* Parse the list distributions response. 208 /* Parse the list distributions response.
150 "group description" 209 "group description"
151 210
152 The argument group/description is allocated with malloc(3). The caller is responsable to call free(3). 211 The argument group/description is allocated with malloc(3). The caller is
212 responsible to call free(3).
153 */ 213 */
154 extern int mu_nntp_parse_list_newsgroups (const char *buffer, char **group, char **description); 214 extern int mu_nntp_parse_list_newsgroups (const char *buffer, char **group,
215 char **description);
155 216
156 /* Reads the multi-line response of the server, nread will be 0 when the termination octets 217 /* Reads the multi-line response of the server, nread will be 0 when the
157 are detected. Clients should not use this function unless they are sending direct command. */ 218 termination octets are detected. Clients should not use this function
158 extern int mu_nntp_readline (mu_nntp_t nntp, char *buffer, size_t buflen, size_t *nread); 219 unless they are sending a direct command. */
220 extern int mu_nntp_readline (mu_nntp_t nntp, char *buffer,
221 size_t buflen, size_t *nread);
159 222
160 /* Returns the last command acknowledge. If the server supports RESP-CODE, the message 223 /* Returns the last command acknowledge. If the server supports RESP-CODE,
161 could be retrieve, but it is up the caller to do the parsing. */ 224 the message could be retrieved, but it is up the caller to do the parsing.
162 extern int mu_nntp_response (mu_nntp_t nntp, char *buffer, size_t buflen, size_t *nread); 225 */
226 extern int mu_nntp_response (mu_nntp_t nntp, char *buffer,
227 size_t buflen, size_t *nread);
163 228
164 /* pop3_writeline copies the line in the internal buffer, a mu_pop3_send() is 229 /* pop3_writeline copies the line in the internal buffer, a mu_pop3_send() is
165 needed to do the actual transmission. */ 230 needed to do the actual transmission. */
...@@ -174,6 +239,8 @@ extern int mu_nntp_sendline (mu_nntp_t nntp, const char *line); ...@@ -174,6 +239,8 @@ extern int mu_nntp_sendline (mu_nntp_t nntp, const char *line);
174 /* Transmit via the carrier the internal buffer data. */ 239 /* Transmit via the carrier the internal buffer data. */
175 extern int mu_nntp_send (mu_nntp_t nntp); 240 extern int mu_nntp_send (mu_nntp_t nntp);
176 241
242 extern int mu_nntp_response_code (mu_nntp_t nntp);
243
177 #ifdef __cplusplus 244 #ifdef __cplusplus
178 } 245 }
179 #endif 246 #endif
......