/* irc_inline() - 1 single line received from serv */ void server::p_inline (const boost::string_ref& text) { session *sess; char *type; char *word[PDIWORDS+1]; char *word_eol[PDIWORDS+1]; message_tags_data tags_data = message_tags_data(); std::string pdibuf(text.size(), '\0'); sess = this->front_session; /* Python relies on this */ word[PDIWORDS] = NULL; word_eol[PDIWORDS] = NULL; std::string buf; if (text.starts_with('@')) { auto sep = text.find_first_of(' '); if (sep == boost::string_ref::npos) return; /* skip the '@' */ auto tags = text.substr(1, sep - 1); buf = text.substr(sep + 1).to_string(); handle_message_tags(*this, tags, tags_data); } else { buf = text.to_string(); } url_check_line(buf.data(), buf.size()); /* split line into words and words_to_end_of_line */ process_data_init (&pdibuf[0], &buf[0], word, word_eol, false, false); if (buf[0] == ':') { /* find a context for this message */ if (this->is_channel_name (word[3])) { auto tmp = find_channel (word[3]); if (tmp) sess = &(*tmp); } /* for server messages, the 2nd word is the "message type" */ type = word[2]; word[0] = type; word_eol[1] = &buf[0]; /* keep the ":" for plugins */ if (plugin_emit_server(sess, type, word, word_eol, tags_data.timestamp)) { return; } word[1]++; word_eol[1] = &buf[1]; /* but not for HexChat internally */ } else { word[0] = type = word[1]; if (plugin_emit_server(sess, type, word, word_eol, tags_data.timestamp)) { return; } } if (buf[0] != ':') { process_named_servermsg (sess, &buf[0], word[0], word_eol, &tags_data); return; } /* see if the second word is a numeric */ std::locale locale; if (std::isdigit (word[2][0], locale)) { char* t = word_eol[4]; if (*t == ':') t++; process_numeric (sess, atoi (word[2]), word, word_eol, t, &tags_data); } else { process_named_msg (sess, type, word, word_eol, &tags_data); } }