[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[JDEV] RE: [CVS] cvs commit: jabber/jabber/jabberbox config.c config.x



<CHEER>!  Keep 'em comming, baybee!!  I'm holding off on expanding my client
classes untill the protocol change.  I'm also going to use expat to parse as
well, so I also may reuse some of the command line client source.. ;-P

--
Thomas Charron
United Parcel Service
Northeast Region
IE Software Developer
"Moving at the speed of a T3 Trunk Line!"


> -----Original Message-----
> From: cvs-admin@jabber.org [mailto:cvs-admin@jabber.org]On Behalf Of
> jeremie@mondo.eppg.com
> Sent: Thursday, March 04, 1999 11:22 AM
> To: cvs@jabber.org
> Subject: [CVS] cvs commit: jabber/jabber/jabberbox config.c config.x
>
>
> jeremie     99/03/04 10:22:13
>
>   Modified:    jabber/jabberbox config.c config.x
>   Log:
>   Started redoing jabberbox to use expat for XML parsing.
>   Done: loads config file
>   Todo: protocol parsing/changes
>
>   Revision  Changes    Path
>   1.2       +25 -32    jabber/jabber/jabberbox/config.c
>
>   Index: config.c
>   ===================================================================
>   RCS file: /cvs/jabber/jabber/jabberbox/config.c,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- config.c	1999/02/14 09:37:43	1.1
>   +++ config.c	1999/03/04 16:22:13	1.2
>   @@ -5,7 +5,8 @@
>    	int nbytes, f;
>    	char buff[MAXMSG], *conf_data, *new, *old;
>    	char *config = DEFAULT_CONFIG;
>   -	tap tp = {NULL,NULL,0};
>   +	xpt *xpt, *next;
>   +	char *buf = NULL;
>    	char myname[MAXHOSTNAMELEN + 1];
>
>    	if(jpair_getval(etc.arg,"-c") != NULL)
>   @@ -18,29 +19,31 @@
>    	{
>    		DBUG("Failed reading configuration file",config)
>    	}else{
>   -		conf_data = malloc(1);
>   -		conf_data[0] = '\0';
>   -		while(1)
>   -		{
>   -			nbytes = read(f,buff,MAXMSG-1);
>   -			if(nbytes <= 0)
>   -				break;
>   -			buff[nbytes] = '\0';
>   -			new = malloc(nbytes + strlen(conf_data) + 1);
>   -			strcat(new,conf_data);
>   -			strcat(new,buff);
>   -			old = conf_data;
>   -			conf_data = new;
>   -			free(old);
>   -		}
>   -		DBUG("Read in config file","");
>   -		tp.h_tag = &config_handle_transports;
>   -		tag_parse(&tp, conf_data, NULL);
>   +		xpt = xpt_file(config);
>
>   -		if(jpair_getval(etc.transports, "jabberbox") != NULL)
>   +		if(xpt != NULL)
>    		{
>   -			tp.h_tag = &config_handle_jabberbox;
>   -			tag_parse(&tp, jpair_getval(etc.transports,
> "jabberbox"), NULL);
>   +			next = xpt->children;
>   +			while(next != NULL)
>   +			{
>   +				if(next->type == XPT_TAG)
>   +				{
>   +
> if(strcmp(next->name,"jabberbox") == 0)
>   +					{
>   +						etc.vars =
> xpt2jpair(next->children);
>   +					}else{
>   +						buf = NULL;
>   +
> while(next->children != NULL)
>   +						{
>   +							buf =
> strgrow(buf,xpt2str(next->children),1,1);
>   +
> next->children = next->children->next;
>   +						}
>   +						etc.transports =
> jpair_new(etc.transports, next->name, buf, 0);
>   +						free(buf);
>   +					}
>   +				}
>   +				next = next->next;
>   +			}
>    		}
>    	}
>
>   @@ -54,15 +57,5 @@
>    		etc.vars = jpair_new(etc.vars, "listen", myname, 0);
>    	}
>
>   -}
>   -
>   -void config_handle_transports(tag *t, void *v)
>   -{
>   -	etc.transports = jpair_new(etc.transports, t->name, t->contents, 0);
>   -}
>   -
>   -void config_handle_jabberbox(tag *t, void *v)
>   -{
>   -	etc.vars = jpair_new(etc.vars, t->name, t->contents, 0);
>    }
>
>
>
>
>   1.2       +7 -6      jabber/jabber/jabberbox/config.x
>
>   Index: config.x
>   ===================================================================
>   RCS file: /cvs/jabber/jabber/jabberbox/config.x,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- config.x	1999/02/14 09:37:43	1.1
>   +++ config.x	1999/03/04 16:22:13	1.2
>   @@ -1,15 +1,15 @@
>   +<transports>
>    This config file is just an example, please modify to fit your
> needs... only recognized tags are processed, so you can
>    type anywhere outside of them and not hurt anything.
>
>    This is the main section used by jabberbox.
>    <jabberbox>
>    	<log>/tmp/jabber.log</log>
>   -	<!>
>   +	<!--
>    		wrap something in another tag to hide it or comment
> it out...
>    		this is what might be used to listen on multiple
> IP's, but it's not working yet.
>    		<listen>198.45.23.4</listen>
>   -		<listen>198.45.23.5</listen>
>   -	</!>
>   +	-->
>    </jabberbox>
>
>    This section is passed on to the "jabber" transport when it connects.
>   @@ -17,12 +17,12 @@
>    how your server will identify itself on the Internet.  Put any
> secondary names
>    your server might be addressed as in an alias tag.
>    <jabber>
>   -	<name>your.host.name.com</name>
>   +	<name>jabber.org</name>
>    	<alias>JABBER</alias>
>    	<alias>localhost</alias>
>   -	<!>
>   +	<!--
>    		<listen>198.45.23.4</listen>
>   -	</!>
>   +	-->
>    	<modules>
>    		<basic>
>    			<cache>/var/tmp/jabber.basic.cache</cache>
>   @@ -52,3 +52,4 @@
>    Anything can be contained between the tags, it all gets passed
> to the transport.
>    </perl>
>
>   +</transports>
>
>
>
>
> _______________________________________________
> cvs maillist  -  cvs@jabber.org
> http://jabber.org/mailman/listinfo/cvs
>