Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
6b6aaa69
Commit
6b6aaa69
authored
20 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created smb_init_idx() which initializes the idx record in an smbmsg_t (to be
used by smb_addmsg() and other higher level functions).
parent
26f99bfe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/smblib/smbhash.c
+42
-1
42 additions, 1 deletion
src/smblib/smbhash.c
src/smblib/smblib.h
+2
-0
2 additions, 0 deletions
src/smblib/smblib.h
with
44 additions
and
1 deletion
src/smblib/smbhash.c
+
42
−
1
View file @
6b6aaa69
...
...
@@ -330,11 +330,14 @@ int SMBCALL smb_getmsghdr_by_hash(smb_t* smb, smbmsg_t* msg, unsigned source
return
(
retval
);
}
ushort
SMBCALL
smb_subject_crc
(
const
char
*
subj
)
ushort
SMBCALL
smb_subject_crc
(
const
char
*
subj
)
{
char
*
str
;
ushort
crc
;
if
(
subj
==
NULL
)
return
(
0xffff
);
while
(
!
strnicmp
(
subj
,
"RE:"
,
3
))
{
subj
+=
3
;
while
(
*
subj
==
' '
)
...
...
@@ -350,3 +353,41 @@ ushort SMBCALL smb_subject_crc(const char *subj)
return
(
crc
);
}
ushort
SMBCALL
smb_name_crc
(
const
char
*
name
)
{
char
*
str
;
ushort
crc
;
if
(
name
==
NULL
)
return
(
0xffff
);
if
((
str
=
strdup
(
name
))
==
NULL
)
return
(
0xffff
);
strlwr
(
str
);
crc
=
crc16
(
str
,
0
/* auto-length */
);
free
(
str
);
return
(
crc
);
}
int
SMBCALL
smb_init_idx
(
smb_t
*
smb
,
smbmsg_t
*
msg
)
{
msg
->
idx
.
subj
=
smb_subject_crc
(
msg
->
subj
);
if
(
smb
->
status
.
attr
&
SMB_EMAIL
)
{
if
(
msg
->
to_ext
)
msg
->
idx
.
to
=
atoi
(
msg
->
to_ext
);
else
msg
->
idx
.
to
=
0
;
if
(
msg
->
from_ext
)
msg
->
idx
.
from
=
atoi
(
msg
->
from_ext
);
else
msg
->
idx
.
from
=
0
;
}
else
{
msg
->
idx
.
to
=
smb_name_crc
(
msg
->
to
);
msg
->
idx
.
from
=
smb_name_crc
(
msg
->
from
);
}
return
(
SMB_SUCCESS
);
}
This diff is collapsed.
Click to expand it.
src/smblib/smblib.h
+
2
−
0
View file @
6b6aaa69
...
...
@@ -181,7 +181,9 @@ SMBEXPORT hash_t* SMBCALL smb_hashstr(ulong msgnum, ulong time, unsigned source
SMBEXPORT
hash_t
**
SMBCALL
smb_msghashes
(
smbmsg_t
*
msg
,
const
uchar
*
text
);
SMBEXPORT
int
SMBCALL
smb_addhashes
(
smb_t
*
smb
,
hash_t
**
hash_list
,
BOOL
skip_marked
);
SMBEXPORT
ushort
SMBCALL
smb_name_crc
(
const
char
*
name
);
SMBEXPORT
ushort
SMBCALL
smb_subject_crc
(
const
char
*
subj
);
SMBEXPORT
int
SMBCALL
smb_init_idx
(
smb_t
*
smb
,
smbmsg_t
*
msg
);
/* Fast look-up functions (using hashes) */
SMBEXPORT
int
SMBCALL
smb_getmsgidx_by_hash
(
smb_t
*
smb
,
smbmsg_t
*
msg
,
unsigned
source
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment