imap-send.c: remove msg_data::flags, which was always zero

This removes the need for function imap_make_flags(), so delete it, too. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Jan 15, 2013 at 09:06 UTC 719125c522bbcdbdb4c5c36c914a8c1bce5e00d4
1 file changed +3 -37
imap-send.c
+3 -37
@@ -70,7 +70,6 @@ struct store {
70
71 struct msg_data {
72 struct strbuf data;
73 - unsigned char flags;
73 };
74
75 static const char imap_send_usage[] = "git imap-send < <mbox>";
@@ -225,14 +224,6 @@ static const char *cap_list[] = {
224 static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd);
225
226
228 -static const char *Flags[] = {
229 - "Draft",
230 - "Flagged",
231 - "Answered",
232 - "Seen",
233 - "Deleted",
234 -};
235 -
227 #ifndef NO_OPENSSL
228 static void ssl_socket_perror(const char *func)
229 {
@@ -1246,23 +1237,6 @@ bail:
1237 return NULL;
1238 }
1239
1249 -static int imap_make_flags(int flags, char *buf)
1250 -{
1251 - const char *s;
1252 - unsigned i, d;
1253 -
1254 - for (i = d = 0; i < ARRAY_SIZE(Flags); i++)
1255 - if (flags & (1 << i)) {
1256 - buf[d++] = ' ';
1257 - buf[d++] = '\\';
1258 - for (s = Flags[i]; *s; s++)
1259 - buf[d++] = *s;
1260 - }
1261 - buf[0] = '(';
1262 - buf[d++] = ')';
1263 - return d;
1264 -}
1265 -
1240 static void lf_to_crlf(struct strbuf *msg)
1241 {
1242 size_t new_len;
@@ -1311,8 +1285,7 @@ static int imap_store_msg(struct store *gctx, struct msg_data *msg)
1285 struct imap *imap = ctx->imap;
1286 struct imap_cmd_cb cb;
1287 const char *prefix, *box;
1314 - int ret, d;
1315 - char flagstr[128];
1288 + int ret;
1289
1290 lf_to_crlf(&msg->data);
1291 memset(&cb, 0, sizeof(cb));
@@ -1320,17 +1293,10 @@ static int imap_store_msg(struct store *gctx, struct msg_data *msg)
1293 cb.dlen = msg->data.len;
1294 cb.data = strbuf_detach(&msg->data, NULL);
1295
1323 - d = 0;
1324 - if (msg->flags) {
1325 - d = imap_make_flags(msg->flags, flagstr);
1326 - flagstr[d++] = ' ';
1327 - }
1328 - flagstr[d] = 0;
1329 -
1296 box = gctx->name;
1297 prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
1298 cb.create = 0;
1333 - ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" %s", prefix, box, flagstr);
1299 + ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" ", prefix, box);
1300 imap->caps = imap->rcaps;
1301 if (ret != DRV_OK)
1302 return ret;
@@ -1483,7 +1449,7 @@ static int git_imap_config(const char *key, const char *val, void *cb)
1449 int main(int argc, char **argv)
1450 {
1451 struct strbuf all_msgs = STRBUF_INIT;
1486 - struct msg_data msg = {STRBUF_INIT, 0};
1452 + struct msg_data msg = {STRBUF_INIT};
1453 struct store *ctx = NULL;
1454 int ofs = 0;
1455 int r;