voice storage bugfix, probably

This commit is contained in:
nohar 2005-11-16 18:34:25 +00:00
parent 486f28db9a
commit b039415b93
3 changed files with 56 additions and 27 deletions

3
TODO
View File

@ -9,3 +9,6 @@ Before release:
TODO:
- DCC proxying...
- crypt logs
- use gnutls
- MODE #channel and WHO #channel on join

View File

@ -157,7 +157,7 @@ static void connect_trynext(connection_t *cn)
close(cn->handle);
cn->handle = -1;
}
cn->connected = CONN_ERROR;
connecting_data_free(cn->connecting_data);
cn->connecting_data = NULL;
@ -168,7 +168,7 @@ static void connect_trynext(connection_t *cn)
static X509 *mySSL_get_cert(SSL *ssl)
{
X509 *cert;
if (!ssl) {
mylog(LOG_WARN, "mySSL_get_cert() No SSL context");
return NULL;
@ -1070,12 +1070,12 @@ static connection_t *_connection_new(char *dsthostname, char *dstport,
char *srchostname, char *srcport, int timeout)
{
connection_t *conn;
printf("%s\n", dsthostname);
conn = connection_init(1, 0, timeout, 0);
create_socket(dsthostname, dstport, srchostname, srcport, conn);
return conn;
}
@ -1352,10 +1352,10 @@ static connection_t *_connection_new_SSL(char *dsthostname, char *dstport,
" most recent used");
*/
SSL_set_connect_state(conn->ssl_h);
/* Put our connection_t in the SSL object for the verify callback */
SSL_set_ex_data(conn->ssl_h, ssl_cx_idx, conn);
create_socket(dsthostname, dstport, srchostname, srcport, conn);
return conn;

View File

@ -165,10 +165,10 @@ list_t *channel_name_list(struct channel *c)
strncat(str, " ", NAMESIZE);
len++;
}
if (n->ovmask == NICKOP) {
if (n->ovmask & NICKOP) {
strncat(str, "@", NAMESIZE);
len++;
} else if (n->ovmask == NICKVOICED) {
} else if (n->ovmask & NICKVOICED) {
strncat(str, "+", NAMESIZE);
len++;
}
@ -309,6 +309,16 @@ static void irc_server_connected(struct link_server *server)
}
}
static int who_arg_to_ovmask(char *str)
{
int ovmask = 0;
if (strchr(str, '@'))
ovmask |= NICKOP;
if (strchr(str, '+'))
ovmask |= NICKVOICED;
return ovmask;
}
/*
* Given the way irc nets disrespect the rfc, maybe we should completely forget
* about this damn ircmask...
@ -317,22 +327,40 @@ static void irc_server_connected(struct link_server *server)
static int parse_352(struct link_server *server, struct line *line)
{
char *im;
int ret = OK_FORGET;
if (line->elemc < 4)
return ERR_PROTOCOL;
if (strcmp(line->elemv[1], server->nick) != 0)
return ret;
im = malloc(strlen(server->nick) + strlen(line->elemv[3]) +
strlen(line->elemv[4]) + 2 + 1);
strcpy(im, server->nick);
strcat(im, "!");
strcat(im, line->elemv[3]);
strcat(im, "@");
strcat(im, line->elemv[4]);
set_ircmask(server, im);
free(im);
return ret;
if (line->elemc < 8)
return ERR_PROTOCOL;
if (strcmp(line->elemv[2], "*") == 0) {
if (server->irc_mask &&
strcmp(line->elemv[1], server->nick) == 0) {
im = malloc(strlen(server->nick) +
strlen(line->elemv[3]) +
strlen(line->elemv[4]) + 2 + 1);
strcpy(im, server->nick);
strcat(im, "!");
strcat(im, line->elemv[3]);
strcat(im, "@");
strcat(im, line->elemv[4]);
set_ircmask(server, im);
free(im);
return OK_FORGET;
}
} else {
struct channel *channel;
struct nick *nick;
channel = hash_get(&server->channels, line->elemv[2]);
if (!channel)
return OK_COPY;
nick = hash_get(&channel->nicks, line->elemv[6]);
if (!nick)
return OK_COPY;
nick->ovmask = who_arg_to_ovmask(line->elemv[7]);
}
return OK_COPY;
}
/*
@ -346,10 +374,6 @@ int irc_dispatch_server(struct link_server *server, struct line *line)
if (line->elemc == 0)
return ERR_PROTOCOL;
if (!server->irc_mask &&
strcmp(line->elemv[0], "352") == 0) /* WHO RPL */
ret = parse_352(server, line);
if (strcmp(line->elemv[0], "PING") == 0) {
if (line->elemc < 2)
return ERR_PROTOCOL;
@ -421,6 +445,8 @@ int irc_dispatch_server(struct link_server *server, struct line *line)
ret = irc_332(server, line);
} else if (strcmp(line->elemv[0], "333") == 0) {
ret = irc_333(server, line);
} else if (strcmp(line->elemv[0], "352") == 0) {
ret = parse_352(server, line);
} else if (strcmp(line->elemv[0], "353") == 0) {
ret = irc_353(server, line);
} else if (strcmp(line->elemv[0], "366") == 0) {