1
0
Эх сурвалжийг харах

Fill Auth user cache in set_chanlist

Bryan Drewery 10 жил өмнө
parent
commit
8a905e6504
3 өөрчлөгдсөн 14 нэмэгдсэн , 4 устгасан
  1. 9 3
      src/auth.cc
  2. 1 1
      src/auth.h
  3. 4 0
      src/chanprog.cc

+ 9 - 3
src/auth.cc

@@ -1,4 +1,3 @@
-/* I hereby release this into the Public Domain - Bryan Drewery */
 /*
  * auth.c -- handles:
  *   auth system functions
@@ -130,9 +129,16 @@ static void auth_fill_users_block(const bd::String key, Auth* auth, void* param)
   auth->user = get_user_by_host(from);
 }
 
-void Auth::FillUsers()
+void Auth::FillUsers(const char *nick)
 {
-  ht_host.each(auth_fill_users_block);
+  if (nick == NULL) {
+    ht_host.each(auth_fill_users_block);
+  } else {
+    if (ht_nick.contains(nick)) {
+      Auth *auth = ht_nick[nick];
+      auth_fill_users_block(nick, auth, NULL);
+    }
+  }
 }
 
 

+ 1 - 1
src/auth.h

@@ -26,7 +26,7 @@ class Auth {
 
   static Auth *Find(const char * host);
   static void NullUsers(const char *nick = NULL);
-  static void FillUsers();
+  static void FillUsers(const char *nick = NULL);
   static void ExpireAuths();
   static void InitTimer();
   static void DeleteAll();

+ 4 - 0
src/chanprog.cc

@@ -206,6 +206,10 @@ void set_chanlist(const char *host, struct userrec *rec)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next)
       if (!rfc_casecmp(nick, m->nick) && !strcasecmp(uhost, m->userhost))
 	m->user = rec;
+
+  if (!conf.bot->hub) {
+    Auth::FillUsers(nick);
+  }
 }
 
 /* 0 marks all channels