pidgin/pidgin

Use the leaky bucket algorithm to rate limit irc messages.
release-2.x.y
2022-04-23, Gary Kramlich
c49dcf00bee6
file isExecutable
Use the leaky bucket algorithm to rate limit irc messages.

The default values were suggested by an operator of libera.

We don't rate limit the login process, nor parts and quits. However, if you
paste a bunch of text and then part a channel, you will be spammed with a
bunch of "no such nick/channel" error dialogs. I tried to work around this,
but the alternative just makes irc unresponsive until all the pasted messages
are sent. That said, other messages are still delayed while these errors
dialogs are slowly popping up.

Testing Done:
Lots

Bugs closed: PIDGIN-11089

Reviewed at https://reviews.imfreedom.org/r/524/
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Usage: `basename "$0"` PurpleFoo..."
echo
echo "This script searches the *current working directory* and replaces casts"
echo "with GObject-style type checking and casting macros."
echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
exit 0
fi
for struct in $* ; do
cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"`
for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c --exclude=purple-client-bindings.c` ; do
sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|g" $file
sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|g" $file
done
done