CommandServer::Builder::Builder(TreeServer* server) : CmdBuilder(server->GetParent()->GetID(), "SERVER") { push(server->GetName()); push_raw(" * 0 "); push_raw(server->GetID()); push_last(server->GetDesc()); }
/** Add a mode to the message */ void push_mode(const char modeletter, const std::string& mask) { push_raw(modeletter); params.push_back(' '); params.append(mask); modes++; }
CommandFJoin::Builder::Builder(Channel* chan, TreeServer* source) : CmdBuilder(source->GetID(), "FJOIN") { push(chan->name).push_int(chan->age).push_raw(" +"); pos = str().size(); push_raw(chan->ChanModes(true)).push_raw(" :"); }
/** * lw6sys_hexa_serializer_push_str * * @sys_context: global system context * @hexa_serializer: an hexa serializer object * @value: value to push * * Pushes a string in the serializer object. Note that the string * is not directly copied in the serializer, instead all its characters * are converted to their ASCII equivalent, then appended. * * Return value: 1 if success, 0 if failure */ int lw6sys_hexa_serializer_push_str (lw6sys_context_t * sys_context, lw6sys_hexa_serializer_t * hexa_serializer, const char *value) { int ret = 0; ret = push_raw (sys_context, hexa_serializer, (u_int8_t *) value, strlen (value) + 1); return ret; }
/** * lw6sys_hexa_serializer_push_int8 * * @sys_context: global system context * @hexa_serializer: an hexa serializer object * @value: value to push * * Pushes an 8 bit integer in the serializer object. * * Return value: 1 if success, 0 if failure */ int lw6sys_hexa_serializer_push_int8 (lw6sys_context_t * sys_context, lw6sys_hexa_serializer_t * hexa_serializer, int8_t value) { int ret = 0; ret = push_raw (sys_context, hexa_serializer, (u_int8_t *) & value, 1); return ret; }
/** * lw6sys_hexa_serializer_push_int16 * * @sys_context: global system context * @hexa_serializer: an hexa serializer object * @value: value to push * * Pushes a 16 bit integer in the serializer object. * * Return value: 1 if success, 0 if failure */ int lw6sys_hexa_serializer_push_int16 (lw6sys_context_t * sys_context, lw6sys_hexa_serializer_t * hexa_serializer, int16_t value) { int ret = 0; u_int8_t buffer[sizeof (int16_t)]; lw6sys_serialize_int16 (sys_context, buffer, value); ret = push_raw (sys_context, hexa_serializer, buffer, sizeof (int16_t)); return ret; }
/** Prepare the message for sending, next mode can only be added after clear() */ const std::string& finalize() { return push_raw(params); }
void CommandFJoin::Builder::clear() { content.erase(pos); push_raw(" :"); }
void CommandFJoin::Builder::add(Membership* memb, std::string::const_iterator mbegin, std::string::const_iterator mend) { push_raw(mbegin, mend).push_raw(',').push_raw(memb->user->uuid); push_raw(':').push_raw_int(memb->id); push_raw(' '); }