mirror of
git://git.psyced.org/git/psyclpc
synced 2024-08-15 03:20:16 +00:00
new connection_peek() callback for supporting both PSYC syntaxes
This commit is contained in:
parent
f33e0048f0
commit
abe16cd13f
5 changed files with 28 additions and 17 deletions
9
TODO
9
TODO
|
@ -35,8 +35,10 @@ MISC IDEAS
|
|||
? USE_RESETS time_of_ref USE_CLEANUP load_id USE_WIZLIST USE_EXPAT USE_EVALUATION_COST
|
||||
- disabling with_input_escape does not disable the input_escape handling source code
|
||||
+ teach ldmud to exec() so that, together with --args, we can run it as a
|
||||
regular daemon without kludgy shellscripts
|
||||
(http://mantis.bearnip.com/view.php?id=55)
|
||||
regular daemon without kludgy shellscripts. zesstra suggests we could have
|
||||
a C wrapper process instead of a shell script. and what about init, can't
|
||||
we monitor and restart the driver from init?
|
||||
(http://ldmud.eu/mantis/view.php?id=55)
|
||||
+ provide a query_shutdown_progress() efun to inform about progress
|
||||
and the intention to either shutdown or restart. maybe even a reason?
|
||||
+ optimize f_lower_case by adding an 'already lowercase' flag to the
|
||||
|
@ -70,7 +72,6 @@ USE_RESTORED_OBJECTS
|
|||
(members & routes of places)
|
||||
|
||||
NETWORKING
|
||||
- http://mantis.bearnip.com/view.php?id=442 (MAX_TEXT)
|
||||
- add_message("%s", "\n*** Text lost in transmission ***\n");
|
||||
should be passed to master instead.
|
||||
+ _length: <eL> somebody implement a new input_to(#'get_data, length).
|
||||
|
@ -97,4 +98,4 @@ comm.c:3055: if(ip->tls_inited)
|
|||
socket_write() and also before optional compression.
|
||||
+ socket charset is stored in interactive_s and given by an efun
|
||||
+ charset is compared to SYSTEM_CHARSET which is given by config.h/configure
|
||||
- http://mantis.bearnip.com/view.php?id=117
|
||||
- http://ldmud.eu/mantis/view.php?id=117 ... try //TRANSLIT again?
|
||||
|
|
21
src/comm.c
21
src/comm.c
|
@ -3189,9 +3189,12 @@ get_message (char *buff, size_t *len)
|
|||
|
||||
// If we're receiving the first bytes call a peek function
|
||||
// which could enable_binary depending on the content of the buffer
|
||||
// We only need this until we give up the old PSYC syntax.
|
||||
if (!ip->connected) {
|
||||
put_c_n_string(++inter_sp, ip->text, l);
|
||||
sapply(new_tabled("peek"), ip->ob, 1);
|
||||
// we shouldn't look up the string in the string table
|
||||
// for each connection.. but it's just temporary code
|
||||
sapply(new_tabled("connection_peek"), ip->ob, 1);
|
||||
ip->connected = MY_TRUE;
|
||||
}
|
||||
|
||||
|
@ -3199,11 +3202,17 @@ get_message (char *buff, size_t *len)
|
|||
* binary data streams, by fippo 2008
|
||||
*/
|
||||
if (ip->is_binary) {
|
||||
memcpy(buff, ip->text, l);
|
||||
*len = (size_t) l;
|
||||
/* webdav attack makes these lines crash..
|
||||
* still collecting evidence..
|
||||
*/
|
||||
/* webdav attack caused something near memcpy to crash..
|
||||
* buff isn't larger than ip->text but
|
||||
* maybe l is larger than buff?
|
||||
*/
|
||||
if (l > MAX_TEXT) {
|
||||
debug_message("%s Incoming socket overflow. Dropped %d bytes.\n"
|
||||
, time_stamp(), l);
|
||||
} else {
|
||||
memcpy(buff, ip->text, l);
|
||||
*len = (size_t) l;
|
||||
}
|
||||
FD_CLR(ip->socket, &readfds);
|
||||
command_giver = ip->ob;
|
||||
return MY_TRUE;
|
||||
|
|
|
@ -2344,7 +2344,7 @@ eval_arg (int eOption, const char * pValue)
|
|||
while (*cp != ' ' && *cp != '\0') cp++;
|
||||
|
||||
/* Ensure termination */
|
||||
*cp++ = '\0';
|
||||
if (*cp != '\0') *cp++ = '\0';
|
||||
|
||||
/* Skip trailing spaces */
|
||||
while (*cp == ' ') cp++;
|
||||
|
|
|
@ -135,9 +135,9 @@ fill_header_from_mapping (svalue_t *key, svalue_t *val, void *extra) {
|
|||
break;
|
||||
}
|
||||
|
||||
f_to_string(&vsp);
|
||||
f_to_string(&vsp); // generates an mstring
|
||||
value = get_txt(vsp.u.str);
|
||||
valuelen = strlen(value);
|
||||
valuelen = mstrsize(vsp.u.str);
|
||||
break;
|
||||
|
||||
case T_POINTER:
|
||||
|
@ -167,7 +167,7 @@ fill_header_from_mapping (svalue_t *key, svalue_t *val, void *extra) {
|
|||
}
|
||||
|
||||
f_to_string(&vsp);
|
||||
elems[i] = (psycString){strlen(get_txt(vsp.u.str)), get_txt(vsp.u.str)};
|
||||
elems[i] = (psycString){mstrsize(vsp.u.str), get_txt(vsp.u.str)};
|
||||
break;
|
||||
default:
|
||||
errorf("fill_header_from_mapping: list value type %d not supported\n", lval->type);
|
||||
|
@ -223,7 +223,7 @@ f_psyc_render(svalue_t *sp) {
|
|||
headers[i].lines = 0;
|
||||
headers[i].modifiers = malloc(sizeof(psycModifier) * MAP_SIZE(v->item[i].u.map));
|
||||
if (!headers[i].modifiers) {
|
||||
errorf("Out of memory in psyc_render for entity header.\n");
|
||||
errorf("Out of memory in psyc_render for modifier table.\n");
|
||||
return sp; // not reached
|
||||
}
|
||||
|
||||
|
@ -235,6 +235,7 @@ f_psyc_render(svalue_t *sp) {
|
|||
PSYC_MODIFIER_CHECK_LENGTH
|
||||
});
|
||||
}
|
||||
// else ... ignoring possibly invalid args
|
||||
}
|
||||
} else {
|
||||
errorf("Wrong number of elements (%" PRIdMPINT ") "
|
||||
|
@ -470,7 +471,7 @@ f_psyc_parse (svalue_t *sp) {
|
|||
error = PSYC_PARSE_ERROR_TIME;
|
||||
break;
|
||||
case PSYC_TYPE_AMOUNT: // number
|
||||
if (psyc_parseNumber(&value, &t))
|
||||
if (psyc_parseNumber(&value, (ssize_t *) &t))
|
||||
put_number(sv, t);
|
||||
else
|
||||
error = PSYC_PARSE_ERROR_AMOUNT;
|
||||
|
|
|
@ -17,7 +17,7 @@ version_longtype="stable"
|
|||
# A timestamp, to be used by bumpversion and other scripts.
|
||||
# It can be used, for example, to 'touch' this file on every build, thus
|
||||
# forcing revision control systems to add it on every checkin automatically.
|
||||
version_stamp="Fri May 20 10:38:24 CEST 2011"
|
||||
version_stamp="Mon May 23 12:10:14 CEST 2011"
|
||||
|
||||
# Okay, LDMUD is using 3.x.x so to avoid conflicts let's just use 4.x.x
|
||||
version_major=4
|
||||
|
|
Loading…
Reference in a new issue