Hooking sending IMs
Jump to navigation
Jump to search
void LLFloaterIMPanel::sendMsg() { LLWString text = mInputEditor->getWText(); LLWString::trim(text); if (!gAgent.isGodlike() && (mDialog == IM_NOTHING_SPECIAL) && mOtherParticipantUUID.isNull()) { llinfos << "Cannot send IM to everyone unless you're a god." << llendl; return; } if(text.length() > 0) { // Truncate and convert to UTF8 for transport std::string utf8_text = wstring_to_utf8str(text); utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); std::string name; gAgent.buildFullname(name);
PLUGIN_HOOK("LLFloaterIMPanel::sendMsg", &utf8_text, &mOtherParticipantUUID);
const LLRelationship* info = NULL; info = LLAvatarTracker::instance().getBuddyInfo(mOtherParticipantUUID); U8 offline = (!info || info->isOnline()) ? IM_ONLINE : IM_OFFLINE;
[...]
bool otr_impanel_hook(void *data1, void *data2) { fprintf(stderr, "otr_impanel_hook(%p, %p)\n", data1, data2); std::string *str=(std::string *)data1; // send OTR whitespace data tag str->append(OTRL_MESSAGE_TAG_BASE); str->append(OTRL_MESSAGE_TAG_V2); LLUUID *uuid=(LLUUID *) data2; char uuidbuf[40]; uuid->toString(uuidbuf); fprintf(stderr, " %s to %s", str->c_str(), uuidbuf); floater_printf("Sent OTR whitespace tag to %s\n", uuidbuf); return TRUE; }