static int recv_SECTION_PEER_SET_ATTR(struct mwPlace *place, struct mwGetBuffer *b) { struct mwServicePlace *srvc; int ret = 0; guint32 id, attr; struct mwOpaque o = {0,0}; struct place_member *pm; srvc = place->service; guint32_get(b, &id); mwGetBuffer_advance(b, 4); mwOpaque_get(b, &o); mwGetBuffer_advance(b, 4); guint32_get(b, &attr); pm = GET_MEMBER(place, id); g_return_val_if_fail(pm != NULL, -1); if(srvc->handler && srvc->handler->peerSetAttribute) srvc->handler->peerSetAttribute(place, &pm->idb, attr, &o); mwOpaque_clear(&o); return ret; }
static int recv_SECTION_PART(struct mwPlace *place, struct mwGetBuffer *b) { /* look up user in place remove user from place trigger event */ struct mwServicePlace *srvc; guint32 pm_id; struct place_member *pm; srvc = place->service; guint32_get(b, &pm_id); pm = GET_MEMBER(place, pm_id); /* SECTION_PEER_PART may have been called already */ if(! pm) return 0; if(srvc->handler && srvc->handler->peerParted) srvc->handler->peerParted(place, &pm->idb); REMOVE_MEMBER(place, pm); return 0; }
static int recv_SECTION_PEER_PART(struct mwPlace *place, struct mwGetBuffer *b) { struct mwServicePlace *srvc; int ret = 0; guint32 section, id; struct place_member *pm; srvc = place->service; guint32_get(b, §ion); g_return_val_if_fail(section == place->section, 0); guint32_get(b, &id); pm = GET_MEMBER(place, id); /* SECTION_PART may have been called already */ if(! pm) return 0; if(srvc->handler && srvc->handler->peerParted) srvc->handler->peerParted(place, &pm->idb); REMOVE_MEMBER(place, pm); return ret; }
static int recv_SECTION_PEER_CLEAR_ATTR(struct mwPlace *place, struct mwGetBuffer *b) { struct mwServicePlace *srvc; int ret = 0; guint32 id, attr; struct place_member *pm; srvc = place->service; guint32_get(b, &id); guint32_get(b, &attr); pm = GET_MEMBER(place, id); g_return_val_if_fail(pm != NULL, -1); if(srvc->handler && srvc->handler->peerUnsetAttribute) srvc->handler->peerUnsetAttribute(place, &pm->idb, attr); return ret; }
static int recv_MESSAGE(struct mwPlace *place, struct mwGetBuffer *b) { struct mwServicePlace *srvc; guint32 pm_id; guint32 unkn_a, unkn_b, ign; struct place_member *pm; char *msg = NULL; int ret = 0; srvc = place->service; /* no messages before becoming fully open, please */ g_return_val_if_fail(place->state == mwPlace_OPEN, -1); /* regarding unkn_a and unkn_b: they're probably a section indicator and a message count, I'm just not sure which is which. Until this implementation supports place sections in the API, it really doesn't matter. */ guint32_get(b, &pm_id); pm = GET_MEMBER(place, pm_id); g_return_val_if_fail(pm != NULL, -1); guint32_get(b, &unkn_a); guint32_get(b, &ign); /* actually an opaque length */ if(! ign) return ret; guint32_get(b, &unkn_b); mwString_get(b, &msg); if(srvc->handler && srvc->handler->message) srvc->handler->message(place, &pm->idb, msg); g_free(msg); return ret; }
EStatus StationGetFreeBuffer(const Station* pThis, int* pSize) { GET_MEMBER(pSize, pThis, freeBufferSize); }
EStatus StationGetVelocity(const Station* pThis, Velocity* pVelocity) { GET_MEMBER(pVelocity, pThis, velocity); }
EStatus StationGetLocation(const Station* pThis, Location* pLocation) { GET_MEMBER(pLocation, pThis, curLocation); }
EStatus StationGetId(const Station* pThis, StationId* pId) { GET_MEMBER(pId, pThis, id); }