Uses mbag_set_from_str now.
FossilOrigin-Name: 8166a26fbeeb23e88fbfa362d57968e621777588792a1e213d7d2bd237706b5b
This commit is contained in:
parent
b72262da91
commit
4b59244b65
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
|
|
||||||
|
/*
|
||||||
int static check_len(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
int static check_len(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
struct sockaddr *from)
|
struct sockaddr *from)
|
||||||
{
|
{
|
||||||
@ -27,12 +27,11 @@ int static check_len(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
|
int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
|
||||||
uint8_t * data, int len, struct sockaddr *from)
|
uint8_t * data, int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
|
||||||
const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->items,a->item_id,CW_ITEM_NONE);
|
const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->items,a->item_id,CW_ITEM_NONE);
|
||||||
|
|
||||||
if (!idef) {
|
if (!idef) {
|
||||||
@ -97,19 +96,25 @@ int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
|
|||||||
int cw_in_generic2(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
int cw_in_generic2(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
struct sockaddr *from)
|
struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->items,a->item_id,CW_ITEM_NONE);
|
||||||
|
|
||||||
if (!check_len(conn, a, data, len, from))
|
if (!idef) {
|
||||||
|
cw_log(LOG_ERR,"No itemdef found for %s",a->item_id);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mbag_t itemstore;
|
int rc = mbag_set_from_buf(conn->incomming,idef->type,a->item_id,data,len);
|
||||||
/// if (!a->target)
|
if (!rc){
|
||||||
itemstore = conn->incomming;
|
cw_log(LOG_ERR,
|
||||||
// else
|
"Can't handle item type %d in definition for incomming msg %d (%s) - %d, cw_in_generic.",
|
||||||
// itemstore = a->target(conn, a);
|
idef->type, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
|
||||||
return do_save(itemstore, conn, a, data, len, from);
|
// return do_save(itemstore, conn, a, data, len, from);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user