Commit f6491ff3 authored by stettberger's avatar stettberger

Release 0.1

parent 047ac65a
This diff is collapsed.
CC=gcc
prefix=/usr/local
DESTDIR=
TARGET=si
SILCINCLUDE=/usr/local/silc/include
SILCLIB=/usr/local/silc/lib
FILES=si.c mit.c
CFLAGS=-I/usr/local/silc/include -Wall -ggdb
LDFLAGS=-L/usr/local/silc/lib -lsilc -lsilcclient -lpthread -ldl
CFLAGS=-I${SILCINCLUDE} -Wall -ggdb
LDFLAGS=-L${SILCLIB} -lsilc -lsilcclient -lpthread -ldl
all: ${TARGET}
${TARGET}: ${TARGET}.o
......@@ -12,3 +17,5 @@ ${TARGET}.o: ${FILES}
clean:
rm -f ${TARGET} *~ *.o *core
mit: mit.c
install:
install ${TARGET} ${DESTDIR}/${prefix}/bin
\ No newline at end of file
L I C E N S E :=
Copyright(C) 2006 Christian Dietrich <stettberger@gmx.de>
si - silc imporved
Some parts of the Code are NOT under GPL. They are licensed unter MIT/X.
They could be found in the mit.c file.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
F O R E W O R D :=
behind si is an other idea, than behind other chat clients. he has an very
simple design, because all the I/O with the user is done through files and
fifos. so in its basic variant it isn't so comfortabel, but you can write your
own scripts around it or use systems other people had written.
The SILC protocol is very similar to the IRC protocol, but the main difference
is that in SILC all messages are encrypted on the whole way. SILC has also many
advantages to irc, like watches or not unique nicknames ( no nickwars )
si is very untested code, so you will find bugs. In case you do so,
please don't hesitate to fix them. In case you are not able to do so,
try to describe it in detail. In detail. And watch out, whether the
CVS version already has it fixed.
besides all the untested code, i think it is usable (for me, at least)
I N S T A L A T I O N :=
first you had to install libsilc (http://silcnet.org)
cd $sourcedir
make
make install (as root)
When your SILC includes/libs are not in /usr/local/silc you had to specify them like
this
make SILCINCLUDE=/path/to/silc/include SILCLIB=/path/to/silc/lib
I F I T D O E S N O T W O R K :=
please contact me at <stettberger@gmx.de>, but be patient.
L A S T B U T N O T L E A S T :=
your contributions are welcome,
please help in improving si.
* Notify Types
SILC_NOTIFY_TYPE_INVITE
SILC_NOTIFY_TYPE_SERVER_SIGNOFF
SILC_NOTIFY_TYPE_BAN
* Command Replies
SILC_COMMAND_WHOWAS
SILC_COMMAND_IDENTIFY
SILC_COMMAND_INVITE
SILC_COMMAND_KILL
SILC_COMMAND_OPER
SILC_COMMAND_KICK
SILC_COMMAND_BAN
SILC_COMMAND_DETACH
SILC_COMMAND_WATCH
SILC_COMMAND_SILCOPER
SILC_COMMAND_SERVICE
......@@ -208,7 +208,7 @@ void rm_transfer(Transfer *t) {
}
else
for (tmp=transfers; tmp; tmp=tmp->next)
if(tmp->id==t->id)
if(tmp->next->id==t->id)
tmp->next=t->next;
free(t);
}
......
......@@ -33,7 +33,7 @@
#include <time.h>
/* {{{ Structs, Globals Declarations */
#define VERSION "0.1 beta"
#define VERSION "0.1"
#define NULL_TEST(a) if(!(a)){perror("si: Couldn't allocate memory"); return;}
#define NULL_TEST_ARG(a,b) if(!(a)){perror("si: Couldn't allocate memory"); return (b);}
......@@ -272,13 +272,15 @@ void proc_channels_input(Channel *c, char *buf) {
(unsigned char *)&msg[4],len,TRUE);
print_out(c->silc->channel_name, "%s* %s %s", silc_client->sign?"[S] ":"", silc_client->conn->local_entry->nickname, &msg[4]);
}
}
/* file */
else if (!strncmp("file ", &buf[1], 5)){
Transfer *t;
if (!strncmp("list", &buf[6], 4)){
print_out("", "-?!- Number User Type Status");
if(!transfers)
print_out("", "-!- No file transfers in the list");
else
print_out("", "-?!- Number User Type Status");
for (t=transfers; t; t=t->next) {
char *status;
if (t->status == FILE_STATUS_WAIT)
......@@ -294,6 +296,7 @@ void proc_channels_input(Channel *c, char *buf) {
}
}
else if(!strncmp("accept ", &buf[6], 7)) {
DEBUG("File: ACCEPT");
int num=atoi(&buf[13]);
for(t=transfers; t; t=t->next)
if(num==t->number)
......@@ -314,24 +317,25 @@ void proc_channels_input(Channel *c, char *buf) {
}
}
else if(!strncmp("send ", &buf[6], 5)) {
DEBUG("File: SENT");
char **argv;
SilcUInt32 *argv_lens, *argv_types, argc, id;
SilcClientEntry client;
int bind=TRUE;
int no_bind=FALSE;
silc_parse_command_line((unsigned char *)buf, (void *)&argv, &argv_lens, &argv_types, &argc, 5);
if (argc < 4) {
print_out("", "-!- File: /file send <nick> <path>");
return;
}
if (argc==5)
if (!strcmp("-no-listner", argv[4]))
bind=FALSE;
if (!strcmp("-no-listener", argv[4]))
no_bind=TRUE;
client=silc_client_get_client_entry(argv[2]);
if(!silc_file_size(argv[3])) {
print_out("", "-!- File: File doesn't exists or is 0 bytes long");
return;
}
int res=silc_client_file_send(silc_client->client, silc_client->conn, file_transfer, NULL, NULL, 0, bind, client, argv[3], &id);
int res=silc_client_file_send(silc_client->client, silc_client->conn, file_transfer, NULL, NULL, 0, no_bind, client, argv[3], &id);
if(res!=SILC_CLIENT_FILE_OK){
print_out("", "-!- Error: Couldn't start filetransfer");
return;
......@@ -341,6 +345,7 @@ void proc_channels_input(Channel *c, char *buf) {
transfer_count++;
}
else if(!strncmp("close ", &buf[6], 6)) {
DEBUG("File: CLOSE");
int num=atoi(&buf[12]);
for(t=transfers; t; t=t->next)
if(num==t->number){
......@@ -1317,7 +1322,19 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
print_out("", "-!- Getkey: The Key you had asked, was saved in: %s", filename);
free(filename);
}
else if(command==SILC_COMMAND_WHOWAS) {
(void)va_arg(va, SilcClientEntry);
char *nickname=va_arg(va, char *);
char *username=va_arg(va, char *);
char *realname=va_arg(va, char *);
print_out("", "-?!- Whowas: %s (%s) [%s]", nickname, username, realname?realname:"");
}
else if(command==SILC_COMMAND_OPER)
print_out("", "-!- You are server oper now");
else if(command==SILC_COMMAND_SILCOPER)
print_out("", "-!- You are router oper now");
va_end(va);
}
/* }}} */
......@@ -1420,6 +1437,39 @@ silc_notify(SilcClient client, SilcClientConnection conn,
channel = va_arg(va, SilcChannelEntry);
print_out(channel->channel_name, "-!- %s [%s@%s] has left %s", sender->nickname, sender->username,sender->hostname, channel->channel_name);
break;
case SILC_NOTIFY_TYPE_INVITE:
DEBUG("Notify: INVITE");
channel = va_arg(va, SilcChannelEntry);
char *name=va_arg(va, char *);
sender = va_arg(va, SilcClientEntry);
print_out("", "-!- You were invited joining the channel %s by %s", channel?channel->channel_name:name, sender->nickname);
break;
case SILC_NOTIFY_TYPE_SERVER_SIGNOFF:
DEBUG("Notify: SERVER SIGNOFF");
SilcClientEntry *clients;
SilcUInt32 clients_count, i;
(void)va_arg(va, void *);
clients = va_arg(va, SilcClientEntry *);
clients_count = va_arg(va, SilcUInt32);
for (i=0; i< clients_count; i++) {
sender=clients[i];
silc_hash_table_list(sender->channels, &ch);
while (silc_hash_table_get(&ch, (void *)&channel, (void *)&channel2)) {
for(c=channels; c; c=c->next)
if(!strcmp(c->silc->channel_name, channel->channel_name))
print_out(channel->channel_name,"-!- %s has quit [%s]", sender->nickname, "server signoff");
}
silc_hash_table_list_reset(&ch);
for (q=queries; q; q=q->next){
char *path=malloc(strlen(q->silc->nickname)+8);
NULL_TEST(path);
snprintf(path, PIPE_BUF, "query/%s", sender->nickname);
print_out(path,"-!- %s has quit [%s]", sender->nickname, str?str:"");
free(path);
}
}
break;
case SILC_NOTIFY_TYPE_SIGNOFF:
/* Left the Network */
DEBUG("Notify: SIGNOFF");
......@@ -1757,6 +1807,21 @@ silc_verify_public_key(SilcClient client, SilcClientConnection conn,
}
}
/* }}} */
/* {{{ silc_ftp */
static void
silc_ftp(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, SilcUInt32 session_id,
const char *hostname, SilcUInt16 port)
{
DEBUG("Ftp: REQUEST");
add_transfer(transfer_count, session_id, client_entry, FILE_TYPE_IN);
if(hostname && port)
print_out("","-!- %s would like to send you a file (Number %d) [%s:%d]", client_entry->nickname, transfer_count, hostname, port);
else
print_out("","-!- %s would like to send you a file (Number %d)", client_entry->nickname, transfer_count);
transfer_count++;
}
/* }}} */
/* {{{ Empty and unused, but required Functions */
static void
......@@ -1802,19 +1867,8 @@ silc_key_agreement(SilcClient client, SilcClientConnection conn,
{
return FALSE;
}
static void
silc_ftp(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, SilcUInt32 session_id,
const char *hostname, SilcUInt16 port)
{
DEBUG("Ftp: REQUEST");
add_transfer(transfer_count, session_id, client_entry, FILE_TYPE_IN);
print_out("","-!- %s would like to send you a file (Number %d)", client_entry->nickname, transfer_count);
transfer_count++;
}
/* }}} */
/* {{{ Client-Ops and main() */
SilcClientOperations ops = {
silc_say,
......@@ -1859,7 +1913,7 @@ int main(int argc, char **argv)
switch (c) {
case 'v': version(); break;
case 'h': usage(); break;
case 'i': strdup(optarg); break;
case 'i': prefix=strdup(optarg); break;
case 's': host = strdup(optarg); break;
case 'p': port = atoi(optarg); break;
case 'n': username = strdup(optarg); break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment