diff options
author | Sadie Powell <sadie@witchery.services> | 2025-04-10 13:06:37 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-04-15 19:30:59 +0100 |
commit | a883b616a1360ba74254661cbd39280404d1753a (patch) | |
tree | b58c7913ea6a2c3a78b4edb79cd64b465e101b99 /src/users.cpp | |
parent | b421ba258e4332d512edab35ddc3e6e41e297381 (diff) |
Automatically line wrap messages sent by services.
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/users.cpp b/src/users.cpp index 8f8e9570d..33e840160 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -21,6 +21,7 @@ #include "opertype.h" #include "language.h" #include "sockets.h" +#include "textproc.h" #include "uplink.h" user_map UserListByNick, UserListByUID; @@ -347,15 +348,13 @@ namespace { void SendMessageInternal(BotInfo *source, User *target, const Anope::string &msg, const Anope::map<Anope::string> &tags) { - const char *translated_message = Language::Translate(target, msg.c_str()); - - sepstream sep(translated_message, '\n', true); - for (Anope::string tok; sep.GetToken(tok);) + TextSplitter ts(Language::Translate(target, msg.c_str())); + for (Anope::string line; ts.GetLine(line); ) { if (target->ShouldPrivmsg()) - IRCD->SendPrivmsg(source, target->GetUID(), tok, tags); + IRCD->SendPrivmsg(source, target->GetUID(), line, tags); else - IRCD->SendNotice(source, target->GetUID(), tok, tags); + IRCD->SendNotice(source, target->GetUID(), line, tags); } } } |