0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 06:28:55 +02:00

ircd: Move reconstruct_parv() from parse.cc to stringops.cc

This commit is contained in:
Jason Volk 2016-09-02 17:10:51 -07:00
parent 670990a215
commit 3e1bf93a22
4 changed files with 16 additions and 16 deletions

View file

@ -37,7 +37,6 @@ extern void handle_encap(struct MsgBuf *, client::client *, client::client *,
const char *, int, const char *parv[]);
extern void mod_add_cmd(struct Message *msg);
extern void mod_del_cmd(struct Message *msg);
extern char *reconstruct_parv(int parc, const char *parv[]);
extern std::map<std::string, std::shared_ptr<alias_entry>, case_insensitive_less> alias_dict;
extern std::map<std::string, Message *, case_insensitive_less> cmd_dict;

View file

@ -40,6 +40,7 @@ bool startswith(const std::string &str, const std::string &val);
char *strip_colour(char *string);
char *strip_unprintable(char *string);
char *reconstruct_parv(int parc, const char **parv);
} // namespace ircd

View file

@ -54,21 +54,6 @@ static int handle_command(struct Message *, struct MsgBuf *, client::client *, c
static char buffer[1024];
/* turn a string into a parc/parv pair */
char *reconstruct_parv(int parc, const char *parv[])
{
static char tmpbuf[BUFSIZE]; int i;
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++)
{
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
return tmpbuf;
}
/* parse()
*
* given a raw buffer, parses it and generates parv and parc

View file

@ -134,3 +134,18 @@ ircd::strip_unprintable(char *string)
return string;
}
char *
ircd::reconstruct_parv(int parc, const char *parv[])
{
static char tmpbuf[BUFSIZE];
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (int i = 1; i < parc; i++)
{
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
return tmpbuf;
}