/* Handle message tags. * * See http://ircv3.atheme.org/specification/message-tags-3.2 */ static void handle_message_tags (server *serv, const char *tags_str, message_tags_data *tags_data) { char **tags; int i; /* FIXME We might want to avoid the allocation overhead here since * this might be called for every message from the server. */ tags = g_strsplit (tags_str, ";", 0); for (i=0; tags[i]; i++) { char *key = tags[i]; char *value = strchr (tags[i], '='); if (!value) continue; *value = '\0'; value++; if (serv->have_server_time && !strcmp (key, "time")) handle_message_tag_time (value, tags_data); } g_strfreev (tags); }
/* Handle message tags. * * See http://ircv3.atheme.org/specification/message-tags-3.2 */ static void handle_message_tags (const server &serv, const boost::string_ref & tags_str, message_tags_data &tags_data) { /* FIXME We might want to avoid the allocation overhead here since * this might be called for every message from the server. */ std::istringstream inbuf{ tags_str.to_string() }; for (std::string tag; std::getline(inbuf, tag, ';');) { auto value_loc = tag.find_first_of('='); if (value_loc == std::string::npos) continue; auto key = tag.substr(0, value_loc - 1); auto value = tag.substr(value_loc + 1); if (serv.have_server_time && key == "time") handle_message_tag_time (value, tags_data); } }