32 if((t = _strfindattr(a, "tag")) == nil){
33 flog("bad confirm write: no tag");
37 tag = strtoul(t, 0, 0);
38 if((ans = _strfindattr(a, "answer")) == nil){
39 flog("bad confirm write: no answer");
43 if(strcmp(ans, "yes") == 0)
45 else if(strcmp(ans, "no") == 0)
48 flog("bad confirm write: bad answer");
49 werrstr("bad answer");
52 for(c=conv; c; c=c->next){
54 nbsendul(c->keywait, allow);
59 werrstr("tag not found");
66 confirmkey(Conv *c, Key *k)
70 if(*confirminuse == 0)
73 lbappend(&confbuf, "confirm tag=%lud %A %N", c->tag, k->attr, k->privattr);
74 flog("confirm %A %N", k->attr, k->privattr);
75 c->state = "keyconfirm";
76 ret = recvul(c->keywait);
77 flog("confirm=%d %A %N", ret, k->attr, k->privattr);
86 lbread(&needkeybuf, r);
92 lbflush(&needkeybuf, r);
105 werrstr("empty write");
108 if((t = _strfindattr(a, "tag")) == nil){
113 tag = strtoul(t, 0, 0);
114 for(c=conv; c; c=c->next)
116 nbsendul(c->keywait, 0);
120 werrstr("tag not found");
129 needkey(Conv *c, Attr *a)
131 if(c == nil || *needkeyinuse == 0)
134 lbappend(&needkeybuf, "needkey tag=%lud %A", c->tag, a);
135 flog("needkey %A", a);
136 return nbrecvul(c->keywait);
140 badkey(Conv *c, Key *k, char *msg, Attr *a)
142 if(c == nil || *needkeyinuse == 0)
145 lbappend(&needkeybuf, "badkey tag=%lud %A %N\n%s\n%A",
146 c->tag, k->attr, k->privattr, msg, a);
147 flog("badkey %A / %N / %s / %A",
148 k->attr, k->privattr, msg, a);
149 return nbrecvul(c->keywait);