patch-discipline_c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. $OpenBSD: patch-discipline_c,v 1.1 2002/08/10 01:14:04 naddy Exp $
  2. --- discipline.c.orig Fri Aug 2 22:15:44 2002
  3. +++ discipline.c Wed Oct 17 13:19:27 2001
  4. @@ -0,0 +1,71 @@
  5. +/* discipline.c,v 1.3 2001/10/17 18:19:27 drscholl Exp
  6. + *
  7. + * Open Source Napster Server - Peer-To-Peer Indexing/Chat Daemon
  8. + * Copyright (C) 2001 drscholl@users.sourceforge.net
  9. + *
  10. + * This program is free software; you can redistribute it and/or modify
  11. + * it under the terms of the GNU General Public License as published by
  12. + * the Free Software Foundation; either version 2 of the License, or
  13. + * (at your option) any later version.
  14. + *
  15. + * This program is distributed in the hope that it will be useful,
  16. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. + * GNU General Public License for more details.
  19. + *
  20. + * You should have received a copy of the GNU General Public License
  21. + * along with this program; if not, write to the Free Software
  22. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. + */
  24. +
  25. +#include "opennap.h"
  26. +
  27. +#ifndef NULL
  28. +#define NULL ((void*)0)
  29. +#endif
  30. +
  31. +void
  32. +discipline_user (USER * user)
  33. +{
  34. + USERDB *db;
  35. +
  36. + if (gBlockWinMX > 1)
  37. + kill_user_internal (user->con, user, Server_Name, 0, "");
  38. + else
  39. + {
  40. + /* set the user to LEECH */
  41. +
  42. + if (ISUSER (user->con))
  43. + {
  44. + /* remove from local mods+ list */
  45. + if (user->level > LEVEL_USER)
  46. + Mods = list_delete (Mods, user->con);
  47. + }
  48. +
  49. + /* if the user is sharing any files, remove them now */
  50. + if (user->shared)
  51. + {
  52. + unshare_all_internal (user);
  53. + pass_message_args (NULL, MSG_CLIENT_UNSHARE_ALL, ":%s",
  54. + user->nick);
  55. + }
  56. +
  57. + user->level = LEVEL_LEECH;
  58. + if (user->cloaked)
  59. + {
  60. + notify_mods (CHANGELOG_MODE, "%s has decloaked", user->nick);
  61. + user->cloaked = 0;
  62. + }
  63. +
  64. + db = hash_lookup (User_Db, user->nick);
  65. + if (!db)
  66. + db = create_db (user); /* not registered, force it now */
  67. + db->level = LEVEL_LEECH;
  68. +
  69. + notify_mods (LEVELLOG_MODE, "Server %s set %s's level to Leech (0)",
  70. + Server_Name, user->nick);
  71. +
  72. + pass_message_args (NULL, MSG_CLIENT_SETUSERLEVEL, ":%s %s Leech",
  73. + Server_Name, user->nick);
  74. + }
  75. +}