openbsd-ports/audio/opennap/patches/patch-discipline_c
naddy c208dc5df3 Update to 0.44 with some patches from CVS.
Notable changes to the port:
- creates opennap user/group to run as
- tons of bugfixes, improved performance
- no longer hardcodes SYSCONFDIR to /etc/opennap

Submitted by Jolan Luff <jolan@pellaeon.com>.
2002-08-10 01:14:04 +00:00

76 lines
2.2 KiB
Plaintext

$OpenBSD: patch-discipline_c,v 1.1 2002/08/10 01:14:04 naddy Exp $
--- discipline.c.orig Fri Aug 2 22:15:44 2002
+++ discipline.c Wed Oct 17 13:19:27 2001
@@ -0,0 +1,71 @@
+/* discipline.c,v 1.3 2001/10/17 18:19:27 drscholl Exp
+ *
+ * Open Source Napster Server - Peer-To-Peer Indexing/Chat Daemon
+ * Copyright (C) 2001 drscholl@users.sourceforge.net
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "opennap.h"
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
+void
+discipline_user (USER * user)
+{
+ USERDB *db;
+
+ if (gBlockWinMX > 1)
+ kill_user_internal (user->con, user, Server_Name, 0, "");
+ else
+ {
+ /* set the user to LEECH */
+
+ if (ISUSER (user->con))
+ {
+ /* remove from local mods+ list */
+ if (user->level > LEVEL_USER)
+ Mods = list_delete (Mods, user->con);
+ }
+
+ /* if the user is sharing any files, remove them now */
+ if (user->shared)
+ {
+ unshare_all_internal (user);
+ pass_message_args (NULL, MSG_CLIENT_UNSHARE_ALL, ":%s",
+ user->nick);
+ }
+
+ user->level = LEVEL_LEECH;
+ if (user->cloaked)
+ {
+ notify_mods (CHANGELOG_MODE, "%s has decloaked", user->nick);
+ user->cloaked = 0;
+ }
+
+ db = hash_lookup (User_Db, user->nick);
+ if (!db)
+ db = create_db (user); /* not registered, force it now */
+ db->level = LEVEL_LEECH;
+
+ notify_mods (LEVELLOG_MODE, "Server %s set %s's level to Leech (0)",
+ Server_Name, user->nick);
+
+ pass_message_args (NULL, MSG_CLIENT_SETUSERLEVEL, ":%s %s Leech",
+ Server_Name, user->nick);
+ }
+}