Add other nettype support to lua_glue

This commit is contained in:
Andrew Pamment 2018-11-03 16:55:57 +10:00
parent 18443d247e
commit 13dd935351

View File

@ -407,7 +407,9 @@ int l_postMessage(lua_State *L) {
const char *subject = lua_tostring(L, 5); const char *subject = lua_tostring(L, 5);
const char *body = lua_tostring(L, 6); const char *body = lua_tostring(L, 6);
int sem_fd; int sem_fd;
uuid_t mnet_msgid;
uuid_t qwk_msgid;
char qwkuuid[38];
char buffer[256]; char buffer[256];
s_JamBase *jb; s_JamBase *jb;
@ -464,47 +466,69 @@ int l_postMessage(lua_State *L) {
jsf.Buffer = (char *)subject; jsf.Buffer = (char *)subject;
JAM_PutSubfield(jsp, &jsf); JAM_PutSubfield(jsp, &jsf);
if (ma->type == TYPE_ECHOMAIL_AREA || ma->type == TYPE_NEWSGROUP_AREA) { if (mc->networked) {
jmh.Attribute |= JAM_MSG_TYPEECHO; if (mc->nettype == NETWORK_FIDO) {
if (ma->type == TYPE_ECHOMAIL_AREA || ma->type == TYPE_NEWSGROUP_AREA) {
jmh.Attribute |= JAM_MSG_TYPEECHO;
if (mc->fidoaddr->point) { if (mc->fidoaddr->point) {
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", snprintf(buffer, sizeof buffer, "%d:%d/%d.%d",
mc->fidoaddr->zone, mc->fidoaddr->zone,
mc->fidoaddr->net, mc->fidoaddr->net,
mc->fidoaddr->node, mc->fidoaddr->node,
mc->fidoaddr->point); mc->fidoaddr->point);
} else { } else {
snprintf(buffer, sizeof buffer, "%d:%d/%d", snprintf(buffer, sizeof buffer, "%d:%d/%d",
mc->fidoaddr->zone, mc->fidoaddr->zone,
mc->fidoaddr->net, mc->fidoaddr->net,
mc->fidoaddr->node); mc->fidoaddr->node);
}
jsf.LoID = JAMSFLD_OADDRESS;
jsf.HiID = 0;
jsf.DatLen = strlen(buffer);
jsf.Buffer = (char *)buffer;
JAM_PutSubfield(jsp, &jsf);
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx",
mc->fidoaddr->zone,
mc->fidoaddr->net,
mc->fidoaddr->node,
mc->fidoaddr->point,
generate_msgid());
jsf.LoID = JAMSFLD_MSGID;
jsf.HiID = 0;
jsf.DatLen = strlen(buffer);
jsf.Buffer = (char *)buffer;
JAM_PutSubfield(jsp, &jsf);
jmh.MsgIdCRC = JAM_Crc32(buffer, strlen(buffer));
} else if (ma->type == TYPE_NETMAIL_AREA) {
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
free(jb);
return 0;
}
} else if (mc->nettype == NETWORK_MAGI) {
uuid_generate(mnet_msgid);
uuid_unparse_lower(mnet_msgid, buffer);
jsf.LoID = JAMSFLD_MSGID;
jsf.HiID = 0;
jsf.DatLen = strlen(buffer);
jsf.Buffer = (char *)buffer;
JAM_PutSubfield(jsp, &jsf);
} else if (mc->nettype == NETWORK_QWK) {
uuid_generate(qwk_msgid);
uuid_unparse_lower(qwk_msgid, qwkuuid);
snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address);
jsf.LoID = JAMSFLD_MSGID;
jsf.HiID = 0;
jsf.DatLen = strlen(buffer);
jsf.Buffer = (char *)buffer;
JAM_PutSubfield(jsp, &jsf);
} }
jsf.LoID = JAMSFLD_OADDRESS;
jsf.HiID = 0;
jsf.DatLen = strlen(buffer);
jsf.Buffer = (char *)buffer;
JAM_PutSubfield(jsp, &jsf);
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx",
mc->fidoaddr->zone,
mc->fidoaddr->net,
mc->fidoaddr->node,
mc->fidoaddr->point,
generate_msgid());
jsf.LoID = JAMSFLD_MSGID;
jsf.HiID = 0;
jsf.DatLen = strlen(buffer);
jsf.Buffer = (char *)buffer;
JAM_PutSubfield(jsp, &jsf);
jmh.MsgIdCRC = JAM_Crc32(buffer, strlen(buffer));
} else if (ma->type == TYPE_NETMAIL_AREA) {
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
free(jb);
return 0;
} }
while (1) { while (1) {
z = JAM_LockMB(jb, 100); z = JAM_LockMB(jb, 100);
if (z == 0) { if (z == 0) {