]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libventi/fcallfmt.c
upas/Mail: avoid showing empty To: and CC: lines in compose windows
[plan9front.git] / sys / src / libventi / fcallfmt.c
1 #include <u.h>
2 #include <libc.h>
3 #include <venti.h>
4
5 int
6 vtfcallfmt(Fmt *f)
7 {
8         VtFcall *t;
9
10         t = va_arg(f->args, VtFcall*);
11         if(t == nil){
12                 fmtprint(f, "<nil fcall>");
13                 return 0;
14         }
15         switch(t->msgtype){
16         default:
17                 return fmtprint(f, "%c%d tag %ud", "TR"[t->msgtype&1], t->msgtype>>1, t->tag);
18         case VtRerror:
19                 return fmtprint(f, "Rerror tag %ud error %s", t->tag, t->error);
20         case VtTping:
21                 return fmtprint(f, "Tping tag %ud", t->tag);
22         case VtRping:
23                 return fmtprint(f, "Rping tag %ud", t->tag);
24         case VtThello:
25                 return fmtprint(f, "Thello tag %ud vers %s uid %s strength %d crypto %d:%.*H codec %d:%.*H", t->tag,
26                         t->version, t->uid, t->strength, t->ncrypto, t->ncrypto, t->crypto,
27                         t->ncodec, t->ncodec, t->codec);
28         case VtRhello:
29                 return fmtprint(f, "Rhello tag %ud sid %s rcrypto %d rcodec %d", t->tag, t->sid, t->rcrypto, t->rcodec);
30         case VtTgoodbye:
31                 return fmtprint(f, "Tgoodbye tag %ud", t->tag);
32         case VtRgoodbye:
33                 return fmtprint(f, "Rgoodbye tag %ud", t->tag);
34         case VtTauth0:
35                 return fmtprint(f, "Tauth0 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
36         case VtRauth0:
37                 return fmtprint(f, "Rauth0 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
38         case VtTauth1:
39                 return fmtprint(f, "Tauth1 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
40         case VtRauth1:
41                 return fmtprint(f, "Rauth1 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
42         case VtTread:
43                 return fmtprint(f, "Tread tag %ud score %V blocktype %d count %d", t->tag, t->score, t->blocktype, t->count);
44         case VtRread:
45                 return fmtprint(f, "Rread tag %ud count %d", t->tag, packetsize(t->data));
46         case VtTwrite:
47                 return fmtprint(f, "Twrite tag %ud blocktype %d count %d", t->tag, t->blocktype, packetsize(t->data));
48         case VtRwrite:
49                 return fmtprint(f, "Rwrite tag %ud score %V", t->tag, t->score);
50         case VtTsync:
51                 return fmtprint(f, "Tsync tag %ud", t->tag);
52         case VtRsync:
53                 return fmtprint(f, "Rsync tag %ud", t->tag);
54         }
55 }