source: protocols/msn/sb.c @ 3585c5a

Last change on this file since 3585c5a was 3585c5a, checked in by Wilmer van der Gaast <wilmer@…>, at 2008-01-05T19:03:02Z

Added handling of MSN switchboard NAK messages. Untested, but hey, it
compiles! (And it's pretty trivial...)

  • Property mode set to 100644
File size: 15.7 KB
RevLine 
[b7d3cc34]1  /********************************************************************\
2  * BitlBee -- An IRC to other IM-networks gateway                     *
3  *                                                                    *
[c92e6801]4  * Copyright 2002-2005 Wilmer van der Gaast and others                *
[b7d3cc34]5  \********************************************************************/
6
7/* MSN module - Switchboard server callbacks and utilities              */
8
9/*
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License with
21  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
22  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23  Suite 330, Boston, MA  02111-1307  USA
24*/
25
26#include <ctype.h>
27#include "nogaim.h"
28#include "msn.h"
29#include "passport.h"
30#include "md5.h"
31
[ba9edaa]32static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond );
[b7d3cc34]33static int msn_sb_command( gpointer data, char **cmd, int num_parts );
34static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts );
35
36int msn_sb_write( struct msn_switchboard *sb, char *s, int len )
37{
38        int st;
39       
40        st = write( sb->fd, s, len );
41        if( st != len )
42        {
43                msn_sb_destroy( sb );
44                return( 0 );
45        }
46       
47        return( 1 );
48}
49
[0da65d5]50struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session )
[b7d3cc34]51{
[0da65d5]52        struct msn_data *md = ic->proto_data;
[b7d3cc34]53        struct msn_switchboard *sb = g_new0( struct msn_switchboard, 1 );
54       
55        sb->fd = proxy_connect( host, port, msn_sb_connected, sb );
56        if( sb->fd < 0 )
57        {
58                g_free( sb );
59                return( NULL );
60        }
61       
[0da65d5]62        sb->ic = ic;
[b7d3cc34]63        sb->key = g_strdup( key );
64        sb->session = session;
65       
66        msn_switchboards = g_slist_append( msn_switchboards, sb );
67        md->switchboards = g_slist_append( md->switchboards, sb );
68       
69        return( sb );
70}
71
[0da65d5]72struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle )
[b7d3cc34]73{
[0da65d5]74        struct msn_data *md = ic->proto_data;
[b7d3cc34]75        struct msn_switchboard *sb;
76        GSList *l;
77       
78        for( l = md->switchboards; l; l = l->next )
79        {
80                sb = l->data;
81                if( sb->who && strcmp( sb->who, handle ) == 0 )
82                        return( sb );
83        }
84       
85        return( NULL );
86}
87
[0da65d5]88struct msn_switchboard *msn_sb_by_chat( struct groupchat *c )
[b7d3cc34]89{
[0da65d5]90        struct msn_data *md = c->ic->proto_data;
[b7d3cc34]91        struct msn_switchboard *sb;
92        GSList *l;
93       
94        for( l = md->switchboards; l; l = l->next )
95        {
96                sb = l->data;
[fa29d093]97                if( sb->chat == c )
[b7d3cc34]98                        return( sb );
99        }
100       
101        return( NULL );
102}
103
[0da65d5]104struct msn_switchboard *msn_sb_spare( struct im_connection *ic )
[b7d3cc34]105{
[0da65d5]106        struct msn_data *md = ic->proto_data;
[b7d3cc34]107        struct msn_switchboard *sb;
108        GSList *l;
109       
110        for( l = md->switchboards; l; l = l->next )
111        {
112                sb = l->data;
113                if( !sb->who && !sb->chat )
114                        return( sb );
115        }
116       
117        return( NULL );
118}
119
120int msn_sb_sendmessage( struct msn_switchboard *sb, char *text )
121{
122        if( sb->ready )
123        {
[bd28e6a]124                char *packet, *buf;
[b7d3cc34]125                int i, j;
126               
[bd28e6a]127                /* Build the message. Convert LF to CR-LF for normal messages. */
[b7d3cc34]128                if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 )
129                {
130                        buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 );
131                        i = strlen( MSN_MESSAGE_HEADERS );
132                       
133                        strcpy( buf, MSN_MESSAGE_HEADERS );
134                        for( j = 0; text[j]; j ++ )
135                        {
136                                if( text[j] == '\n' )
137                                        buf[i++] = '\r';
138                               
139                                buf[i++] = text[j];
140                        }
141                }
142                else
143                {
[c2fb3809]144                        i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->acc->user );
[bd28e6a]145                        buf = g_new0( char, i );
[c2fb3809]146                        i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user );
[b7d3cc34]147                }
148               
[bd28e6a]149                /* Build the final packet (MSG command + the message). */
150                packet = g_strdup_printf( "MSG %d N %d\r\n%s", ++sb->trId, i, buf );
151                g_free( buf );
152                if( msn_sb_write( sb, packet, strlen( packet ) ) )
[b7d3cc34]153                {
[bd28e6a]154                        g_free( packet );
[b7d3cc34]155                        return( 1 );
156                }
157                else
158                {
[bd28e6a]159                        g_free( packet );
[b7d3cc34]160                        return( 0 );
161                }
162        }
163        else if( sb->who )
164        {
165                struct msn_message *m = g_new0( struct msn_message, 1 );
166               
167                m->who = g_strdup( "" );
168                m->text = g_strdup( text );
169                sb->msgq = g_slist_append( sb->msgq, m );
170               
171                return( 1 );
172        }
173        else
174        {
175                return( 0 );
176        }
177}
178
[0da65d5]179struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
[b7d3cc34]180{
[0da65d5]181        struct im_connection *ic = sb->ic;
[b7d3cc34]182        char buf[1024];
183       
184        /* Create the groupchat structure. */
185        g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
[61ae52c]186        sb->chat = imcb_chat_new( ic, buf );
[b7d3cc34]187       
188        /* Populate the channel. */
[61ae52c]189        if( sb->who ) imcb_chat_add_buddy( sb->chat, sb->who );
190        imcb_chat_add_buddy( sb->chat, ic->acc->user );
[b7d3cc34]191       
192        /* And make sure the switchboard doesn't look like a regular chat anymore. */
193        if( sb->who )
194        {
195                g_free( sb->who );
196                sb->who = NULL;
197        }
[fa29d093]198       
199        return sb->chat;
[b7d3cc34]200}
201
202void msn_sb_destroy( struct msn_switchboard *sb )
203{
[0da65d5]204        struct im_connection *ic = sb->ic;
205        struct msn_data *md = ic->proto_data;
[b7d3cc34]206       
207        debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" );
208       
209        if( sb->msgq )
210        {
211                struct msn_message *m;
212                GSList *l;
213               
214                for( l = sb->msgq; l; l = l->next )
215                {
216                        m = l->data;
[1053836]217
[b7d3cc34]218                        g_free( m->who );
219                        g_free( m->text );
220                        g_free( m );
221                }
222                g_slist_free( sb->msgq );
223               
[84b045d]224                imcb_log( ic, "Warning: Closing down MSN switchboard connection with "
[1053836]225                                   "unsent message to %s, you'll have to resend it.",
[8ba511d]226                                   sb->who ? sb->who : "(unknown)" );
[b7d3cc34]227        }
228       
[8ba511d]229        if( sb->key ) g_free( sb->key );
230        if( sb->who ) g_free( sb->who );
231       
[b7d3cc34]232        if( sb->chat )
233        {
[e35d1a1]234                imcb_chat_free( sb->chat );
[b7d3cc34]235        }
236       
237        if( sb->handler )
238        {
239                if( sb->handler->rxq ) g_free( sb->handler->rxq );
240                if( sb->handler->cmd_text ) g_free( sb->handler->cmd_text );
241                g_free( sb->handler );
242        }
243       
[ba9edaa]244        if( sb->inp ) b_event_remove( sb->inp );
[b7d3cc34]245        closesocket( sb->fd );
246       
247        msn_switchboards = g_slist_remove( msn_switchboards, sb );
248        md->switchboards = g_slist_remove( md->switchboards, sb );
249        g_free( sb );
250}
251
[ba9edaa]252gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )
[b7d3cc34]253{
254        struct msn_switchboard *sb = data;
[0da65d5]255        struct im_connection *ic;
[b7d3cc34]256        struct msn_data *md;
257        char buf[1024];
258       
259        /* Are we still alive? */
260        if( !g_slist_find( msn_switchboards, sb ) )
[ba9edaa]261                return FALSE;
[b7d3cc34]262       
[0da65d5]263        ic = sb->ic;
264        md = ic->proto_data;
[b7d3cc34]265       
266        if( source != sb->fd )
267        {
268                debug( "ERROR %d while connecting to switchboard server", 1 );
269                msn_sb_destroy( sb );
[ba9edaa]270                return FALSE;
[b7d3cc34]271        }
272       
273        /* Prepare the callback */
274        sb->handler = g_new0( struct msn_handler_data, 1 );
275        sb->handler->fd = sb->fd;
276        sb->handler->rxq = g_new0( char, 1 );
277        sb->handler->data = sb;
278        sb->handler->exec_command = msn_sb_command;
279        sb->handler->exec_message = msn_sb_message;
280       
281        if( sb->session == MSN_SB_NEW )
[c2fb3809]282                g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->acc->user, sb->key );
[b7d3cc34]283        else
[c2fb3809]284                g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->acc->user, sb->key, sb->session );
[b7d3cc34]285       
286        if( msn_sb_write( sb, buf, strlen( buf ) ) )
[ba9edaa]287                sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
[b7d3cc34]288        else
289                debug( "ERROR %d while connecting to switchboard server", 2 );
[ba9edaa]290       
291        return FALSE;
[b7d3cc34]292}
293
[ba9edaa]294static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond )
[b7d3cc34]295{
296        struct msn_switchboard *sb = data;
297       
298        if( msn_handler( sb->handler ) == -1 )
299        {
300                debug( "ERROR: Switchboard died" );
301                msn_sb_destroy( sb );
[ba9edaa]302               
303                return FALSE;
[b7d3cc34]304        }
[ba9edaa]305        else
306                return TRUE;
[b7d3cc34]307}
308
309static int msn_sb_command( gpointer data, char **cmd, int num_parts )
310{
311        struct msn_switchboard *sb = data;
[0da65d5]312        struct im_connection *ic = sb->ic;
[b7d3cc34]313        char buf[1024];
314       
315        if( !num_parts )
316        {
317                /* Hrrm... Empty command...? Ignore? */
318                return( 1 );
319        }
320       
321        if( strcmp( cmd[0], "XFR" ) == 0 )
322        {
[84b045d]323                imcb_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
[c2fb3809]324                imc_logout( ic, TRUE );
[b7d3cc34]325                return( 0 );
326        }
327        else if( strcmp( cmd[0], "USR" ) == 0 )
328        {
329                if( num_parts != 5 )
330                {
331                        msn_sb_destroy( sb );
332                        return( 0 );
333                }
334               
335                if( strcmp( cmd[2], "OK" ) != 0 )
336                {
337                        msn_sb_destroy( sb );
338                        return( 0 );
339                }
340               
341                if( sb->who )
342                {
343                        g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, sb->who );
344                        return( msn_sb_write( sb, buf, strlen( buf ) ) );
345                }
346                else
347                {
348                        debug( "Just created a switchboard, but I don't know what to do with it." );
349                }
350        }
351        else if( strcmp( cmd[0], "IRO" ) == 0 )
352        {
353                int num, tot;
354               
355                if( num_parts != 6 )
356                {
357                        msn_sb_destroy( sb );
358                        return( 0 );
359                }
360               
361                num = atoi( cmd[2] );
362                tot = atoi( cmd[3] );
363               
364                if( tot <= 0 )
365                {
366                        msn_sb_destroy( sb );
367                        return( 0 );
368                }
369                else if( tot > 1 )
370                {
371                        char buf[1024];
372                       
373                        if( num == 1 )
374                        {
375                                g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
[61ae52c]376                                sb->chat = imcb_chat_new( ic, buf );
[b7d3cc34]377                               
378                                g_free( sb->who );
379                                sb->who = NULL;
380                        }
381                       
[61ae52c]382                        imcb_chat_add_buddy( sb->chat, cmd[4] );
[b7d3cc34]383                       
384                        if( num == tot )
385                        {
[61ae52c]386                                imcb_chat_add_buddy( sb->chat, ic->acc->user );
[b7d3cc34]387                        }
388                }
389        }
390        else if( strcmp( cmd[0], "ANS" ) == 0 )
391        {
392                if( num_parts != 3 )
393                {
394                        msn_sb_destroy( sb );
395                        return( 0 );
396                }
397               
398                if( strcmp( cmd[2], "OK" ) != 0 )
399                {
400                        debug( "Switchboard server sent a negative ANS reply" );
401                        msn_sb_destroy( sb );
402                        return( 0 );
403                }
404               
405                sb->ready = 1;
406        }
407        else if( strcmp( cmd[0], "CAL" ) == 0 )
408        {
409                if( num_parts != 4 || !isdigit( cmd[3][0] ) )
410                {
411                        msn_sb_destroy( sb );
412                        return( 0 );
413                }
414               
415                sb->session = atoi( cmd[3] );
416        }
417        else if( strcmp( cmd[0], "JOI" ) == 0 )
418        {
419                if( num_parts != 3 )
420                {
421                        msn_sb_destroy( sb );
422                        return( 0 );
423                }
424               
425                if( sb->who && g_strcasecmp( cmd[1], sb->who ) == 0 )
426                {
427                        /* The user we wanted to talk to is finally there, let's send the queued messages then. */
428                        struct msn_message *m;
429                        GSList *l;
430                        int st = 1;
431                       
432                        debug( "%s arrived in the switchboard session, now sending queued message(s)", cmd[1] );
433                       
434                        /* Without this, sendmessage() will put everything back on the queue... */
435                        sb->ready = 1;
436                       
437                        while( ( l = sb->msgq ) )
438                        {
439                                m = l->data;
440                                if( st )
441                                {
442                                        /* This hack is meant to convert a regular new chat into a groupchat */
443                                        if( strcmp( m->text, GROUPCHAT_SWITCHBOARD_MESSAGE ) == 0 )
444                                                msn_sb_to_chat( sb );
445                                        else
446                                                st = msn_sb_sendmessage( sb, m->text );
447                                }
448                                g_free( m->text );
449                                g_free( m->who );
450                                g_free( m );
451                               
452                                sb->msgq = g_slist_remove( sb->msgq, m );
453                        }
454                       
455                        return( st );
456                }
457                else if( sb->who )
458                {
459                        debug( "Converting chat with %s to a groupchat because %s joined the session.", sb->who, cmd[1] );
460                       
461                        /* This SB is a one-to-one chat right now, but someone else is joining. */
462                        msn_sb_to_chat( sb );
463                       
[61ae52c]464                        imcb_chat_add_buddy( sb->chat, cmd[1] );
[b7d3cc34]465                }
466                else if( sb->chat )
467                {
[61ae52c]468                        imcb_chat_add_buddy( sb->chat, cmd[1] );
[b7d3cc34]469                        sb->ready = 1;
470                }
471                else
472                {
473                        /* PANIC! */
474                }
475        }
476        else if( strcmp( cmd[0], "MSG" ) == 0 )
477        {
478                if( num_parts != 4 )
479                {
480                        msn_sb_destroy( sb );
481                        return( 0 );
482                }
483               
484                sb->handler->msglen = atoi( cmd[3] );
485               
486                if( sb->handler->msglen <= 0 )
487                {
488                        debug( "Received a corrupted message on the switchboard, the switchboard will be closed" );
489                        msn_sb_destroy( sb );
490                        return( 0 );
491                }
492        }
[3585c5a]493        else if( strcmp( cmd[0], "NAK" ) == 0 )
494        {
495                if( sb->who )
496                {
497                        imcb_log( ic, "The MSN servers could not deliver one of your messages to %s.", sb->who );
498                }
499                else
500                {
501                        imcb_log( ic, "The MSN servers could not deliver one of your groupchat messages to all participants." );
502                }
503        }
[b7d3cc34]504        else if( strcmp( cmd[0], "BYE" ) == 0 )
505        {
506                if( num_parts < 2 )
507                {
508                        msn_sb_destroy( sb );
509                        return( 0 );
510                }
511               
512                /* if( cmd[2] && *cmd[2] == '1' ) -=> Chat is being cleaned up because of idleness */
513               
514                if( sb->who )
515                {
516                        /* This is a single-person chat, and the other person is leaving. */
517                        g_free( sb->who );
518                        sb->who = NULL;
519                        sb->ready = 0;
520                       
521                        debug( "Person %s left the one-to-one switchboard connection. Keeping it around as a spare...", cmd[1] );
522                       
523                        /* We could clean up the switchboard now, but keeping it around
524                           as a spare for a next conversation sounds more sane to me.
525                           The server will clean it up when it's idle for too long. */
526                }
527                else if( sb->chat )
528                {
[61ae52c]529                        imcb_chat_remove_buddy( sb->chat, cmd[1], "" );
[b7d3cc34]530                }
531                else
532                {
533                        /* PANIC! */
534                }
535        }
536        else if( isdigit( cmd[0][0] ) )
537        {
538                int num = atoi( cmd[0] );
[08995b0]539                const struct msn_status_code *err = msn_status_by_number( num );
[b7d3cc34]540               
[84b045d]541                imcb_error( ic, "Error reported by switchboard server: %s", err->text );
[b7d3cc34]542               
543                if( err->flags & STATUS_SB_FATAL )
544                {
545                        msn_sb_destroy( sb );
[6048744]546                        return 0;
[b7d3cc34]547                }
[6048744]548                else if( err->flags & STATUS_FATAL )
[b7d3cc34]549                {
[c2fb3809]550                        imc_logout( ic, TRUE );
[6048744]551                        return 0;
[b7d3cc34]552                }
[6048744]553                else if( err->flags & STATUS_SB_IM_SPARE )
[3b9390b]554                {
555                        if( sb->who )
556                        {
557                                struct msn_message *m;
558                                GSList *l;
559                               
560                                /* Apparently some invitation failed. We might want to use this
561                                   board later, so keep it as a spare. */
562                                g_free( sb->who );
563                                sb->who = NULL;
564                               
565                                /* Also clear the msgq, otherwise someone else might get them. */
566                                for( l = sb->msgq; l; l = l->next )
567                                {
568                                        m = l->data;
569                                        g_free( m->who );
570                                        g_free( m->text );
571                                        g_free( m );
572                                }
573                                g_slist_free( sb->msgq );
574                                sb->msgq = NULL;
575                        }
[6048744]576                       
577                        /* Do NOT return 0 here, we want to keep this sb. */
[3b9390b]578                }
[b7d3cc34]579        }
580        else
581        {
582                debug( "Received unknown command from switchboard server: %s", cmd[0] );
583        }
584       
585        return( 1 );
586}
587
588static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts )
589{
590        struct msn_switchboard *sb = data;
[0da65d5]591        struct im_connection *ic = sb->ic;
[b7d3cc34]592        char *body;
593        int blen = 0;
594       
595        if( !num_parts )
596                return( 1 );
597       
598        if( ( body = strstr( msg, "\r\n\r\n" ) ) )
599        {
600                body += 4;
601                blen = msglen - ( body - msg );
602        }
603       
604        if( strcmp( cmd[0], "MSG" ) == 0 )
605        {
606                char *ct = msn_findheader( msg, "Content-Type:", msglen );
607               
608                if( !ct )
609                        return( 1 );
610               
611                if( g_strncasecmp( ct, "text/plain", 10 ) == 0 )
612                {
613                        g_free( ct );
614                       
615                        if( !body )
616                                return( 1 );
617                       
618                        if( sb->who )
619                        {
[9624fdf]620                                imcb_buddy_msg( ic, cmd[1], body, 0, 0 );
[b7d3cc34]621                        }
622                        else if( sb->chat )
623                        {
[61ae52c]624                                imcb_chat_msg( sb->chat, cmd[1], body, 0, 0 );
[b7d3cc34]625                        }
626                        else
627                        {
628                                /* PANIC! */
629                        }
630                }
631                else if( g_strncasecmp( ct, "text/x-msmsgsinvite", 19 ) == 0 )
632                {
633                        char *itype = msn_findheader( body, "Application-GUID:", blen );
634                        char buf[1024];
635                       
636                        g_free( ct );
637                       
638                        *buf = 0;
639                       
640                        if( !itype )
641                                return( 1 );
642                       
643                        /* File transfer. */
644                        if( strcmp( itype, "{5D3E02AB-6190-11d3-BBBB-00C04F795683}" ) == 0 )
645                        {
646                                char *name = msn_findheader( body, "Application-File:", blen );
647                                char *size = msn_findheader( body, "Application-FileSize:", blen );
648                               
649                                if( name && size )
650                                {
651                                        g_snprintf( buf, sizeof( buf ), "<< \x02""BitlBee\x02"" - Filetransfer: `%s', %s bytes >>\n"
652                                                    "Filetransfers are not supported by BitlBee for now...", name, size );
653                                }
654                                else
655                                {
656                                        strcpy( buf, "<< \x02""BitlBee\x02"" - Corrupted MSN filetransfer invitation message >>" );
657                                }
658                               
659                                if( name ) g_free( name );
660                                if( size ) g_free( size );
661                        }
662                        else
663                        {
664                                char *iname = msn_findheader( body, "Application-Name:", blen );
665                               
666                                g_snprintf( buf, sizeof( buf ), "<< \x02""BitlBee\x02"" - Unknown MSN invitation - %s (%s) >>",
667                                                                itype, iname ? iname : "no name" );
668                               
669                                if( iname ) g_free( iname );
670                        }
671                       
672                        g_free( itype );
673                       
674                        if( !*buf )
675                                return( 1 );
676                       
677                        if( sb->who )
678                        {
[9624fdf]679                                imcb_buddy_msg( ic, cmd[1], buf, 0, 0 );
[b7d3cc34]680                        }
681                        else if( sb->chat )
682                        {
[61ae52c]683                                imcb_chat_msg( sb->chat, cmd[1], buf, 0, 0 );
[b7d3cc34]684                        }
685                        else
686                        {
687                                /* PANIC! */
688                        }
689                }
690                else if( g_strncasecmp( ct, "text/x-msmsgscontrol", 20 ) == 0 )
691                {
692                        char *who = msn_findheader( msg, "TypingUser:", msglen );
693                       
694                        if( who )
695                        {
[9624fdf]696                                imcb_buddy_typing( ic, who, OPT_TYPING );
[b7d3cc34]697                                g_free( who );
698                        }
699                       
700                        g_free( ct );
701                }
702                else
703                {
704                        g_free( ct );
705                }
706        }
707       
708        return( 1 );
709}
Note: See TracBrowser for help on using the repository browser.