Skip to content

Commit bc91f8e

Browse files
author
drscholl
committed
re-added the form_message() calls for public() and emote()
1 parent 24c9b4d commit bc91f8e

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

FAQ

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Frequently Asked Questions (FAQ) about opennap
22
==============================================
3-
Last updated on April 26, 2000.
3+
Last updated on May 30, 2000.
44

55
Q: What is opennap?
66
A: opennap is an open source server which speaks the napster protocol
@@ -52,3 +52,6 @@ A: If you have memory to spare, you can increase the value of
5252
client_queue_length, or alternatively decrease the number of files
5353
returned by a browse command (max_browse_result) so that it does not cross
5454
the 100kbytes default limit.
55+
56+
Q: How do I get my server listed on napigator.com?
57+
A: Go to www.napigator.com and look for the section on adding servers.

config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static struct config Vars[] = {
6868
{"max_channel_length", VAR_TYPE_INT, UL & Max_Channel_Length, 32},
6969
{"max_ignore",VAR_TYPE_INT,UL&Max_Ignore,32},
7070
{"max_hotlist",VAR_TYPE_INT,UL&Max_Hotlist,32},
71-
{"max_topic",VAR_TYPE_INT,UL&Max_Topic,32},
71+
{"max_topic",VAR_TYPE_INT,UL&Max_Topic,64},
7272
{"max_client_string",VAR_TYPE_INT,UL&Max_Client_String,32},
7373
};
7474

list_users.c

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ HANDLER (list_users)
1919
(void) len;
2020
ASSERT (validate_connection (con));
2121
CHECK_USER_CLASS ("list_users");
22-
if (invalid_channel (pkt))
23-
{
24-
invalid_channel_msg (con);
25-
return;
26-
}
2722
chan = hash_lookup (Channels, pkt);
2823
if (!chan)
2924
{

part.c

-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ HANDLER (part)
3030
log ("part(): server message is missing channel name");
3131
return;
3232
}
33-
if (invalid_channel (pkt))
34-
{
35-
invalid_channel_msg (con);
36-
return;
37-
}
3833
/* find the requested channel in the user's list */
3934
if (!(chan = find_channel (user->channels, pkt)))
4035
{

public.c

+28-21
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
#include "opennap.h"
1313
#include "debug.h"
1414

15+
/* static buffer for use by public/emote. these get called a lot so speed
16+
things up by keeping it around. there is no chance of either of these
17+
being called from eachother or used elsewhere so this is safe */
18+
static char PublicBuf[2048];
19+
1520
/* [ :<sender> ] <channel> <text> */
1621
/* public message to a channel */
1722
HANDLER (public)
@@ -23,7 +28,6 @@ HANDLER (public)
2328
CHANUSER *chanUser;
2429

2530
(void) tag;
26-
(void) len;
2731
ASSERT (validate_connection (con));
2832
/* save the starting position of the pkt */
2933
ptr = pkt;
@@ -54,11 +58,6 @@ HANDLER (public)
5458
unparsable (con);
5559
return;
5660
}
57-
if (invalid_channel (pkt))
58-
{
59-
invalid_channel_msg (con);
60-
return;
61-
}
6261

6362
/* find the channel this message is going to. look the user's joined
6463
channels since this should be faster than lookup in the hash table */
@@ -73,18 +72,25 @@ HANDLER (public)
7372
/* relay this message to peer servers */
7473
pass_message_args (con, tag, ":%s %s %s", sender->nick, chan->name, pkt);
7574

75+
/* the majority of the users in the channel will see this message, so
76+
form it one time */
77+
len = form_message (PublicBuf, sizeof(PublicBuf), MSG_SERVER_PUBLIC,
78+
"%s %s %s", chan->name,
79+
sender->cloaked ? "Operator" : sender->nick,
80+
pkt);
81+
7682
/* send this message to everyone in the channel */
7783
for (list = chan->users; list; list = list->next)
7884
{
7985
chanUser = list->data;
8086
ASSERT (chanUser->magic == MAGIC_CHANUSER);
8187
if (ISUSER (chanUser->user->con))
8288
{
83-
send_cmd (chanUser->user->con, MSG_SERVER_PUBLIC, "%s %s %s",
84-
chan->name, (!sender->cloaked
85-
|| chanUser->user->level >
86-
LEVEL_USER) ? sender->nick : "Operator",
87-
pkt);
89+
if(sender->cloaked && chanUser->user->level > LEVEL_USER)
90+
send_cmd(chanUser->user->con,MSG_SERVER_PUBLIC,"%s %s %s",
91+
chan->name, sender->nick, pkt);
92+
else
93+
queue_data(chanUser->user->con,PublicBuf,len);
8894
}
8995
}
9096
}
@@ -99,7 +105,6 @@ HANDLER (emote)
99105
LIST *list;
100106

101107
(void) tag;
102-
(void) len;
103108
ASSERT (validate_connection (con));
104109
ptr = pkt; /* save initial location */
105110
if (pop_user (con, &pkt, &user) != 0)
@@ -126,11 +131,6 @@ HANDLER (emote)
126131
unparsable (con);
127132
return;
128133
}
129-
if (invalid_channel (av[0]))
130-
{
131-
invalid_channel_msg (con);
132-
return;
133-
}
134134

135135
/* find the channel this message is going to. look the user's joined
136136
channels since this should be faster than lookup in the hash table */
@@ -146,17 +146,24 @@ HANDLER (emote)
146146
pass_message_args (con, tag, ":%s %s \"%s\"", user->nick, chan->name,
147147
av[1]);
148148

149+
/* majority of the users see the same message, so form it once */
150+
len=form_message(PublicBuf,sizeof(PublicBuf),tag,"%s %s \"%s\"",
151+
chan->name,
152+
user->cloaked ? "Operator" : user->nick,
153+
av[1]);
154+
149155
/* send this message to all channel members */
150156
for (list = chan->users; list; list = list->next)
151157
{
152158
chanUser = list->data;
153159
ASSERT (chanUser->magic == MAGIC_CHANUSER);
154160
if (ISUSER (chanUser->user->con))
155161
{
156-
send_cmd (chanUser->user->con, tag, "%s %s \"%s\"", chan->name,
157-
(!user->cloaked
158-
|| chanUser->user->level >
159-
LEVEL_MODERATOR) ? user->nick : "Operator", av[1]);
162+
if(user->cloaked && chanUser->user->level > LEVEL_USER)
163+
send_cmd (chanUser->user->con, tag, "%s %s \"%s\"",
164+
chan->name, user->nick, av[1]);
165+
else
166+
queue_data(chanUser->user->con,PublicBuf,len);
160167
}
161168
}
162169
}

0 commit comments

Comments
 (0)