Integer type name change.
[silc.git] / apps / irssi / src / silc / core / silc-servers.c
index cb41470edfca631dffacfee201f73dd5c8f692f6..03ccd79f7426e2c27bc9a24706e65bac7b7556c1 100644 (file)
@@ -71,7 +71,7 @@ typedef struct {
 static void silc_send_msg_clients(SilcClient client,
                                  SilcClientConnection conn,
                                  SilcClientEntry *clients,
-                                 uint32 clients_count,
+                                 SilcUInt32 clients_count,
                                  void *context)
 {
   PRIVMSG_REC *rec = context;
@@ -128,7 +128,7 @@ static void silc_send_msg(SILC_SERVER_REC *server, char *nick, char *msg)
 {
   PRIVMSG_REC *rec;
   SilcClientEntry *clients;
-  uint32 clients_count;
+  SilcUInt32 clients_count;
   char *nickname = NULL;
 
   if (!silc_parse_userfqdn(nick, &nickname, NULL)) {
@@ -164,9 +164,9 @@ static int isnickflag_func(char flag)
   return flag == '@' || flag == '+';
 }
 
-static int ischannel_func(const char *data)
+static int ischannel_func(SERVER_REC *server, const char *data)
 {
-  return *data == '#';
+  return FALSE;
 }
 
 const char *get_nick_flags(void)
@@ -174,13 +174,14 @@ const char *get_nick_flags(void)
   return "@\0\0";
 }
 
-static void send_message(SILC_SERVER_REC *server, char *target, char *msg)
+static void send_message(SILC_SERVER_REC *server, char *target,
+                        char *msg, int target_type)
 {
   g_return_if_fail(server != NULL);
   g_return_if_fail(target != NULL);
   g_return_if_fail(msg != NULL);
 
-  if (*target == '#')
+  if (target_type == SEND_TARGET_CHANNEL)
     silc_send_channel(server, target, msg);
   else
     silc_send_msg(server, target, msg);
@@ -246,8 +247,10 @@ SILC_SERVER_REC *silc_server_connect(SILC_SERVER_CONNECT_REC *conn)
   if (server->connrec->port <= 0) 
     server->connrec->port = 706;
 
+  server_connect_ref(SERVER_CONNECT(conn));
+
   if (!server_start_connect((SERVER_REC *) server)) {
-    server_connect_free(SERVER_CONNECT(conn));
+    server_connect_unref(SERVER_CONNECT(conn));
     g_free(server);
     return NULL;
   }
@@ -324,9 +327,9 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 void silc_command_exec(SILC_SERVER_REC *server,
                       const char *command, const char *args)
 {
-  uint32 argc = 0;
+  SilcUInt32 argc = 0;
   unsigned char **argv;
-  uint32 *argv_lens, *argv_types;
+  SilcUInt32 *argv_lens, *argv_types;
   char *data, *tmpcmd;
   SilcClientCommand cmd;
   SilcClientCommandContext ctx;
@@ -396,23 +399,6 @@ static void command_sconnect(const char *data, SILC_SERVER_REC *server)
   signal_stop();
 }
 
-static void event_text(const char *line, SILC_SERVER_REC *server,
-                      WI_ITEM_REC *item)
-{
-  char *str;
-
-  g_return_if_fail(line != NULL);
-
-  if (!IS_SILC_ITEM(item))
-    return;
-
-  str = g_strdup_printf("%s %s", item->name, line);
-  signal_emit("command msg", 3, str, server, item);
-  g_free(str);
-
- signal_stop();
-}
-
 /* FILE command */
 
 SILC_TASK_CALLBACK(silc_client_file_close_later)
@@ -430,10 +416,10 @@ static void silc_client_file_monitor(SilcClient client,
                                     SilcClientConnection conn,
                                     SilcClientMonitorStatus status,
                                     SilcClientFileError error,
-                                    uint64 offset,
-                                    uint64 filesize,
+                                    SilcUInt64 offset,
+                                    SilcUInt64 filesize,
                                     SilcClientEntry client_entry,
-                                    uint32 session_id,
+                                    SilcUInt32 session_id,
                                     const char *filepath,
                                     void *context)
 {
@@ -546,7 +532,7 @@ typedef struct {
 static void silc_client_command_file_get_clients(SilcClient client,
                                                 SilcClientConnection conn,
                                                 SilcClientEntry *clients,
-                                                uint32 clients_count,
+                                                SilcUInt32 clients_count,
                                                 void *context)
 {
   FileGetClients internal = (FileGetClients)context;
@@ -574,16 +560,16 @@ static void command_file(const char *data, SILC_SERVER_REC *server,
   SilcClientConnection conn;
   SilcClientEntry *entrys, client_entry;
   SilcClientFileError ret;
-  uint32 entry_count;
+  SilcUInt32 entry_count;
   char *nickname = NULL, *tmp;
   unsigned char **argv;
-  uint32 argc;
-  uint32 *argv_lens, *argv_types;
+  SilcUInt32 argc;
+  SilcUInt32 *argv_lens, *argv_types;
   int type = 0;
   FtpSession ftp;
   char *local_ip = NULL;
-  uint32 local_port = 0;
-  uint32 session_id;
+  SilcUInt32 local_port = 0;
+  SilcUInt32 session_id;
 
   if (!server || !IS_SILC_SERVER(server) || !server->connected)
     cmd_return_error(CMDERR_NOT_CONNECTED);
@@ -837,8 +823,8 @@ static void command_file(const char *data, SILC_SERVER_REC *server,
                         MSGLEVEL_CRAP, SILCTXT_FILE_SHOW_LINE,
                         ftp->client_entry->nickname, 
                         ftp->send ? "send" : "receive",
-                        (uint32)(ftp->offset + 1023) / 1024,
-                        (uint32)(ftp->filesize + 1023) / 1024,
+                        (SilcUInt32)(ftp->offset + 1023) / 1024,
+                        (SilcUInt32)(ftp->filesize + 1023) / 1024,
                         ftp->percent, ftp->kps,
                         ftp->filepath ? ftp->filepath : "[N/A]");
     }
@@ -859,7 +845,6 @@ void silc_server_init(void)
 
   signal_add_first("server connected", (SIGNAL_FUNC) sig_connected);
   signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected);
-  signal_add("send text", (SIGNAL_FUNC) event_text);
   command_bind("whois", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("whowas", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("nick", MODULE_NAME, (SIGNAL_FUNC) command_self);
@@ -893,7 +878,6 @@ void silc_server_deinit(void)
 
   signal_remove("server connected", (SIGNAL_FUNC) sig_connected);
   signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
-  signal_remove("send text", (SIGNAL_FUNC) event_text);
   command_unbind("whois", (SIGNAL_FUNC) command_self);
   command_unbind("whowas", (SIGNAL_FUNC) command_self);
   command_unbind("nick", (SIGNAL_FUNC) command_self);