add packages_10.03.2 in preparation for the 10.03.2 interim release
[10.03/packages.git] / net / uhub / patches / 100-user_struct.patch
1 --- a/src/auth.c
2 +++ b/src/auth.c
3 @@ -70,7 +70,7 @@
4  {
5         char* data;
6         char* data_extra;
7 -       struct user_access_info* info = 0;
8 +       struct uhub_user_access_info* info = 0;
9         
10         if (!strncmp(line, cmd, strlen(cmd)))
11         {
12 @@ -86,7 +86,7 @@
13                         return -1;
14                 }
15                 
16 -               info = hub_malloc_zero(sizeof(struct user_access_info));
17 +               info = hub_malloc_zero(sizeof(struct uhub_user_access_info));
18                 
19                 if (!info)
20                 {
21 @@ -340,7 +340,7 @@
22  
23  static void acl_free_access_info(void* ptr)
24  {
25 -       struct user_access_info* info = (struct user_access_info*) ptr;
26 +       struct uhub_user_access_info* info = (struct uhub_user_access_info*) ptr;
27         if (info)
28         {
29                 hub_free(info->username);
30 @@ -404,16 +404,16 @@
31  }
32  
33  
34 -struct user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name)
35 +struct uhub_user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name)
36  {
37 -       struct user_access_info* info = (struct user_access_info*) list_get_first(handle->users);
38 +       struct uhub_user_access_info* info = (struct uhub_user_access_info*) list_get_first(handle->users);
39         while (info)
40         {
41                 if (strcasecmp(info->username, name) == 0)
42                 {
43                         return info;
44                 }
45 -               info = (struct user_access_info*) list_get_next(handle->users);
46 +               info = (struct uhub_user_access_info*) list_get_next(handle->users);
47         }
48         return NULL;
49  }
50 @@ -492,7 +492,7 @@
51   * seconds since the unix epoch (modulus 1 million)
52   * and the SID of the user (0-1 million).
53   */
54 -const char* password_generate_challenge(struct user* user)
55 +const char* password_generate_challenge(struct uhub_user* user)
56  {
57         char buf[32];
58         uint64_t tiger_res[3];
59 @@ -511,10 +511,10 @@
60  }
61  
62  
63 -int password_verify(struct user* user, const char* password)
64 +int password_verify(struct uhub_user* user, const char* password)
65  {
66         char buf[1024];
67 -       struct user_access_info* access;
68 +       struct uhub_user_access_info* access;
69         const char* challenge;
70         char raw_challenge[64];
71         char password_calc[64];
72 --- a/src/auth.h
73 +++ b/src/auth.h
74 @@ -21,7 +21,7 @@
75  #define HAVE_UHUB_ACL_H
76  
77  struct hub_config;
78 -struct user;
79 +struct uhub_user;
80  struct ip_addr_encap;
81  
82  enum password_status
83 @@ -50,7 +50,7 @@
84  
85  const char* get_user_credential_string(enum user_credentials cred);
86  
87 -struct user_access_info
88 +struct uhub_user_access_info
89  {
90         char* username;          /* name of user, cid or IP range */
91         char* password;          /* password */
92 @@ -77,7 +77,7 @@
93  extern int acl_initialize(struct hub_config* config, struct acl_handle* handle);
94  extern int acl_shutdown(struct acl_handle* handle);
95  
96 -extern struct user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name);
97 +extern struct uhub_user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name);
98  extern int acl_is_cid_banned(struct acl_handle* handle, const char* cid);
99  extern int acl_is_ip_banned(struct acl_handle* handle, const char* ip_address);
100  extern int acl_is_ip_nat_override(struct acl_handle* handle, const char* ip_address);
101 @@ -87,7 +87,7 @@
102  
103  extern int acl_check_ip_range(struct ip_addr_encap* addr, struct ip_ban_record* info);
104  
105 -extern const char* password_generate_challenge(struct user* user);
106 -extern int password_verify(struct user* user, const char* password);
107 +extern const char* password_generate_challenge(struct uhub_user* user);
108 +extern int password_verify(struct uhub_user* user, const char* password);
109  
110  #endif /* HAVE_UHUB_ACL_H */
111 --- a/src/commands.c
112 +++ b/src/commands.c
113 @@ -19,7 +19,7 @@
114  
115  #include "uhub.h"
116  
117 -typedef int (*command_handler)(struct user* user, const char* message);
118 +typedef int (*command_handler)(struct uhub_user* user, const char* message);
119  
120  struct commands_handler
121  {
122 @@ -32,7 +32,7 @@
123  
124  static struct commands_handler command_handlers[];
125  
126 -static void send_message(struct user* user, const char* message)
127 +static void send_message(struct uhub_user* user, const char* message)
128  {
129         char* buffer = adc_msg_escape(message);
130         struct adc_message* command = adc_msg_construct(ADC_CMD_IMSG, strlen(buffer) + 6);
131 @@ -42,7 +42,7 @@
132         hub_free(buffer);
133  }
134  
135 -static int command_access_denied(struct user* user, const char* command)
136 +static int command_access_denied(struct uhub_user* user, const char* command)
137  {
138         char temp[64];
139         snprintf(temp, 64, "*** Access denied: \"%s\"", command);
140 @@ -51,7 +51,7 @@
141  }
142  
143  
144 -static int command_stats(struct user* user, const char* message)
145 +static int command_stats(struct uhub_user* user, const char* message)
146  {
147         char temp[128];
148         snprintf(temp, 128, "*** Stats: %zu users, peak: %zu. Network (up/down): %d/%d KB/s, peak: %d/%d KB/s",
149 @@ -67,7 +67,7 @@
150  }
151  
152  
153 -static int command_help(struct user* user, const char* message)
154 +static int command_help(struct uhub_user* user, const char* message)
155  {
156  #define MAX_HELP_MSG 1024
157         size_t n;
158 @@ -89,7 +89,7 @@
159      return 0;
160  }
161  
162 -static int command_uptime(struct user* user, const char* message)
163 +static int command_uptime(struct uhub_user* user, const char* message)
164  {
165         char tmp[128];
166         size_t d;
167 @@ -124,20 +124,20 @@
168         return 0;
169  }
170  
171 -static int command_kick(struct user* user, const char* message)
172 +static int command_kick(struct uhub_user* user, const char* message)
173  {
174         send_message(user, "*** Kick not implemented!");
175         return 0;
176  }
177  
178 -static int command_reload(struct user* user, const char* message)
179 +static int command_reload(struct uhub_user* user, const char* message)
180  {
181         send_message(user, "*** Reloading configuration");
182         user->hub->status = hub_status_restart;
183         return 0;
184  }
185  
186 -static int command_shutdown(struct user* user, const char* message)
187 +static int command_shutdown(struct uhub_user* user, const char* message)
188  {
189         send_message(user, "*** Hub shuting down...");
190         user->hub->status = hub_status_shutdown;
191 @@ -145,13 +145,13 @@
192  }
193  
194  
195 -static int command_version(struct user* user, const char* message)
196 +static int command_version(struct uhub_user* user, const char* message)
197  {
198      send_message(user, "*** Powered by " PRODUCT "/" VERSION);
199      return 0;
200  }
201  
202 -static int command_myip(struct user* user, const char* message)
203 +static int command_myip(struct uhub_user* user, const char* message)
204  {
205      char tmp[128];
206      snprintf(tmp, 128, "*** Your IP: %s", ip_convert_to_string(&user->ipaddr));
207 @@ -159,7 +159,7 @@
208      return 0;
209  }
210  
211 -int command_dipatcher(struct user* user, const char* message)
212 +int command_dipatcher(struct uhub_user* user, const char* message)
213  {
214         size_t n = 0;
215         for (n = 0; command_handlers[n].prefix; n++)
216 --- a/src/commands.h
217 +++ b/src/commands.h
218 @@ -23,7 +23,7 @@
219  #define CHAT_MSG_IGNORED  0
220  #define CHAT_MSG_INVALID -1
221  
222 -typedef int (*plugin_event_chat_message)(struct hub_info*, struct user*, struct adc_message*);
223 +typedef int (*plugin_event_chat_message)(struct hub_info*, struct uhub_user*, struct adc_message*);
224  
225  struct command_info
226  {
227 @@ -32,4 +32,4 @@
228         plugin_event_chat_message function;
229  };
230  
231 -int command_dipatcher(struct user* user, const char* message);
232 +int command_dipatcher(struct uhub_user* user, const char* message);
233 --- a/src/hub.c
234 +++ b/src/hub.c
235 @@ -19,7 +19,7 @@
236  
237  #include "uhub.h"
238  
239 -int hub_handle_message(struct user* u, const char* line, size_t length)
240 +int hub_handle_message(struct uhub_user* u, const char* line, size_t length)
241  {
242         int ret = 0;
243         struct adc_message* cmd = 0;
244 @@ -96,7 +96,7 @@
245  }
246  
247  
248 -int hub_handle_support(struct user* u, struct adc_message* cmd)
249 +int hub_handle_support(struct uhub_user* u, struct adc_message* cmd)
250  {
251         int ret = 0;
252         int index = 0;
253 @@ -161,7 +161,7 @@
254  }
255  
256  
257 -int hub_handle_password(struct user* u, struct adc_message* cmd)
258 +int hub_handle_password(struct uhub_user* u, struct adc_message* cmd)
259  {
260         char* password = adc_msg_get_argument(cmd, 0);
261         int ret = 0;
262 @@ -184,7 +184,7 @@
263  }
264  
265  
266 -int hub_handle_chat_message(struct user* u, struct adc_message* cmd)
267 +int hub_handle_chat_message(struct uhub_user* u, struct adc_message* cmd)
268  {
269         char* message = adc_msg_get_argument(cmd, 0);
270         int ret = 0;
271 @@ -206,14 +206,14 @@
272         return ret;
273  }
274  
275 -int on_kick(struct user* u, struct adc_message* cmd)
276 +int on_kick(struct uhub_user* u, struct adc_message* cmd)
277  {
278         hub_log(log_error, "on_kick() not implemented");
279         return -1;
280  }
281  
282  #ifdef ADC_UDP_OPERATION
283 -int hub_handle_autocheck(struct user* u, struct adc_message* cmd)
284 +int hub_handle_autocheck(struct uhub_user* u, struct adc_message* cmd)
285  {
286         char* port_str = adc_msg_get_argument(cmd, 0);
287         char* token    = adc_msg_get_argument(cmd, 1);
288 @@ -245,13 +245,13 @@
289  #endif
290  
291  
292 -void hub_send_autocheck(struct user* u, uint16_t port, const char* token)
293 +void hub_send_autocheck(struct uhub_user* u, uint16_t port, const char* token)
294  {
295         
296  }
297  
298  
299 -void hub_send_support(struct user* u)
300 +void hub_send_support(struct uhub_user* u)
301  {
302         if (user_is_connecting(u) || user_is_logged_in(u))
303         {
304 @@ -260,7 +260,7 @@
305  }
306  
307  
308 -void hub_send_sid(struct user* u)
309 +void hub_send_sid(struct uhub_user* u)
310  {
311         struct adc_message* command;
312         if (user_is_connecting(u))
313 @@ -274,7 +274,7 @@
314  }
315  
316  
317 -void hub_send_ping(struct user* user)
318 +void hub_send_ping(struct uhub_user* user)
319  {
320         /* This will just send a newline, despite appearing to do more below. */
321         struct adc_message* ping = adc_msg_construct(0, 0);
322 @@ -287,7 +287,7 @@
323  }
324  
325  
326 -void hub_send_hubinfo(struct user* u)
327 +void hub_send_hubinfo(struct uhub_user* u)
328  {
329         struct adc_message* info = adc_msg_copy(u->hub->command_info);
330         int value = 0;
331 @@ -356,7 +356,7 @@
332  }
333  
334  
335 -void hub_send_handshake(struct user* u)
336 +void hub_send_handshake(struct uhub_user* u)
337  {
338         hub_send_support(u);
339         hub_send_sid(u);
340 @@ -369,7 +369,7 @@
341  }
342  
343  
344 -void hub_send_motd(struct user* u)
345 +void hub_send_motd(struct uhub_user* u)
346  {
347         if (u->hub->command_motd)
348         {
349 @@ -378,7 +378,7 @@
350  }
351  
352  
353 -void hub_send_password_challenge(struct user* u)
354 +void hub_send_password_challenge(struct uhub_user* u)
355  {
356         struct adc_message* igpa;
357         igpa = adc_msg_construct(ADC_CMD_IGPA, 38);
358 @@ -399,33 +399,33 @@
359         {
360                 case UHUB_EVENT_USER_JOIN:
361                 {
362 -                       if (user_is_disconnecting((struct user*) message->ptr))
363 +                       if (user_is_disconnecting((struct uhub_user*) message->ptr))
364                                 break;
365                 
366                         if (message->flags)
367                         {
368 -                               hub_send_password_challenge((struct user*) message->ptr);
369 +                               hub_send_password_challenge((struct uhub_user*) message->ptr);
370                         }
371                         else
372                         {
373 -                               on_login_success((struct user*) message->ptr);
374 +                               on_login_success((struct uhub_user*) message->ptr);
375                         }
376                         break;
377                 }
378  
379                 case UHUB_EVENT_USER_QUIT:
380                 {
381 -                       user_manager_remove((struct user*) message->ptr);
382 -                       send_quit_message((struct user*) message->ptr);
383 -                       on_logout_user((struct user*) message->ptr);
384 -                       user_schedule_destroy((struct user*) message->ptr);
385 +                       user_manager_remove((struct uhub_user*) message->ptr);
386 +                       send_quit_message((struct uhub_user*) message->ptr);
387 +                       on_logout_user((struct uhub_user*) message->ptr);
388 +                       user_schedule_destroy((struct uhub_user*) message->ptr);
389                         break;
390                 }
391                 
392                 case UHUB_EVENT_USER_DESTROY:
393                 {
394                         hub_log(log_trace, "hub_event_dispatcher: UHUB_EVENT_USER_DESTROY (ptr=%p)", message->ptr);
395 -                       user_destroy((struct user*) message->ptr);
396 +                       user_destroy((struct uhub_user*) message->ptr);
397                         break;
398                 }
399                 
400 @@ -757,7 +757,7 @@
401   */
402  static inline int is_nick_in_use(struct hub_info* hub, const char* nick)
403  {
404 -       struct user* lookup = get_user_by_nick(hub, nick);
405 +       struct uhub_user* lookup = get_user_by_nick(hub, nick);
406         if (lookup)
407         {
408                 return 1;
409 @@ -771,7 +771,7 @@
410   */
411  static inline int is_cid_in_use(struct hub_info* hub, const char* cid)
412  {
413 -       struct user* lookup = get_user_by_cid(hub, cid);
414 +       struct uhub_user* lookup = get_user_by_cid(hub, cid);
415         if (lookup)
416         {
417                 return 1;
418 @@ -796,7 +796,7 @@
419   * @param msg See enum status_message
420   * @param level See enum status_level
421   */
422 -void hub_send_status(struct user* user, enum status_message msg, enum msg_status_level level)
423 +void hub_send_status(struct uhub_user* user, enum status_message msg, enum msg_status_level level)
424  {
425         struct hub_config* cfg = user->hub->config;
426         struct adc_message* cmd = adc_msg_construct(ADC_CMD_ISTA, 6);
427 --- a/src/hubevent.c
428 +++ b/src/hubevent.c
429 @@ -19,27 +19,27 @@
430  
431  #include "uhub.h"
432  
433 -static void log_user_login(struct user* u)
434 +static void log_user_login(struct uhub_user* u)
435  {
436         const char* cred = get_user_credential_string(u->credentials);
437         const char* addr = ip_convert_to_string(&u->ipaddr);
438         hub_log(log_user, "LoginOK     %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, cred, u->user_agent);
439  }
440  
441 -static void log_user_login_error(struct user* u, enum status_message msg)
442 +static void log_user_login_error(struct uhub_user* u, enum status_message msg)
443  {
444         const char* addr = ip_convert_to_string(&u->ipaddr);
445         const char* message = hub_get_status_message_log(u->hub, msg);
446         hub_log(log_user, "LoginError  %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message, u->user_agent);
447  }
448  
449 -static void log_user_logout(struct user* u, const char* message)
450 +static void log_user_logout(struct uhub_user* u, const char* message)
451  {
452         const char* addr = ip_convert_to_string(&u->ipaddr);
453         hub_log(log_user, "Logout      %s/%s %s \"%s\" (%s)", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message);
454  }
455  
456 -static void log_user_nick_change(struct user* u, const char* nick)
457 +static void log_user_nick_change(struct uhub_user* u, const char* nick)
458  {
459         const char* addr = ip_convert_to_string(&u->ipaddr);
460         hub_log(log_user, "NickChange  %s/%s %s \"%s\" -> \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, nick);
461 @@ -47,7 +47,7 @@
462  
463  
464  /* Send MOTD, do logging etc */
465 -void on_login_success(struct user* u)
466 +void on_login_success(struct uhub_user* u)
467  {
468         struct timeval timeout = { TIMEOUT_IDLE, 0 };
469         
470 @@ -75,14 +75,14 @@
471                 event_add(u->ev_read, &timeout);
472  }
473  
474 -void on_login_failure(struct user* u, enum status_message msg)
475 +void on_login_failure(struct uhub_user* u, enum status_message msg)
476  {
477         log_user_login_error(u, msg);
478         hub_send_status(u, msg, status_level_fatal);
479         user_disconnect(u, quit_logon_error);
480  }
481  
482 -void on_nick_change(struct user* u, const char* nick)
483 +void on_nick_change(struct uhub_user* u, const char* nick)
484  {
485         if (user_is_logged_in(u))
486         {
487 @@ -90,7 +90,7 @@
488         }
489  }
490  
491 -void on_logout_user(struct user* user)
492 +void on_logout_user(struct uhub_user* user)
493  {
494         const char* reason = "";
495         
496 --- a/src/hubevent.h
497 +++ b/src/hubevent.h
498 @@ -23,22 +23,22 @@
499  /**
500   * This event is triggered whenever a user successfully logs in to the hub.
501   */
502 -extern void on_login_success(struct user* u);
503 +extern void on_login_success(struct uhub_user* u);
504  
505  /**
506   * This event is triggered whenever a user failed to log in to the hub.
507   */
508 -extern void on_login_failure(struct user* u, enum status_message msg);
509 +extern void on_login_failure(struct uhub_user* u, enum status_message msg);
510  
511  /**
512   * This event is triggered whenever a previously logged in user leaves the hub.
513   */
514 -extern void on_logout_user(struct user* u);
515 +extern void on_logout_user(struct uhub_user* u);
516  
517  /**
518   * This event is triggered whenever a user changes his/her nickname.
519   */
520 -extern void on_nick_change(struct user* u, const char* nick);
521 +extern void on_nick_change(struct uhub_user* u, const char* nick);
522  
523  
524  #endif /* HAVE_UHUB_HUB_EVENT_H */
525 --- a/src/hub.h
526 +++ b/src/hub.h
527 @@ -94,7 +94,7 @@
528         struct event_queue* queue;
529         struct event_base* evbase;
530         struct hub_config* config;
531 -       struct user_manager* users;
532 +       struct uhub_user_manager* users;
533         struct acl_handle* acl;
534         struct adc_message* command_info;    /* The hub's INF command */
535         struct adc_message* command_support; /* The hub's SUP command */
536 @@ -116,103 +116,103 @@
537   *
538   * @return 0 on success, -1 on error
539   */
540 -extern int hub_handle_message(struct user* u, const char* message, size_t length);
541 +extern int hub_handle_message(struct uhub_user* u, const char* message, size_t length);
542  
543  /**
544   * Handle protocol support/subscription messages received clients.
545   *
546   * @return 0 on success, -1 on error
547   */
548 -extern int hub_handle_support(struct user* u, struct adc_message* cmd);
549 +extern int hub_handle_support(struct uhub_user* u, struct adc_message* cmd);
550  
551  /**
552   * Handle password messages received from clients.
553   *
554   * @return 0 on success, -1 on error
555   */
556 -extern int hub_handle_password(struct user* u, struct adc_message* cmd);
557 +extern int hub_handle_password(struct uhub_user* u, struct adc_message* cmd);
558  
559  /**
560   * Handle chat messages received from clients.
561   * @return 0 on success, -1 on error.
562   */
563 -extern int hub_handle_chat_message(struct user* u, struct adc_message* cmd);
564 +extern int hub_handle_chat_message(struct uhub_user* u, struct adc_message* cmd);
565  
566  /**
567   * Used internally by hub_handle_info
568   * @return 1 if nickname is OK, or 0 if nickname is not accepted.
569   */
570 -extern int  hub_handle_info_check_nick(struct user* u, struct adc_message* cmd);
571 +extern int  hub_handle_info_check_nick(struct uhub_user* u, struct adc_message* cmd);
572  
573  /**
574   * Used internally by hub_handle_info
575   * @return 1 if CID/PID is OK, or 0 if not valid.
576   */
577 -extern int  hub_handle_info_check_cid(struct user* u, struct adc_message* cmd);
578 +extern int  hub_handle_info_check_cid(struct uhub_user* u, struct adc_message* cmd);
579  
580  /**
581   * Can only be used by administrators or operators.
582   *
583   * @return 0 on success, -1 on error
584   */
585 -extern int hub_handle_kick(struct user* u, struct adc_message* cmd);
586 +extern int hub_handle_kick(struct uhub_user* u, struct adc_message* cmd);
587  
588  #ifdef ADC_UDP_OPERATION
589  /**
590   * Handle incoming autocheck message.
591   */
592 -extern int hub_handle_autocheck(struct user* u, struct adc_message* cmd);
593 +extern int hub_handle_autocheck(struct uhub_user* u, struct adc_message* cmd);
594  #endif
595  
596  /**
597   * Send the support line for the hub to a particular user.
598   * Only used during the initial handshake.
599   */
600 -extern void hub_send_support(struct user* u);
601 +extern void hub_send_support(struct uhub_user* u);
602  
603  /**
604   * Send a message assigning a SID for a user.
605   * This is only sent after hub_send_support() during initial handshake.
606   */
607 -extern void hub_send_sid(struct user* u);
608 +extern void hub_send_sid(struct uhub_user* u);
609  
610  /**
611   * Send a 'ping' message to user.
612   */
613 -extern void hub_send_ping(struct user* user);
614 +extern void hub_send_ping(struct uhub_user* user);
615  
616  /**
617   * Send a message containing hub information to a particular user.
618   * This is sent during user connection, but can safely be sent at any
619   * point later.
620   */
621 -extern void hub_send_hubinfo(struct user* u);
622 +extern void hub_send_hubinfo(struct uhub_user* u);
623  
624  /**
625   * Send handshake. This basically calls
626   * hub_send_support() and hub_send_sid()
627   */
628 -extern void hub_send_handshake(struct user* u);
629 +extern void hub_send_handshake(struct uhub_user* u);
630  
631  /**
632   * Send a welcome message containing the message of the day to 
633   * one particular user. This can be sent in any point in time.
634   */
635 -extern void hub_send_motd(struct user* u);
636 +extern void hub_send_motd(struct uhub_user* u);
637  
638  /**
639   * Send a password challenge to a user.
640   * This is only used if the user tries to access the hub using a
641   * password protected nick name.
642   */
643 -extern void hub_send_password_challenge(struct user* u);
644 +extern void hub_send_password_challenge(struct uhub_user* u);
645  
646  /**
647   * Send an autocheck message to a user.
648   * This is basically a UDP message. The user's client can then determine
649   * if UDP communication works by either hole punching or configuring UPnP.
650   */
651 -extern void hub_send_autocheck(struct user* u, uint16_t port, const char* token);
652 +extern void hub_send_autocheck(struct uhub_user* u, uint16_t port, const char* token);
653  
654  /**
655   * This starts the hub.
656 @@ -244,7 +244,7 @@
657  /**
658   * Sends a status_message to a user.
659   */
660 -extern void hub_send_status(struct user* user, enum status_message msg, enum msg_status_level level);
661 +extern void hub_send_status(struct uhub_user* user, enum status_message msg, enum msg_status_level level);
662  
663  /**
664   * Returns the number of logged in users on the hub.
665 --- a/src/inf.c
666 +++ b/src/inf.c
667 @@ -39,9 +39,9 @@
668         adc_msg_remove_named_argument(cmd, ADC_INF_FLAG_REFERER);
669  }
670  
671 -static int user_is_protected(struct user* user);
672 +static int user_is_protected(struct uhub_user* user);
673  
674 -static int set_feature_cast_supports(struct user* u, struct adc_message* cmd)
675 +static int set_feature_cast_supports(struct uhub_user* u, struct adc_message* cmd)
676  {
677         char *it, *tmp;
678         
679 @@ -89,7 +89,7 @@
680  /*
681   * FIXME: Only works for tiger hash. If a client doesnt support tiger we cannot let it in!
682   */
683 -static int check_cid(struct user* user, struct adc_message* cmd)
684 +static int check_cid(struct uhub_user* user, struct adc_message* cmd)
685  {
686         size_t pos;
687         char* cid = adc_msg_get_named_argument(cmd, ADC_INF_FLAG_CLIENT_ID);
688 @@ -150,7 +150,7 @@
689  }
690  
691  
692 -static int check_required_login_flags(struct user* user, struct adc_message* cmd)
693 +static int check_required_login_flags(struct uhub_user* user, struct adc_message* cmd)
694  {
695         int num = 0;
696         
697 @@ -186,7 +186,7 @@
698   * remove any wrong address, and replace it with the correct one
699   * as seen by the hub.
700   */
701 -int check_network(struct user* user, struct adc_message* cmd)
702 +int check_network(struct uhub_user* user, struct adc_message* cmd)
703  {
704         const char* address = ip_convert_to_string(&user->ipaddr);
705         
706 @@ -269,7 +269,7 @@
707  }
708  
709  
710 -static int check_nick(struct user* user, struct adc_message* cmd)
711 +static int check_nick(struct uhub_user* user, struct adc_message* cmd)
712  {
713         char* nick;
714         char* tmp;
715 @@ -317,10 +317,10 @@
716  }
717  
718  
719 -static int check_logged_in(struct user* user, struct adc_message* cmd)
720 +static int check_logged_in(struct uhub_user* user, struct adc_message* cmd)
721  {
722 -       struct user* lookup1 = get_user_by_nick(user->hub, user->id.nick);
723 -       struct user* lookup2 = get_user_by_cid(user->hub,  user->id.cid);
724 +       struct uhub_user* lookup1 = get_user_by_nick(user->hub, user->id.nick);
725 +       struct uhub_user* lookup2 = get_user_by_cid(user->hub,  user->id.cid);
726         
727         if (lookup1 == user)
728         {
729 @@ -358,7 +358,7 @@
730   * But this is not something we want to do, and is deprecated in the ADC specification.
731   * One should rather look at capabilities/features.
732   */
733 -static int check_user_agent(struct user* user, struct adc_message* cmd)
734 +static int check_user_agent(struct uhub_user* user, struct adc_message* cmd)
735  {
736         char* ua_encoded = 0;
737         char* ua = 0;
738 @@ -379,7 +379,7 @@
739  }
740  
741  
742 -static int check_acl(struct user* user, struct adc_message* cmd)
743 +static int check_acl(struct uhub_user* user, struct adc_message* cmd)
744  {
745         if (acl_is_cid_banned(user->hub->acl, user->id.cid))
746         {
747 @@ -399,7 +399,7 @@
748         return 0;
749  }
750  
751 -static int check_limits(struct user* user, struct adc_message* cmd)
752 +static int check_limits(struct uhub_user* user, struct adc_message* cmd)
753  {
754         char* arg = adc_msg_get_named_argument(cmd, ADC_INF_FLAG_SHARED_SIZE);
755         if (arg)
756 @@ -525,10 +525,10 @@
757   * If the hub is configured to allow only registered users and the user
758   * is not recognized this will return 1.
759   */
760 -static int set_credentials(struct user* user, struct adc_message* cmd)
761 +static int set_credentials(struct uhub_user* user, struct adc_message* cmd)
762  {
763         int ret = 0;
764 -       struct user_access_info* info = acl_get_access_info(user->hub->acl, user->id.nick);
765 +       struct uhub_user_access_info* info = acl_get_access_info(user->hub->acl, user->id.nick);
766         
767         if (info)
768         {
769 @@ -580,7 +580,7 @@
770  /**
771   * Determines if a user is to be let into the hub even if the hub is "full".
772   */
773 -static int user_is_protected(struct user* user)
774 +static int user_is_protected(struct uhub_user* user)
775  {
776         switch (user->credentials)
777         {
778 @@ -601,7 +601,7 @@
779   * Only registered users will be let in if the hub is configured for registered
780   * users only.
781   */
782 -static int user_is_registered(struct user* user)
783 +static int user_is_registered(struct uhub_user* user)
784  {
785         switch (user->credentials)
786         {
787 @@ -619,7 +619,7 @@
788  }
789  
790  
791 -void update_user_info(struct user* u, struct adc_message* cmd)
792 +void update_user_info(struct uhub_user* u, struct adc_message* cmd)
793  {
794         char prefix[2];
795         char* argument;
796 @@ -649,7 +649,7 @@
797  }
798  
799  
800 -static int check_is_hub_full(struct user* user)
801 +static int check_is_hub_full(struct uhub_user* user)
802  {
803         /*
804          * If hub is full, don't let users in, but we still want to allow
805 @@ -663,7 +663,7 @@
806  }
807  
808  
809 -static int check_registered_users_only(struct user* user)
810 +static int check_registered_users_only(struct uhub_user* user)
811  {
812         if (user->hub->config->registered_users_only && !user_is_registered(user))
813         {
814 @@ -679,7 +679,7 @@
815                         return ret; \
816         } while(0)
817  
818 -static int hub_handle_info_common(struct user* user, struct adc_message* cmd)
819 +static int hub_handle_info_common(struct uhub_user* user, struct adc_message* cmd)
820  {
821         /* Remove server restricted flags */
822         remove_server_restricted_flags(cmd);
823 @@ -690,7 +690,7 @@
824         return 0;
825  }
826  
827 -static int hub_handle_info_low_bandwidth(struct user* user, struct adc_message* cmd)
828 +static int hub_handle_info_low_bandwidth(struct uhub_user* user, struct adc_message* cmd)
829  {
830         if (user->hub->config->low_bandwidth_mode)
831         {
832 @@ -711,7 +711,7 @@
833         return 0;
834  }
835  
836 -int hub_handle_info_login(struct user* user, struct adc_message* cmd)
837 +int hub_handle_info_login(struct uhub_user* user, struct adc_message* cmd)
838  {
839         int need_auth = 0;
840         
841 @@ -765,7 +765,7 @@
842   * - CID/PID (valid, not taken, etc).
843   * - IP addresses (IPv4 and IPv6)
844   */
845 -int hub_handle_info(struct user* user, const struct adc_message* cmd_unmodified)
846 +int hub_handle_info(struct uhub_user* user, const struct adc_message* cmd_unmodified)
847  {
848         struct adc_message* cmd = adc_msg_copy(cmd_unmodified);
849         if (!cmd) return -1; /* OOM */
850 --- a/src/inf.h
851 +++ b/src/inf.h
852 @@ -47,7 +47,7 @@
853   *
854   * @return 0 on success, -1 on error
855   */
856 -extern int hub_handle_info(struct user* u, const struct adc_message* cmd);
857 +extern int hub_handle_info(struct uhub_user* u, const struct adc_message* cmd);
858  
859  
860  #endif /* HAVE_UHUB_INF_PARSER_H */
861 --- a/src/message.c
862 +++ b/src/message.c
863 @@ -234,7 +234,7 @@
864  }
865  
866  
867 -struct adc_message* adc_msg_parse_verify(struct user* u, const char* line, size_t length)
868 +struct adc_message* adc_msg_parse_verify(struct uhub_user* u, const char* line, size_t length)
869  {
870         struct adc_message* command = adc_msg_parse(line, length);
871         
872 --- a/src/message.h
873 +++ b/src/message.h
874 @@ -20,7 +20,7 @@
875  #ifndef HAVE_UHUB_COMMAND_H
876  #define HAVE_UHUB_COMMAND_H
877  
878 -struct user;
879 +struct uhub_user;
880  
881  struct adc_message
882  {
883 @@ -70,7 +70,7 @@
884   * The message is only considered valid if the user who sent it
885   * is the rightful origin of the message.
886   */
887 -extern struct adc_message* adc_msg_parse_verify(struct user* u, const char* string, size_t length);
888 +extern struct adc_message* adc_msg_parse_verify(struct uhub_user* u, const char* string, size_t length);
889  
890  /**
891   * This will parse 'string' and return it as a adc_message struct, or
892 --- a/src/netevent.c
893 +++ b/src/netevent.c
894 @@ -23,7 +23,7 @@
895  void net_on_read(int fd, short ev, void *arg)
896  {
897         static char buf[MAX_RECV_BUF];
898 -       struct user* user = (struct user*) arg;
899 +       struct uhub_user* user = (struct uhub_user*) arg;
900         char* pos;
901         size_t offset;
902         size_t buflen;
903 @@ -168,7 +168,7 @@
904  
905  void net_on_write(int fd, short ev, void *arg)
906  {
907 -       struct user* user = (struct user*) arg;
908 +       struct uhub_user* user = (struct uhub_user*) arg;
909         struct adc_message* msg;
910         int ret;
911         int length;
912 @@ -259,7 +259,7 @@
913  void net_on_accept(int server_fd, short ev, void *arg)
914  {
915         struct hub_info* hub = (struct hub_info*) arg;
916 -       struct user* user = 0;
917 +       struct uhub_user* user = 0;
918         struct ip_addr_encap ipaddr;
919         const char* addr;
920         struct timeval timeout = { TIMEOUT_CONNECTED, 0 };
921 @@ -320,7 +320,7 @@
922  {
923         static char buffer[1024] = {0,};
924         // struct hub_info* hub = (struct hub_info*) arg;
925 -       // struct user* user = 0;
926 +       // struct uhub_user* user = 0;
927         ssize_t size;
928         struct sockaddr_storage from;
929         socklen_t fromlen;
930 --- a/src/plugin.h
931 +++ b/src/plugin.h
932 @@ -19,12 +19,12 @@
933  
934  typedef void (*plugin_event_startup)(struct hub*);
935  typedef void (*plugin_event_shutdown)(struct hub*);
936 -typedef void (*plugin_event_user_login)(struct hub*, struct user*);
937 -typedef void (*plugin_event_user_logout)(struct hub*, struct user*);
938 +typedef void (*plugin_event_user_login)(struct hub*, struct uhub_user*);
939 +typedef void (*plugin_event_user_logout)(struct hub*, struct uhub_user*);
940  typedef int  (*plugin_event_connect)(struct hub*, struct ip_addr_encap);
941 -typedef void (*plugin_event_disconnect)(struct hub*, struct user*);
942 -typedef int  (*plugin_event_message)(struct hub*, struct user*, struct adc_message*);
943 -typedef void (*plugin_event_support)(struct hub*, struct user*, int);
944 +typedef void (*plugin_event_disconnect)(struct hub*, struct uhub_user*);
945 +typedef int  (*plugin_event_message)(struct hub*, struct uhub_user*, struct adc_message*);
946 +typedef void (*plugin_event_support)(struct hub*, struct uhub_user*, int);
947  
948  struct uhub_plugin
949  {
950 --- a/src/route.c
951 +++ b/src/route.c
952 @@ -20,9 +20,9 @@
953  #include "uhub.h"
954  
955  
956 -int route_message(struct user* u, struct adc_message* msg)
957 +int route_message(struct uhub_user* u, struct adc_message* msg)
958  {
959 -       struct user* target = NULL;
960 +       struct uhub_user* target = NULL;
961  
962         switch (msg->cache[0])
963         {
964 @@ -59,7 +59,7 @@
965  }
966  
967  
968 -static void queue_command(struct user* user, struct adc_message* msg__, int offset)
969 +static void queue_command(struct uhub_user* user, struct adc_message* msg__, int offset)
970  {
971         struct adc_message* msg = adc_msg_incref(msg__);
972         list_append(user->send_queue, msg);
973 @@ -97,7 +97,7 @@
974   *         -1 if send queue is overflowed
975   *         0 if soft send queue is overflowed (not implemented at the moment)
976   */
977 -static int check_send_queue(struct user* user, struct adc_message* msg)
978 +static int check_send_queue(struct uhub_user* user, struct adc_message* msg)
979  {
980         if (user_flag_get(user, flag_user_list))
981                 return 1;
982 @@ -111,7 +111,7 @@
983         return 1;
984  }
985  
986 -int route_to_user(struct user* user, struct adc_message* msg)
987 +int route_to_user(struct uhub_user* user, struct adc_message* msg)
988  {
989         int ret;
990         
991 @@ -174,11 +174,11 @@
992  
993  int route_to_all(struct hub_info* hub, struct adc_message* command) /* iterate users */
994  {
995 -       struct user* user = (struct user*) list_get_first(hub->users->list);
996 +       struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list);
997         while (user)
998         {
999                 route_to_user(user, command);
1000 -               user = (struct user*) list_get_next(hub->users->list);
1001 +               user = (struct uhub_user*) list_get_next(hub->users->list);
1002         }
1003         
1004         return 0;
1005 @@ -190,7 +190,7 @@
1006         int do_send;
1007         char* tmp;
1008         
1009 -       struct user* user = (struct user*) list_get_first(hub->users->list);
1010 +       struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list);
1011         while (user)
1012         {
1013                 if (user->feature_cast)
1014 @@ -209,7 +209,7 @@
1015                         }
1016                         
1017                         if (!do_send) {
1018 -                               user = (struct user*) list_get_next(hub->users->list);
1019 +                               user = (struct uhub_user*) list_get_next(hub->users->list);
1020                                 continue;
1021                         }
1022                         
1023 @@ -229,13 +229,13 @@
1024                                 route_to_user(user, command);
1025                         }
1026                 }
1027 -               user = (struct user*) list_get_next(hub->users->list);
1028 +               user = (struct uhub_user*) list_get_next(hub->users->list);
1029         }
1030         
1031         return 0;
1032  }
1033  
1034 -int route_info_message(struct user* u)
1035 +int route_info_message(struct uhub_user* u)
1036  {
1037         if (!user_is_nat_override(u))
1038         {
1039 @@ -245,12 +245,12 @@
1040         {
1041                 struct adc_message* cmd = adc_msg_copy(u->info);
1042                 const char* address = ip_convert_to_string(&u->ipaddr);
1043 -               struct user* user = 0;
1044 +               struct uhub_user* user = 0;
1045                 
1046                 adc_msg_remove_named_argument(cmd, ADC_INF_FLAG_IPV4_ADDR);
1047                 adc_msg_add_named_argument(cmd, ADC_INF_FLAG_IPV4_ADDR, address);
1048         
1049 -               user = (struct user*) list_get_first(u->hub->users->list);
1050 +               user = (struct uhub_user*) list_get_first(u->hub->users->list);
1051                 while (user)
1052                 {
1053                         if (user_is_nat_override(user))
1054 @@ -258,7 +258,7 @@
1055                         else
1056                                 route_to_user(user, u->info);
1057                         
1058 -                       user = (struct user*) list_get_next(u->hub->users->list);
1059 +                       user = (struct uhub_user*) list_get_next(u->hub->users->list);
1060                 }
1061                 adc_msg_free(cmd);
1062         }
1063 --- a/src/route.h
1064 +++ b/src/route.h
1065 @@ -23,12 +23,12 @@
1066  /**
1067   * Route a message by sending it to it's final destination.
1068   */
1069 -extern int route_message(struct user* u, struct adc_message* msg);
1070 +extern int route_message(struct uhub_user* u, struct adc_message* msg);
1071  
1072  /**
1073   * Transmit message directly to one user.
1074   */
1075 -extern int route_to_user(struct user*, struct adc_message* command);
1076 +extern int route_to_user(struct uhub_user*, struct adc_message* command);
1077  
1078  /**
1079   * Broadcast message to all users.
1080 @@ -45,7 +45,7 @@
1081   * This will ensure the correct IP is seen by other users
1082   * in case nat override is in use.
1083   */
1084 -extern int route_info_message(struct user* user);
1085 +extern int route_info_message(struct uhub_user* user);
1086  
1087  
1088  #endif /* HAVE_UHUB_ROUTE_H */
1089 --- a/src/sid.h
1090 +++ b/src/sid.h
1091 @@ -28,7 +28,7 @@
1092  
1093  struct sid_map
1094  {
1095 -       struct user* ptr;
1096 +       struct uhub_user* ptr;
1097         struct sid_map* next;
1098  };
1099  
1100 @@ -58,7 +58,7 @@
1101  
1102  
1103  extern void sid_initialize(struct sid_pool*);
1104 -extern sid_t sid_alloc(struct sid_pool*, struct user*);
1105 +extern sid_t sid_alloc(struct sid_pool*, struct uhub_user*);
1106  extern void sid_free(struct sid_pool*, sid_t);
1107  
1108  
1109 --- a/src/user.c
1110 +++ b/src/user.c
1111 @@ -19,13 +19,13 @@
1112  
1113  #include "uhub.h"
1114  
1115 -struct user* user_create(struct hub_info* hub, int sd)
1116 +struct uhub_user* user_create(struct hub_info* hub, int sd)
1117  {
1118 -       struct user* user = NULL;
1119 +       struct uhub_user* user = NULL;
1120         
1121         hub_log(log_trace, "user_create(), hub=%p, sd=%d", hub, sd);
1122  
1123 -       user = (struct user*) hub_malloc_zero(sizeof(struct user));
1124 +       user = (struct uhub_user*) hub_malloc_zero(sizeof(struct uhub_user));
1125  
1126         if (user == NULL)
1127                 return NULL; /* OOM */
1128 @@ -61,7 +61,7 @@
1129         adc_msg_free((struct adc_message*) ptr);
1130  }
1131  
1132 -void user_destroy(struct user* user)
1133 +void user_destroy(struct uhub_user* user)
1134  {
1135         hub_log(log_trace, "user_destroy(), user=%p", user);
1136  
1137 @@ -98,7 +98,7 @@
1138         hub_free(user);
1139  }
1140  
1141 -void user_set_state(struct user* user, enum user_state state)
1142 +void user_set_state(struct uhub_user* user, enum user_state state)
1143  {
1144         if ((user->state == state_cleanup && state != state_disconnected) || (user->state == state_disconnected))
1145         {
1146 @@ -109,7 +109,7 @@
1147         user->state = state;
1148  }
1149  
1150 -void user_set_info(struct user* user, struct adc_message* cmd)
1151 +void user_set_info(struct uhub_user* user, struct adc_message* cmd)
1152  {
1153         adc_msg_free(user->info);
1154         user->info = adc_msg_incref(cmd);
1155 @@ -156,44 +156,44 @@
1156         }
1157  }
1158  
1159 -void user_support_add(struct user* user, int fourcc)
1160 +void user_support_add(struct uhub_user* user, int fourcc)
1161  {
1162         int feature_mask = convert_support_fourcc(fourcc);
1163         user->flags |= feature_mask;
1164  }
1165  
1166 -int user_flag_get(struct user* user, enum user_flags flag)
1167 +int user_flag_get(struct uhub_user* user, enum user_flags flag)
1168  {
1169      return user->flags & flag;
1170  }
1171  
1172 -void user_flag_set(struct user* user, enum user_flags flag)
1173 +void user_flag_set(struct uhub_user* user, enum user_flags flag)
1174  {
1175      user->flags |= flag;
1176  }
1177  
1178 -void user_flag_unset(struct user* user, enum user_flags flag)
1179 +void user_flag_unset(struct uhub_user* user, enum user_flags flag)
1180  {
1181      user->flags &= ~flag;
1182  }
1183  
1184 -void user_set_nat_override(struct user* user)
1185 +void user_set_nat_override(struct uhub_user* user)
1186  {
1187         user_flag_set(user, flag_nat);
1188  }
1189  
1190 -int user_is_nat_override(struct user* user)
1191 +int user_is_nat_override(struct uhub_user* user)
1192  {
1193         return user_flag_get(user, flag_nat);
1194  }
1195  
1196 -void user_support_remove(struct user* user, int fourcc)
1197 +void user_support_remove(struct uhub_user* user, int fourcc)
1198  {
1199         int feature_mask = convert_support_fourcc(fourcc);
1200         user->flags &= ~feature_mask;
1201  }
1202  
1203 -void user_schedule_destroy(struct user* user)
1204 +void user_schedule_destroy(struct uhub_user* user)
1205  {
1206         struct event_data post;
1207         memset(&post, 0, sizeof(post));
1208 @@ -202,7 +202,7 @@
1209         event_queue_post(user->hub->queue, &post);
1210  }
1211  
1212 -void user_disconnect(struct user* user, int reason)
1213 +void user_disconnect(struct uhub_user* user, int reason)
1214  {
1215         struct event_data post;
1216         int need_notify = 0;
1217 @@ -242,7 +242,7 @@
1218  
1219  }
1220  
1221 -int user_have_feature_cast_support(struct user* user, char feature[4])
1222 +int user_have_feature_cast_support(struct uhub_user* user, char feature[4])
1223  {
1224         char* tmp = list_get_first(user->feature_cast);
1225         while (tmp)
1226 @@ -256,7 +256,7 @@
1227         return 0;
1228  }
1229  
1230 -int user_set_feature_cast_support(struct user* u, char feature[4])
1231 +int user_set_feature_cast_support(struct uhub_user* u, char feature[4])
1232  {
1233         if (!u->feature_cast)
1234         {
1235 @@ -272,7 +272,7 @@
1236         return 1;
1237  }
1238  
1239 -void user_clear_feature_cast_support(struct user* u)
1240 +void user_clear_feature_cast_support(struct uhub_user* u)
1241  {
1242         if (u->feature_cast)
1243         {
1244 @@ -282,21 +282,21 @@
1245         }
1246  }
1247  
1248 -int user_is_logged_in(struct user* user)
1249 +int user_is_logged_in(struct uhub_user* user)
1250  {
1251         if (user->state == state_normal)
1252                 return 1;
1253         return 0;
1254  }
1255  
1256 -int user_is_connecting(struct user* user)
1257 +int user_is_connecting(struct uhub_user* user)
1258  {
1259         if (user->state == state_protocol || user->state == state_identify || user->state == state_verify)
1260                 return 1;
1261         return 0;
1262  }
1263  
1264 -int user_is_disconnecting(struct user* user)
1265 +int user_is_disconnecting(struct uhub_user* user)
1266  {
1267         if (user->state == state_cleanup || user->state == state_disconnected)
1268                 return 1;
1269 --- a/src/user.h
1270 +++ b/src/user.h
1271 @@ -73,7 +73,7 @@
1272  };
1273  
1274  
1275 -struct user_info
1276 +struct uhub_user_info
1277  {
1278         sid_t sid;                    /** session ID */
1279         char cid[MAX_CID_LEN+1];      /** global client ID */
1280 @@ -85,7 +85,7 @@
1281   * as the number of bytes and files shared, and the number of hubs the
1282   * user is connected to, etc.
1283   */
1284 -struct user_counts
1285 +struct uhub_user_counts
1286  {
1287         uint64_t             shared_size;             /** Shared size in bytes */
1288         size_t               shared_files;            /** The number of shared files */
1289 @@ -96,14 +96,14 @@
1290         size_t               hub_count_total;         /** The number of hubs connected to in total */
1291  };
1292  
1293 -struct user
1294 +struct uhub_user
1295  {
1296         int                  sd;                      /** socket descriptor */
1297         struct event*        ev_read;                 /** libevent struct for read events */
1298         struct event*        ev_write;                /** libevent struct for write events */
1299         enum user_state      state;                   /** see enum user_state */
1300         enum user_credentials credentials;            /** see enum user_credentials */
1301 -       struct user_info     id;                      /** Contains nick name and CID */
1302 +       struct uhub_user_info     id;                      /** Contains nick name and CID */
1303         int                  flags;                   /** see enum user_features */
1304         char                 user_agent[MAX_UA_LEN+1];/** User agent string */
1305         time_t               tm_connected;            /** time when user connected */
1306 @@ -120,7 +120,7 @@
1307         struct hub_info*     hub;                     /** The hub instance this user belong to */
1308         int                  quit_reason;             /** Quit reason (see user_quit_reason) */
1309         struct ip_addr_encap ipaddr;                  /** IP address of connected user */
1310 -       struct user_counts   limits;                  /** Data used for limitation */
1311 +       struct uhub_user_counts   limits;                  /** Data used for limitation */
1312  #ifdef SSL_SUPPORT
1313         SSL*                 ssl;                     /** SSL handle */
1314  #endif /*  SSL_SUPPORT */
1315 @@ -137,19 +137,19 @@
1316   * @param sd socket descriptor associated with the user
1317   * @return User object or NULL if not enough memory is available.
1318   */
1319 -extern struct user* user_create(struct hub_info* hub, int sd);
1320 +extern struct uhub_user* user_create(struct hub_info* hub, int sd);
1321  
1322  /**
1323   * Delete a user.
1324   *
1325   * !WRONG! If the user is logged in a quit message is issued.
1326   */
1327 -extern void user_destroy(struct user* user);
1328 +extern void user_destroy(struct uhub_user* user);
1329  
1330  /**
1331   * Will post a message that will delete the user later.
1332   */
1333 -extern void user_schedule_destroy(struct user* user);
1334 +extern void user_schedule_destroy(struct uhub_user* user);
1335  
1336  /**
1337   * Disconnect a user.
1338 @@ -165,36 +165,36 @@
1339   * @param user User to disconnect
1340   * @param reason See enum user_quit_reason
1341   */
1342 -extern void user_disconnect(struct user* user, int reason);
1343 +extern void user_disconnect(struct uhub_user* user, int reason);
1344  
1345  /**
1346   * This associates a INF message to the user.
1347   * If the user already has a INF message associated, then this is
1348   * released before setting the new one.
1349   */
1350 -extern void user_set_info(struct user* user, struct adc_message* info);
1351 +extern void user_set_info(struct uhub_user* user, struct adc_message* info);
1352  
1353  /**
1354   * Specify a user's state.
1355   * NOTE: DON'T, unless you know what you are doing.
1356   */
1357 -extern void user_set_state(struct user* user, enum user_state);
1358 +extern void user_set_state(struct uhub_user* user, enum user_state);
1359  
1360  /**
1361   * Returns 1 if the user is in state state_normal, or 0 otherwise.
1362   */
1363 -extern int user_is_logged_in(struct user* user);
1364 +extern int user_is_logged_in(struct uhub_user* user);
1365  
1366  /**
1367   * Returns 1 if the user is in state_protocol, state_identify or state_verify.
1368   * Returns 0 otherwise.
1369   */
1370 -extern int user_is_connecting(struct user* user);
1371 +extern int user_is_connecting(struct uhub_user* user);
1372  
1373  /**
1374   * Returns 1 only if the user is in state_cleanup or state_disconnected.
1375   */
1376 -extern int user_is_disconnecting(struct user* user);
1377 +extern int user_is_disconnecting(struct uhub_user* user);
1378  
1379  /**
1380   * User supports the protocol extension as given in fourcc.
1381 @@ -204,7 +204,7 @@
1382   *
1383   * @see enum user_flags
1384   */
1385 -extern void user_support_add(struct user* user, int fourcc);
1386 +extern void user_support_add(struct uhub_user* user, int fourcc);
1387  
1388  /**
1389   * User no longer supports the protocol extension as given in fourcc.
1390 @@ -212,26 +212,26 @@
1391   * the hub.
1392   * @see enum user_flags
1393   */
1394 -extern void user_support_remove(struct user* user, int fourcc);
1395 +extern void user_support_remove(struct uhub_user* user, int fourcc);
1396  
1397  /**
1398   * Sets the nat override flag for a user, this allows users on the same
1399   * subnet as a natted hub to spoof their IP in order to use active mode
1400   * on a natted hub.
1401   */
1402 -extern void user_set_nat_override(struct user* user);
1403 -extern int user_is_nat_override(struct user* user);
1404 +extern void user_set_nat_override(struct uhub_user* user);
1405 +extern int user_is_nat_override(struct uhub_user* user);
1406  
1407  /**
1408   * Set a flag. @see enum user_flags
1409   */
1410 -extern void user_flag_set(struct user* user, enum user_flags flag);
1411 -extern void user_flag_unset(struct user* user, enum user_flags flag);
1412 +extern void user_flag_set(struct uhub_user* user, enum user_flags flag);
1413 +extern void user_flag_unset(struct uhub_user* user, enum user_flags flag);
1414  
1415  /**
1416   * Get a flag. @see enum user_flags
1417   */
1418 -extern int user_flag_get(struct user* user, enum user_flags flag);
1419 +extern int user_flag_get(struct uhub_user* user, enum user_flags flag);
1420  
1421  /**
1422   * Check if a user supports 'feature' for feature casting (basis for 'Fxxx' messages)
1423 @@ -241,7 +241,7 @@
1424   * @param feature a feature to lookup (example: 'TCP4' or 'UDP4')
1425   * @return 1 if 'feature' supported, or 0 otherwise
1426   */
1427 -extern int user_have_feature_cast_support(struct user* user, char feature[4]);
1428 +extern int user_have_feature_cast_support(struct uhub_user* user, char feature[4]);
1429  
1430  /**
1431   * Set feature cast support for feature.
1432 @@ -249,12 +249,12 @@
1433   * @param feature a feature to lookup (example: 'TCP4' or 'UDP4')
1434   * @return 1 if 'feature' supported, or 0 otherwise
1435   */
1436 -extern int user_set_feature_cast_support(struct user* u, char feature[4]);
1437 +extern int user_set_feature_cast_support(struct uhub_user* u, char feature[4]);
1438  
1439  /**
1440   * Remove all feature cast support features.
1441   */
1442 -extern void user_clear_feature_cast_support(struct user* u);
1443 +extern void user_clear_feature_cast_support(struct uhub_user* u);
1444  
1445  
1446  
1447 --- a/src/usermanager.c
1448 +++ b/src/usermanager.c
1449 @@ -27,7 +27,7 @@
1450  {
1451         if (ptr)
1452         {
1453 -               struct user* u = (struct user*) ptr;
1454 +               struct uhub_user* u = (struct uhub_user*) ptr;
1455                 
1456                 /* Mark the user as already being disconnected.
1457                  * This prevents the hub from trying to send
1458 @@ -81,10 +81,10 @@
1459  
1460  int user_manager_init(struct hub_info* hub)
1461  {
1462 -       struct user_manager* users = NULL;
1463 +       struct uhub_user_manager* users = NULL;
1464         struct timeval timeout = { TIMEOUT_STATS, 0 };
1465  
1466 -       users = (struct user_manager*) hub_malloc_zero(sizeof(struct user_manager));
1467 +       users = (struct uhub_user_manager*) hub_malloc_zero(sizeof(struct uhub_user_manager));
1468  
1469         users->list = list_create();
1470         users->free_sid = 1;
1471 @@ -106,7 +106,7 @@
1472  
1473  void user_manager_shutdown(struct hub_info* hub)
1474  {
1475 -       struct user_manager* users = hub->users;
1476 +       struct uhub_user_manager* users = hub->users;
1477         event_del(&hub->ev_timer);
1478  
1479         list_clear(users->list, &clear_user_list_callback);
1480 @@ -115,7 +115,7 @@
1481  }
1482  
1483  
1484 -void user_manager_add(struct user* user)
1485 +void user_manager_add(struct uhub_user* user)
1486  {
1487         list_append(user->hub->users->list, user);
1488         user->hub->users->count++;
1489 @@ -125,7 +125,7 @@
1490         user->hub->users->shared_files += user->limits.shared_files;
1491  }
1492  
1493 -void user_manager_remove(struct user* user)
1494 +void user_manager_remove(struct uhub_user* user)
1495  {
1496         list_remove(user->hub->users->list, user);
1497         user->hub->users->count--;
1498 @@ -135,50 +135,50 @@
1499  }
1500  
1501  
1502 -struct user* get_user_by_sid(struct hub_info* hub, sid_t sid)
1503 +struct uhub_user* get_user_by_sid(struct hub_info* hub, sid_t sid)
1504  {
1505 -       struct user* user = (struct user*) list_get_first(hub->users->list); /* iterate users */
1506 +       struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate users */
1507         while (user)
1508         {
1509                 if (user->id.sid == sid)
1510                         return user;
1511 -               user = (struct user*) list_get_next(hub->users->list);
1512 +               user = (struct uhub_user*) list_get_next(hub->users->list);
1513         }
1514         return NULL;
1515  }
1516  
1517  
1518 -struct user* get_user_by_cid(struct hub_info* hub, const char* cid)
1519 +struct uhub_user* get_user_by_cid(struct hub_info* hub, const char* cid)
1520  {
1521 -       struct user* user = (struct user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
1522 +       struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
1523         while (user)
1524         {
1525                 if (strcmp(user->id.cid, cid) == 0)
1526                         return user;
1527 -               user = (struct user*) list_get_next(hub->users->list);
1528 +               user = (struct uhub_user*) list_get_next(hub->users->list);
1529         }
1530         return NULL;
1531  }
1532  
1533  
1534 -struct user* get_user_by_nick(struct hub_info* hub, const char* nick)
1535 +struct uhub_user* get_user_by_nick(struct hub_info* hub, const char* nick)
1536  {
1537 -       struct user* user = (struct user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
1538 +       struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
1539         while (user)
1540         {
1541                 if (strcmp(user->id.nick, nick) == 0)
1542                         return user;
1543 -               user = (struct user*) list_get_next(hub->users->list);
1544 +               user = (struct uhub_user*) list_get_next(hub->users->list);
1545         }
1546         return NULL;
1547  }
1548  
1549  
1550 -int send_user_list(struct user* target)
1551 +int send_user_list(struct uhub_user* target)
1552  {
1553         int ret = 1;
1554         user_flag_set(target, flag_user_list);
1555 -       struct user* user = (struct user*) list_get_first(target->hub->users->list); /* iterate users - only on INF or PAS msg */
1556 +       struct uhub_user* user = (struct uhub_user*) list_get_first(target->hub->users->list); /* iterate users - only on INF or PAS msg */
1557         while (user)
1558         {
1559                 if (user_is_logged_in(user))
1560 @@ -187,7 +187,7 @@
1561                         if (!ret)
1562                                 break;
1563                 }
1564 -               user = (struct user*) list_get_next(user->hub->users->list);
1565 +               user = (struct uhub_user*) list_get_next(user->hub->users->list);
1566         }
1567         
1568         if (!target->send_queue_size)
1569 @@ -198,7 +198,7 @@
1570  }
1571  
1572  
1573 -void send_quit_message(struct user* leaving)
1574 +void send_quit_message(struct uhub_user* leaving)
1575  {
1576         struct adc_message* command = adc_msg_construct(ADC_CMD_IQUI, 6);
1577         adc_msg_add_argument(command, (const char*) sid_to_string(leaving->id.sid));
1578 @@ -216,8 +216,8 @@
1579  sid_t user_manager_get_free_sid(struct hub_info* hub)
1580  {
1581  #if 0
1582 -       struct user* user;
1583 -       user = (struct user*) list_get_first(hub->users->list); /* iterate normal users */
1584 +       struct uhub_user* user;
1585 +       user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate normal users */
1586         while (user)
1587         {
1588                 if (user->sid == hub->users->free_sid)
1589 @@ -226,7 +226,7 @@
1590                         if (hub->users->free_sid >= SID_MAX) hub->users->free_sid = 1;
1591                         break;
1592                 }
1593 -               user = (struct user*) list_get_next(hub->users->list);
1594 +               user = (struct uhub_user*) list_get_next(hub->users->list);
1595         }
1596  #endif
1597         return hub->users->free_sid++;
1598 --- a/src/usermanager.h
1599 +++ b/src/usermanager.h
1600 @@ -20,7 +20,7 @@
1601  #ifndef HAVE_UHUB_USER_MANAGER_H
1602  #define HAVE_UHUB_USER_MANAGER_H
1603  
1604 -struct user_manager
1605 +struct uhub_user_manager
1606  {
1607         size_t count;                   /**<< "Number of all fully connected and logged in users" */
1608         size_t count_peak;              /**<< "Peak number of users" */
1609 @@ -51,14 +51,14 @@
1610  /**
1611   * Add a new user to the user manager.
1612   */
1613 -extern void user_manager_add(struct user* user);
1614 +extern void user_manager_add(struct uhub_user* user);
1615  
1616  /**
1617   * Remove a user from the user manager.
1618   * This user is connected, and will be moved to the leaving queue, pending
1619   * all messages in the message queue, and resource cleanup.
1620   */
1621 -extern void user_manager_remove(struct user* user);
1622 +extern void user_manager_remove(struct uhub_user* user);
1623  
1624  /**
1625   * Returns a free sid for a new user.
1626 @@ -70,19 +70,19 @@
1627   * NOTE: This will only search connected users.
1628   * @return a user if found, or NULL if not found
1629   */
1630 -extern struct user* get_user_by_sid(struct hub_info* hub, sid_t sid);
1631 +extern struct uhub_user* get_user_by_sid(struct hub_info* hub, sid_t sid);
1632  
1633  /**
1634   * Lookup a user based on the client ID (cid).
1635   * @return a user if found, or NULL if not found
1636   */
1637 -extern struct user* get_user_by_cid(struct hub_info* hub, const char* cid);
1638 +extern struct uhub_user* get_user_by_cid(struct hub_info* hub, const char* cid);
1639  
1640  /**
1641   * Lookup a user based on the nick name.
1642   * @return a user if found, or NULL if not found
1643   */
1644 -extern struct user* get_user_by_nick(struct hub_info* hub, const char* nick);
1645 +extern struct uhub_user* get_user_by_nick(struct hub_info* hub, const char* nick);
1646  
1647  /**
1648   * Send the user list of connected clients to 'user'.
1649 @@ -90,13 +90,13 @@
1650   *
1651   * @return 1 if sending the user list succeeded, 0 otherwise.
1652   */
1653 -extern int send_user_list(struct user* user);
1654 +extern int send_user_list(struct uhub_user* user);
1655  
1656  /**
1657   * Send a quit message to all connected users when 'user' is
1658   * leaving the hub (for whatever reason).
1659   */
1660 -extern void send_quit_message(struct user* user);
1661 +extern void send_quit_message(struct uhub_user* user);
1662  
1663  
1664  #endif /* HAVE_UHUB_USER_MANAGER_H */