Bez tytułu

z k4be, 5 lata temu, napisane w C, wyświetlone 338 razy.
URL https://pastebin.k4be.pl/view/59ce4475 Udostępnij
Pobierz wklejkę lub Pokaż surowy tekst
  1. #include "unrealircd.h"
  2.  
  3. static ModuleInfo *showwebircMI = NULL;
  4.  
  5. ModuleHeader MOD_HEADER(m_showwebirc) = {
  6.         "m_showwebirc",
  7.         "$Id: v0.03 2018/12/14 k4be$",
  8.         "Add SWHOIS info for WEBIRC users",
  9.         "3.2-b8-1",
  10.         NULL
  11. };
  12.  
  13. static int showwebirc_userconnect(aClient *cptr);
  14.  
  15. MOD_INIT(m_showwebirc) {
  16.         showwebircMI = modinfo;
  17.         if(!HookAdd(modinfo->handle, HOOKTYPE_LOCAL_CONNECT, 0, showwebirc_userconnect)) return MOD_FAILED;
  18.         return MOD_SUCCESS;
  19. }
  20.  
  21. MOD_LOAD(m_showwebirc) {
  22.         aClient *acptr;
  23.         list_for_each_entry(acptr, &client_list, client_node){
  24.                 if(!IsPerson(acptr) || !MyClient(acptr)) continue;
  25.                 showwebirc_userconnect(acptr); // add info for all users upon module loading
  26.         }
  27.         return MOD_SUCCESS;
  28. }
  29.  
  30. MOD_UNLOAD(m_showwebirc) {
  31.         aClient *acptr;
  32.         list_for_each_entry(acptr, &client_list, client_node){
  33.                 if(!IsPerson(acptr) || !MyClient(acptr)) continue;
  34.                 swhois_delete(acptr, "webirc", "*", &me, NULL); // delete info when unloading
  35.         }
  36.         return MOD_SUCCESS;
  37. }
  38.  
  39. static int showwebirc_userconnect(aClient *cptr) {
  40.         ModDataInfo *moddata;
  41.         moddata = findmoddata_byname("webirc", MODDATATYPE_CLIENT);
  42.         if(moddata == NULL) return HOOK_CONTINUE;
  43.         if(moddata_client(cptr, moddata).l){
  44.                 swhois_add(cptr, "webirc", 0, "connecting via WEBIRC", &me, NULL);
  45.         }
  46.         return HOOK_CONTINUE;
  47. }
  48.  

odpowiedź "Bez tytułu"

Tutaj możesz odpowiedzieć na wklejkę z góry

captcha