Skip to content

Commit 8f0f0c4

Browse files
committed
Added suppor for DCC CHAT requests.
1 parent ff062a9 commit 8f0f0c4

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

notifications.pl

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ sub message_public {
8181
# Prepare the message body:
8282
(my $body = $message) =~ s/^$user[\s:,]\s*//;
8383

84-
# Display the notification:
84+
# Notify the user about the incoming public message:
8585
display_notification("$nick/$tag on $target:", $body);
8686
}
8787

@@ -104,7 +104,7 @@ sub message_private {
104104
# Get the server's tag:
105105
my $tag = $server->{tag};
106106

107-
# Display the notification:
107+
# Notify the user about the incoming private message:
108108
display_notification("$nick/$tag:", $message);
109109
}
110110

@@ -124,21 +124,28 @@ sub dcc_request {
124124
return unless ($window);
125125
}
126126

127-
# Ignore DCC requests other than GET:
128-
return unless ($dcc->{type} eq 'GET');
127+
# Get the request type:
128+
my $type = $dcc->{type};
129129

130130
# Get the sender's nick:
131131
my $nick = $dcc->{nick};
132132

133133
# Get the server's tag:
134134
my $tag = $dcc->{server}->{tag};
135135

136-
# Get the file name and size:
137-
my $name = $dcc->{arg};
138-
my $size = $dcc->{size};
136+
# Check the request type:
137+
if ($type eq 'GET') {
138+
# Get the file name and size:
139+
my $name = $dcc->{arg};
140+
my $size = $dcc->{size};
139141

140-
# Display the notification:
141-
display_notification("$nick/$tag offers a file:", "$name ($size B)");
142+
# Notify the user about the incoming SEND request:
143+
display_notification("$nick/$tag offers a file:", "$name ($size B)");
144+
}
145+
elsif ($type eq 'CHAT') {
146+
# Notify the user about the incoming CHAT request:
147+
display_notification("$nick/$tag offers a DCC chat.", "");
148+
}
142149
}
143150

144151
# Register configuration options:

0 commit comments

Comments
 (0)