Attempt to fix origin line
This commit is contained in:
parent
d03cc0b023
commit
f5193b6616
@ -261,14 +261,11 @@ int parse_config_file(char *filename) {
|
||||
}
|
||||
|
||||
int isdupe(struct msg_t *msg, char *uuid) {
|
||||
s_JamBase *jb;
|
||||
s_JamBaseHeader jbh;
|
||||
s_JamMsgHeader jmh;
|
||||
s_JamSubPacket* jsp;
|
||||
|
||||
int areaid;
|
||||
int i;
|
||||
int z;
|
||||
char buffer[PATH_MAX];
|
||||
FILE *fptr;
|
||||
|
||||
for (i=0;i<area_count;i++) {
|
||||
if (msg->area == areas[i]->id) {
|
||||
@ -277,33 +274,24 @@ int isdupe(struct msg_t *msg, char *uuid) {
|
||||
}
|
||||
}
|
||||
|
||||
jb = open_jam_base(areas[areaid]->basedir);
|
||||
if (!jb) {
|
||||
return -1;
|
||||
}
|
||||
JAM_ReadMBHeader(jb, &jbh);
|
||||
if (jbh.ActiveMsgs > 0) {
|
||||
for (i=0;i<jbh.ActiveMsgs;i++) {
|
||||
memset(&jmh, 0, sizeof(s_JamMsgHeader));
|
||||
z = JAM_ReadMsgHeader(jb, i, &jmh, &jsp);
|
||||
snprintf(buffer, PATH_MAX, "%s.msgids", areas[areaid]->basedir);
|
||||
|
||||
if (z != 0) {
|
||||
continue;
|
||||
}
|
||||
for (z=0;z<jsp->NumFields;z++) {
|
||||
if (jsp->Fields[z]->LoID == JAMSFLD_MSGID) {
|
||||
if (strncasecmp(uuid, jsp->Fields[z]->Buffer, 36) == 0) {
|
||||
JAM_DelSubPacket(jsp);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fptr = fopen(buffer, "r");
|
||||
if (!fptr) {
|
||||
return 0;
|
||||
}
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
|
||||
fgets(buffer, 1024, fptr);
|
||||
|
||||
while (!feof(fptr)) {
|
||||
if (strncasecmp(buffer, uuid, 36) == 0) {
|
||||
fclose(fptr);
|
||||
return 1;
|
||||
}
|
||||
fgets(buffer, 1024, fptr);
|
||||
}
|
||||
|
||||
fclose(fptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -387,9 +375,9 @@ int import(char *filename) {
|
||||
|
||||
fread(&msg, sizeof(struct msg_t), 1, fptr);
|
||||
|
||||
body = malloc(st.st_size - sizeof(struct msg_t) + 1);
|
||||
body = malloc(st.st_size - sizeof(struct msg_t) + 1 + strlen(fido_addr));
|
||||
|
||||
memset(body, 0, st.st_size - sizeof(struct msg_t) + 1);
|
||||
memset(body, 0, st.st_size - sizeof(struct msg_t) + 1 + strlen(fido_addr));
|
||||
|
||||
fread(body, st.st_size - sizeof(struct msg_t), 1, fptr);
|
||||
|
||||
@ -496,6 +484,18 @@ int import(char *filename) {
|
||||
}
|
||||
|
||||
|
||||
for (i=strlen(body) -2; i > 0; i--) {
|
||||
if (body[i] == '(') {
|
||||
sprintf(&body[i], "(%s)\r", fido_addr);
|
||||
break;
|
||||
} if (body[i] == '\r') {
|
||||
sprintf(buffer, "\r---\r * Origin: Origin Line Missing... (%s)", fido_addr);
|
||||
body = realloc(body, strlen(body) + strlen(buffer) + 1);
|
||||
strcat(body, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JAM_ClearMsgHeader(&jmh);
|
||||
jmh.DateWritten = msg.timedate;
|
||||
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
||||
|
Reference in New Issue
Block a user