SILC_FSM_* macro API changes.
[silc.git] / lib / silcclient / client_register.c
index c5f4cfc95dbe5a61ce4912ab631beb7e53d0c4e5..ae5de0011b6243a6a15c5e4b042b6ae4eb0ff1a5 100644 (file)
@@ -258,7 +258,7 @@ SILC_FSM_STATE(silc_client_st_register_error)
   /* Signal to close connection */
   if (!conn->internal->disconnected) {
     conn->internal->disconnected = TRUE;
-    SILC_FSM_SEMA_POST(&conn->internal->wait_event);
+    SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
   }
 
   /* Call connect callback */
@@ -382,6 +382,9 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_channels)
     return SILC_FSM_CONTINUE;
   }
 
+  /** Wait for channels */
+  silc_fsm_next(fsm, silc_client_st_resume_resolve_cmodes);
+
   /* Change our nickname */
   silc_client_change_nickname(client, conn, conn->local_entry,
                              resume->nickname, NULL, NULL, 0);
@@ -393,6 +396,9 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_channels)
                           1, 1, silc_buffer_data(conn->internal->local_idp),
                           silc_buffer_len(conn->internal->local_idp));
 
+  if (!resume->channel_count)
+    return SILC_FSM_YIELD;
+
   /* Send IDENTIFY command for all channels we know about.  These are the
      channels we've joined to according our detachment data. */
   for (i = 0; i < resume->channel_count; i++) {
@@ -447,8 +453,6 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_channels)
   silc_free(res_argv_lens);
   silc_free(res_argv_types);
 
-  /** Wait for channels */
-  silc_fsm_next(fsm, silc_client_st_resume_resolve_cmodes);
   return SILC_FSM_WAIT;
 }
 
@@ -476,7 +480,7 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_cmodes)
   silc_fsm_next(fsm, silc_client_st_resume_completed);
 
   if (!silc_idcache_get_all(conn->internal->channel_cache, &channels))
-    return SILC_FSM_CONTINUE;
+    return SILC_FSM_YIELD;
 
   /* Resolve channels' mode, users and topic */
   resume->channel_count = silc_list_count(channels) * 3;
@@ -548,6 +552,11 @@ SILC_FSM_STATE(silc_client_st_resume_completed)
   conn->callback(client, conn, SILC_CLIENT_CONN_SUCCESS_RESUME, 0, NULL,
                 conn->callback_context);
 
+  /* Call UMODE command reply. */
+  if (conn->local_entry->mode)
+    silc_client_resume_command_callback(client, conn, SILC_COMMAND_UMODE,
+                                       conn->local_entry->mode);
+
   /* Call NICK command reply. */
   silc_client_resume_command_callback(client, conn, SILC_COMMAND_NICK,
                                      conn->local_entry,
@@ -562,8 +571,8 @@ SILC_FSM_STATE(silc_client_st_resume_completed)
     const char *cipher, *hmac;
 
     channel = entry->context;
-    cipher = (channel->internal.channel_key ?
-             silc_cipher_get_name(channel->internal.channel_key) : NULL);
+    cipher = (channel->internal.send_key ?
+             silc_cipher_get_name(channel->internal.send_key) : NULL);
     hmac = (channel->internal.hmac ?
            silc_hmac_get_name(channel->internal.hmac) : NULL);
     silc_hash_table_list(channel->user_list, &htl);
@@ -606,7 +615,7 @@ SILC_FSM_STATE(silc_client_st_resume_error)
   /* Signal to close connection */
   if (!conn->internal->disconnected) {
     conn->internal->disconnected = TRUE;
-    SILC_FSM_SEMA_POST(&conn->internal->wait_event);
+    SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
   }
 
   /* Call connect callback */