static void recv(struct mwService *service, struct mwChannel *chan, guint16 type, struct mwOpaque *data) { // `service` unused (void)service; struct mwPlace *place; struct mwGetBuffer *b; int res = 0; place = mwChannel_getServiceData(chan); g_return_if_fail(place != NULL); b = mwGetBuffer_wrap(data); switch(type) { case msg_in_JOIN_RESPONSE: res = recv_JOIN_RESPONSE(place, b); break; case msg_in_INFO: res = recv_INFO(place, b); break; case msg_in_MESSAGE: res = recv_MESSAGE(place, b); break; case msg_in_SECTION: res = recv_SECTION(place, b); break; case msg_in_UNKNOWNa: res = recv_UNKNOWNa(place, b); break; default: mw_mailme_opaque(data, "Received unknown message type 0x%x on place %s", type, NSTR(place->name)); } if(res) { mw_mailme_opaque(data, "Troubling parsing message type 0x0%x on place %s", type, NSTR(place->name)); } mwGetBuffer_free(b); }
static void recv_channelAccept(struct mwServiceFileTransfer *srvc, struct mwChannel *chan, struct mwMsgChannelAccept *msg) { struct mwFileTransferHandler *handler; struct mwFileTransfer *ft; g_return_if_fail(srvc->handler != NULL); handler = srvc->handler; ft = mwChannel_getServiceData(chan); g_return_if_fail(ft != NULL); ft_state(ft, mwFileTransfer_OPEN); if(handler->ft_opened) handler->ft_opened(ft); }
static void recv_channelAccept(struct mwService *service, struct mwChannel *chan, struct mwMsgChannelAccept *msg) { // `msg` unused (void)msg; struct mwServicePlace *srvc; struct mwPlace *place; int res; srvc = (struct mwServicePlace *) service; g_return_if_fail(srvc != NULL); place = mwChannel_getServiceData(chan); g_return_if_fail(place != NULL); res = send_JOIN_PLACE(place); }
static void recv_channelDestroy(struct mwService *service, struct mwChannel *chan, struct mwMsgChannelDestroy *msg) { struct mwServicePlace *srvc; struct mwPlace *place; srvc = (struct mwServicePlace *) service; g_return_if_fail(srvc != NULL); place = mwChannel_getServiceData(chan); g_return_if_fail(place != NULL); place_state(place, mwPlace_ERROR); place->channel = NULL; if(srvc->handler && srvc->handler->closed) srvc->handler->closed(place, msg->reason); mwPlace_destroy(place, msg->reason); }
static void recv(struct mwService *srvc, struct mwChannel *chan, guint16 type, struct mwOpaque *data) { struct mwFileTransfer *ft; ft = mwChannel_getServiceData(chan); g_return_if_fail(ft != NULL); switch(type) { case msg_TRANSFER: recv_TRANSFER(ft, data); break; case msg_RECEIVED: recv_RECEIVED(ft, data); break; default: mw_mailme_opaque(data, "unknown message in ft service: 0x%04x", type); } }
static void recv_channelDestroy(struct mwServiceFileTransfer *srvc, struct mwChannel *chan, struct mwMsgChannelDestroy *msg) { struct mwFileTransferHandler *handler; struct mwFileTransfer *ft; guint32 code; code = msg->reason; g_return_if_fail(srvc->handler != NULL); handler = srvc->handler; ft = mwChannel_getServiceData(chan); g_return_if_fail(ft != NULL); ft->channel = NULL; if(! mwFileTransfer_isDone(ft)) ft_state(ft, mwFileTransfer_CANCEL_REMOTE); mwFileTransfer_close(ft, code); }