Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
46506076
Commit
46506076
authored
Jan 06, 2003
by
Per Cederqvist
Browse files
(do_set_user_area): Renamed a few local variables. Call
async_new_user_area when the user area changes.
parent
5fbbff4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server/person.c
View file @
46506076
/*
* $Id: person.c,v 0.7
4
2003/01/06 1
2:23:16
ceder Exp $
* $Id: person.c,v 0.7
5
2003/01/06 1
3:10:19
ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -74,6 +74,7 @@
#include
"local-to-global.h"
#include
"kom-memory.h"
#include
"server-time.h"
#include
"send-async.h"
BUGDECL
;
...
...
@@ -285,35 +286,36 @@ do_unmark_text(Pers_no pers_no,
static
Success
do_set_user_area
(
Pers_no
pers_no
,
Person
*
pers_p
,
/* May be NULL */
Text_no
user
_area
)
Text_no
new
_area
)
{
Text_stat
*
old_user_area
;
Text_stat
*
new_user_area
=
NULL
;
/* To stop gcc complaining. */
Text_no
old_area
;
Text_stat
*
old_stat
;
Text_stat
*
new_stat
=
NULL
;
/* To stop gcc complaining. */
/* Check that the new user_area exists before deleting the old*/
if
(
user
_area
!=
0
)
if
(
new
_area
!=
0
)
{
GET_T_STAT
(
new_
user_area
,
user
_area
,
FAILURE
);
GET_T_STAT
(
new_
stat
,
new
_area
,
FAILURE
);
if
(
!
text_read_access
(
active_connection
,
user
_area
,
new_
user_area
)
if
(
!
text_read_access
(
active_connection
,
new
_area
,
new_
stat
)
&&
!
ENA
(
admin
,
2
))
/* OK -- In an RPC call */
{
kom_errno
=
KOM_NO_SUCH_TEXT
;
err_stat
=
user
_area
;
err_stat
=
new
_area
;
return
FAILURE
;
}
if
(
new_
user_area
->
no_of_marks
>=
param
.
max_marks_text
)
if
(
new_
stat
->
no_of_marks
>=
param
.
max_marks_text
)
{
kom_log
(
"LIMIT: set_user_area(%d, %lu): "
"New user_area's mark count (%d) > %d.
\n
"
,
pers_no
,
(
unsigned
long
)
user
_area
,
new_
user_area
->
no_of_marks
,
(
unsigned
long
)
new
_area
,
new_
stat
->
no_of_marks
,
param
.
max_marks_text
);
err_stat
=
user
_area
;
err_stat
=
new
_area
;
kom_errno
=
KOM_MARK_LIMIT
;
return
FAILURE
;
}
...
...
@@ -324,34 +326,37 @@ do_set_user_area(Pers_no pers_no,
/* Unmark the previous user_area if it exists. */
if
(
pers_p
->
user_area
!=
0
&&
(
old_user_area
=
cached_get_text_stat
(
pers_p
->
user
_area
))
!=
NULL
)
old_area
=
pers_p
->
user_area
;
if
(
old_area
!=
0
&&
(
old_stat
=
cached_get_text_stat
(
old
_area
))
!=
NULL
)
{
if
(
old_
user_area
->
no_of_marks
>
0
)
if
(
old_
stat
->
no_of_marks
>
0
)
{
--
old_
user_area
->
no_of_marks
;
mark_text_as_changed
(
pers_p
->
user
_area
);
--
old_
stat
->
no_of_marks
;
mark_text_as_changed
(
old
_area
);
}
else
{
kom_log
(
"ERROR: set_user_area(%d, %lu): "
"Old user_area %lu unmarked.
\n
"
,
pers_no
,
(
unsigned
long
)
user
_area
,
(
unsigned
long
)
pers_p
->
user
_area
);
pers_no
,
(
unsigned
long
)
new
_area
,
(
unsigned
long
)
old
_area
);
}
}
/* Mark the new user_area */
if
(
user
_area
!=
0
)
if
(
new
_area
!=
0
)
{
++
new_
user_area
->
no_of_marks
;
mark_text_as_changed
(
user
_area
);
++
new_
stat
->
no_of_marks
;
mark_text_as_changed
(
new
_area
);
}
pers_p
->
user_area
=
user
_area
;
pers_p
->
user_area
=
new
_area
;
mark_person_as_changed
(
pers_no
);
if
(
old_area
!=
new_area
)
async_new_user_area
(
pers_no
,
old_area
,
new_area
);
return
OK
;
}
/*
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment