return;
nick = silc_nicklist_find(chanrec, sender);
+ if (!nick) {
+ /* We didn't find client but it clearly exists, add it. */
+ SilcChannelUser chu;
+
+ silc_list_start(channel->clients);
+ while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
+ if (chu->client == sender) {
+ nick = silc_nicklist_insert(chanrec, chu, FALSE);
+ break;
+ }
+ }
+ }
if (flags & SILC_MESSAGE_FLAG_ACTION)
printformat_module("fe-common/silc", server, channel->channel_name,
{
SILC_SERVER_REC *server = conn->context;
+ if (server->conn) {
+ nicklist_rename_unique(SERVER(server),
+ server->conn->local_entry, server->nick,
+ server->conn->local_entry,
+ silc_client->username);
+ silc_change_nick(server, silc_client->username);
+ }
+
server->conn->context = NULL;
server->conn = NULL;
server->connection_lost = TRUE;
silc_list_start(channel->clients);
while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
+ if (!chu->client->nickname)
+ continue;
if (chu->mode & SILC_CHANNEL_UMODE_CHANFO)
founder = chu->client;
silc_nicklist_insert(chanrec, chu, FALSE);
}
}
+typedef struct {
+ SilcClient client;
+ SilcClientConnection conn;
+ void *entry;
+ SilcIdType id_type;
+ char *fingerprint;
+} *GetkeyContext;
+
+void silc_getkey_cb(bool success, void *context)
+{
+ GetkeyContext getkey = (GetkeyContext)context;
+ char *entity = (getkey->id_type == SILC_ID_CLIENT ? "user" : "server");
+ char *name = (getkey->id_type == SILC_ID_CLIENT ?
+ ((SilcClientEntry)getkey->entry)->nickname :
+ ((SilcServerEntry)getkey->entry)->server_name);
+
+ if (success) {
+ printformat_module("fe-common/silc", NULL, NULL,
+ MSGLEVEL_CRAP, SILCTXT_GETKEY_VERIFIED, entity, name);
+ } else {
+ printformat_module("fe-common/silc", NULL, NULL,
+ MSGLEVEL_CRAP, SILCTXT_GETKEY_DISCARD, entity, name);
+ }
+
+ silc_free(getkey->fingerprint);
+ silc_free(getkey);
+}
+
/* 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
}
mode = silc_client_chmode(modei,
- channel_entry->channel_key->cipher->name,
- channel_entry->hmac->hmac->name);
+ channel_entry->channel_key ?
+ channel_entry->channel_key->cipher->name : "",
+ channel_entry->hmac ?
+ silc_hmac_get_name(channel_entry->hmac) : "");
g_free_not_null(chanrec->mode);
chanrec->mode = g_strdup(mode == NULL ? "" : mode);
signal_emit("channel mode changed", 1, chanrec);
while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
SilcClientEntry e = chu->client;
char stat[5], *mode;
+
+ if (!e->nickname)
+ continue;
memset(stat, 0, sizeof(stat));
mode = silc_client_chumode_char(chu->mode);
printformat_module("fe-common/silc", server, channel->channel_name,
MSGLEVEL_CRAP, SILCTXT_USERS,
- e->nickname, stat, e->username,
- e->hostname, e->realname ? e->realname : "");
+ e->nickname, stat,
+ e->username ? e->username : "",
+ e->hostname ? e->hostname : "",
+ e->realname ? e->realname : "");
if (mode)
silc_free(mode);
}
SilcPublicKey public_key;
unsigned char *pk;
uint32 pk_len;
+ GetkeyContext getkey;
if (!success)
return;
if (public_key) {
pk = silc_pkcs_public_key_encode(public_key, &pk_len);
+
+ getkey = silc_calloc(1, sizeof(*getkey));
+ getkey->entry = entry;
+ getkey->id_type = id_type;
+ getkey->client = client;
+ getkey->conn = conn;
+ getkey->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
silc_verify_public_key_internal(client, conn,
(id_type == SILC_ID_CLIENT ?
SILC_SOCKET_TYPE_CLIENT :
SILC_SOCKET_TYPE_SERVER),
pk, pk_len, SILC_SKE_PK_TYPE_SILC,
- NULL, NULL);
+ silc_getkey_cb, getkey);
silc_free(pk);
} else {
printformat_module("fe-common/silc", server, NULL,
int silc_key_agreement(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, char *hostname,
- int port,
- SilcKeyAgreementCallback *completion,
+ uint16 port, SilcKeyAgreementCallback *completion,
void **context)
{
char portstr[12];