char message[4096];
SilcClientEntry client_entry, client_entry2;
SilcChannelEntry channel_entry;
- char *tmp;
+ char *tmp = NULL;
unsigned int tmp_int;
va_start(vp, type);
case SILC_NOTIFY_TYPE_SIGNOFF:
client_entry = va_arg(vp, SilcClientEntry);
+ tmp = va_arg(vp, char *);
if (client_entry->server)
- snprintf(message, sizeof(message), "Signoff: %s@%s",
- client_entry->nickname, client_entry->server);
+ snprintf(message, sizeof(message), "Signoff: %s@%s %s%s%s",
+ client_entry->nickname, client_entry->server,
+ tmp ? "(" : "", tmp ? tmp : "", tmp ? ")" : "");
else
- snprintf(message, sizeof(message), "Signoff: %s",
- client_entry->nickname);
+ snprintf(message, sizeof(message), "Signoff: %s %s%s%s",
+ client_entry->nickname,
+ tmp ? "(" : "", tmp ? tmp : "", tmp ? ")" : "");
break;
case SILC_NOTIFY_TYPE_TOPIC_SET:
client_entry2 = va_arg(vp, SilcClientEntry);
channel_entry = va_arg(vp, SilcChannelEntry);
if (tmp)
- snprintf(message, sizeof(message), "%s changed %s mode to +%s",
+ snprintf(message, sizeof(message), "%s changed %s's mode to +%s",
client_entry->nickname, client_entry2->nickname, tmp);
else
- snprintf(message, sizeof(message), "%s removed %s modes",
+ snprintf(message, sizeof(message), "%s removed %s's modes",
client_entry->nickname, client_entry2->nickname);
if (client_entry2 == conn->local_entry) {
if (app->screen->bottom_line->mode)
case SILC_NOTIFY_TYPE_CHANNEL_CHANGE:
break;
+ case SILC_NOTIFY_TYPE_KICKED:
+ client_entry = va_arg(vp, SilcClientEntry);
+ tmp = va_arg(vp, char *);
+ channel_entry = va_arg(vp, SilcChannelEntry);
+
+ if (client_entry == conn->local_entry) {
+ snprintf(message, sizeof(message),
+ "You have been kicked off channel %s %s%s%s",
+ conn->current_channel->channel_name,
+ tmp ? "(" : "", tmp ? tmp : "", tmp ? ")" : "");
+ } else {
+ snprintf(message, sizeof(message),
+ "%s%s%s has been kicked off channel %s %s%s%s",
+ client_entry->nickname,
+ client_entry->server ? "@" : "",
+ client_entry->server ? client_entry->server : "",
+ conn->current_channel->channel_name,
+ tmp ? "(" : "", tmp ? tmp : "", tmp ? ")" : "");
+ }
+ break;
+
default:
break;
}
}
}
+/* We've resolved all clients we don't know about, now just print the
+ users from the channel on the screen. */
+
+void silc_client_show_users(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientEntry *clients,
+ unsigned int clients_count,
+ void *context)
+{
+ SilcChannelEntry channel = (SilcChannelEntry)context;
+ SilcChannelUser chu;
+ int k = 0, len1 = 0, len2 = 0;
+ char *name_list = NULL;
+
+ if (!clients)
+ return;
+
+ silc_list_start(channel->clients);
+ while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
+ char *m, *n = chu->client->nickname;
+ len2 = strlen(n);
+ len1 += len2;
+
+ name_list = silc_realloc(name_list, sizeof(*name_list) * (len1 + 3));
+
+ m = silc_client_chumode_char(chu->mode);
+ if (m) {
+ memcpy(name_list + (len1 - len2), m, strlen(m));
+ len1 += strlen(m);
+ silc_free(m);
+ }
+
+ memcpy(name_list + (len1 - len2), n, len2);
+ name_list[len1] = 0;
+
+ if (k == silc_list_count(channel->clients) - 1)
+ break;
+ memcpy(name_list + len1, " ", 1);
+ len1++;
+ k++;
+ }
+
+ client->ops->say(client, conn, "Users on %s: %s", channel->channel_name,
+ name_list);
+ silc_free(name_list);
+}
+
/* Command reply handler. This function is called always in the command reply
function. If error occurs it will be called as well. Normal scenario
is that it will be called after the received command data has been parsed
case SILC_COMMAND_JOIN:
{
unsigned int mode;
+ char *topic;
+ SilcBuffer client_id_list;
+ unsigned int list_count;
+ SilcChannelEntry channel;
app->screen->bottom_line->channel = va_arg(vp, char *);
- (void)va_arg(vp, void *);
+ channel = va_arg(vp, SilcChannelEntry);
mode = va_arg(vp, unsigned int);
+ (void)va_arg(vp, unsigned int);
+ (void)va_arg(vp, unsigned char *);
+ (void)va_arg(vp, unsigned char *);
+ (void)va_arg(vp, unsigned char *);
+ topic = va_arg(vp, char *);
+ (void)va_arg(vp, unsigned char *);
+ list_count = va_arg(vp, unsigned int);
+ client_id_list = va_arg(vp, SilcBuffer);
+
+ if (topic)
+ client->ops->say(client, conn, "Topic for %s: %s",
+ app->screen->bottom_line->channel, topic);
+
app->screen->bottom_line->channel_mode = silc_client_chmode(mode);
silc_screen_print_bottom_line(app->screen, 0);
+
+ /* Resolve the client information */
+ silc_client_get_clients_by_list(client, conn, list_count,
+ client_id_list,
+ silc_client_show_users, channel);
}
break;
void silc_failure(SilcClient client, SilcClientConnection conn,
SilcProtocol protocol, void *failure)
{
- SilcClientInternal app = (SilcClientInternal)client->application;
}
+/* Asks whether the user would like to perform the key agreement protocol.
+ This is called after we have received an key agreement packet or an
+ reply to our key agreement packet. This returns TRUE if the user wants
+ the library to perform the key agreement protocol and FALSE if it is not
+ desired (application may start it later by calling the function
+ silc_client_perform_key_agreement). */
+
+int silc_key_agreement(SilcClient client, SilcClientConnection conn,
+ SilcClientEntry client_entry, char *hostname,
+ int port,
+ SilcKeyAgreementCallback *completion,
+ void **context)
+{
+
+ return FALSE;
+}
+
/* SILC client operations */
SilcClientOperations ops = {
say: silc_say,
verify_server_key: silc_verify_server_key,
ask_passphrase: silc_ask_passphrase,
failure: silc_failure,
+ key_agreement: silc_key_agreement,
};