multiple_im.mod
1.2a
Lets you Instant Message multiple users at once.
Specify usernames of all you want to IM, seperated by commas.
ex: admin, mymom, DaveB, cv_xxl
The mod will send the IM to everyone, but each person will only see that it was sent to them.
*NOTE: If you enter invalid usernames or names of users currently ignoring you, these names will be displayed after all valid users have been messaged.
DaveB
http://www.davesworldzone.com
Sources/InstantMessage.pl
sub IMPost2
{
if($username eq 'Guest') { &fatal_error($txt{'147'}); }
my( @imconfig, @ignore, $igname, $messageid, $subject, $message, @recipient );
##############################
## DaveB's Multiple IM Hack ##
##############################
#This split usernames in "to" field by commas and adds them to the array @multiple
@multiple = split(/,/, $FORM{'to'});
#for each array value ($db) in @multiple, run through this loop.
foreach $db(@multiple) {
chomp $db;
$restart = 0;
# Check Ignore-List
if (-e("$memberdir/$FORM{'to'}.imconfig")) {
fopen(FILE, "$memberdir/$FORM{'to'}.imconfig");
# Check Ignore-List
if (-e("$memberdir/$db.imconfig")) {
fopen(FILE, "$memberdir/$db.imconfig");
if ($igname eq $username) { &fatal_error($txt{'560'}); }
#adds ignored user's name to array which error list will be built from later
if ($igname eq $username) { push(@nouser, $db);
$restart = 1;
}
# Create unique Message ID = Time & ProccessID
if ($restart != 1) {
$FORM{'to'} =~ s/\A\s+//;
$FORM{'to'} =~ s/\s+\Z//;
$FORM{'to'} =~ s/[^0-9A-Za-z#%+,-\.@^_]//g;
$db =~ s/\A\s+//;
$db =~ s/\s+\Z//;
$db =~ s/[^0-9A-Za-z#%+,-\.@^_]//g;
if (!(-e("$memberdir/$FORM{'to'}.dat"))) { &fatal_error($txt{'149'}); }
if (!(-e("$memberdir/$db.dat"))) {
#adds invalid user's name to array which error list will be built from later
push(@nouser, $db);
$restart = 2;
}
if ($restart != 2) {
print FILE "$FORM{'to'}|$subject|$date|$message|$messageid|$ENV{'REMOTE_ADDR'}\n";
print FILE "$db|$subject|$date|$message|$messageid|$ENV{'REMOTE_ADDR'}\n";
fopen(FILE, ">>$memberdir/$FORM{'to'}.msg");
fopen(FILE, ">>$memberdir/$db.msg");
fopen(FILE, "$memberdir/$FORM{'to'}.dat");
fopen(FILE, "$memberdir/$db.dat");
$yySetLocation = qq~$cgi&action=im~;
&redirectexit;
} #end restart 2
} #end restart 1
} #end foreach loop
#if there were invalid usernames in the recipient list, these names are listed after all valid users have been IMed
if (@nouser) {
$badusers = join(", ", @nouser);
&fatal_error("$badusers
\nThese users could not be messaged. The usernames are either invalid or have you on their ignore list");
}