Skip to content
Snippets Groups Projects
Commit 0075216f authored by rswindell's avatar rswindell
Browse files

Moved get_msg_by_id() into str_util.c.

parent 426e1f46
No related branches found
No related tags found
No related merge requests found
...@@ -374,36 +374,6 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm ...@@ -374,36 +374,6 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
return(TRUE); return(TRUE);
} }
BOOL get_msg_by_id(scfg_t* scfg, smb_t* smb, char* id, smbmsg_t* msg)
{
ulong n;
int ret;
for(n=0;n<smb->status.last_msg;n++) {
memset(msg,0,sizeof(smbmsg_t));
msg->offset=n;
if(smb_getmsgidx(smb, msg)!=0)
break;
if(smb_lockmsghdr(smb,msg)!=0)
continue;
ret=smb_getmsghdr(smb,msg);
smb_unlockmsghdr(smb,msg);
if(ret!=SMB_SUCCESS)
continue;
if(strcmp(get_msgid(scfg,smb->subnum,msg),id)==0)
return(TRUE);
smb_freemsgmem(msg);
}
return(FALSE);
}
BOOL msg_offset_by_id(scfg_t* scfg, smb_t* smb, char* id, ulong* offset) BOOL msg_offset_by_id(scfg_t* scfg, smb_t* smb, char* id, ulong* offset)
{ {
smbmsg_t msg; smbmsg_t msg;
......
...@@ -793,6 +793,7 @@ extern "C" { ...@@ -793,6 +793,7 @@ extern "C" {
DLLEXPORT ushort DLLCALL subject_crc(char *subj); DLLEXPORT ushort DLLCALL subject_crc(char *subj);
DLLEXPORT char * DLLCALL ftn_msgid(sub_t* sub, smbmsg_t* msg); DLLEXPORT char * DLLCALL ftn_msgid(sub_t* sub, smbmsg_t* msg);
DLLEXPORT char * DLLCALL get_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg); DLLEXPORT char * DLLCALL get_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg);
DLLEXPORT BOOL DLLCALL get_msg_by_id(scfg_t* scfg, smb_t* smb, char* id, smbmsg_t* msg);
DLLEXPORT char * DLLCALL ultoac(ulong l,char *str); DLLEXPORT char * DLLCALL ultoac(ulong l,char *str);
......
...@@ -384,6 +384,38 @@ char* DLLCALL get_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg) ...@@ -384,6 +384,38 @@ char* DLLCALL get_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg)
return(msgid); return(msgid);
} }
/****************************************************************************/
/* Retrieve a message by RFC822 message-ID */
/****************************************************************************/
BOOL DLLCALL get_msg_by_id(scfg_t* scfg, smb_t* smb, char* id, smbmsg_t* msg)
{
ulong n;
int ret;
for(n=0;n<smb->status.last_msg;n++) {
memset(msg,0,sizeof(smbmsg_t));
msg->offset=n;
if(smb_getmsgidx(smb, msg)!=0)
break;
if(smb_lockmsghdr(smb,msg)!=0)
continue;
ret=smb_getmsghdr(smb,msg);
smb_unlockmsghdr(smb,msg);
if(ret!=SMB_SUCCESS)
continue;
if(strcmp(get_msgid(scfg,smb->subnum,msg),id)==0)
return(TRUE);
smb_freemsgmem(msg);
}
return(FALSE);
}
/****************************************************************************/ /****************************************************************************/
/* Returns string for 2 digit hex+ numbers up to 575 */ /* Returns string for 2 digit hex+ numbers up to 575 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment