Changeset a4dc9f7 for protocols


Ignore:
Timestamp:
2006-03-01T22:48:37Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
46ad029
Parents:
8e419cb (diff), 9a1555d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

[merge] Wilmer

Location:
protocols
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r8e419cb ra4dc9f7  
    413413                if (jd->die)
    414414                        signoff(GJ_GC(gjc));
    415         } else if (len < 0 || errno != EAGAIN) {
     415        } else if (len == 0 || (len < 0 && (!sockerr_again() || gjc->ssl))) {
    416416                STATE_EVT(JCONN_STATE_OFF)
    417417        }
  • protocols/msn/msn.c

    r8e419cb ra4dc9f7  
    8484                {
    8585                        m = l->data;
     86               
     87                        serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
    8688                        g_free( m->who );
    8789                        g_free( m->text );
     
    8991                }
    9092                g_slist_free( md->msgq );
    91                
    92                 serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message(s), you'll have to resend them." );
    9393        }
    9494       
  • protocols/msn/sb.c

    r8e419cb ra4dc9f7  
    213213                {
    214214                        m = l->data;
     215
    215216                        g_free( m->who );
    216217                        g_free( m->text );
     
    219220                g_slist_free( sb->msgq );
    220221               
    221                 serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with unsent message(s), you'll have to resend them." );
     222                serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "
     223                                   "unsent message to %s, you'll have to resend it.",
     224                                   m->who ? m->who : "(unknown)" );
    222225        }
    223226       
  • protocols/oscar/oscar.c

    r8e419cb ra4dc9f7  
    608608                return;
    609609        }
     610        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    610611        read(pos->fd, m, 16);
    611612        m[16] = '\0';
  • protocols/oscar/rxqueue.c

    r8e419cb ra4dc9f7  
    353353                return -1; /* its a aim_conn_close()'d connection */
    354354
    355         if (conn->fd < 3)  /* can happen when people abuse the interface */
     355        /* KIDS, THIS IS WHAT HAPPENS IF YOU USE CODE WRITTEN FOR GUIS IN A DAEMON!
     356           
     357           And wouldn't it make sense to return something that prevents this function
     358           from being called again IMMEDIATELY (and making the program suck up all
     359           CPU time)?...
     360           
     361        if (conn->fd < 3)
    356362                return 0;
     363        */
    357364
    358365        if (conn->status & AIM_CONN_STATUS_INPROGRESS)
  • protocols/oscar/service.c

    r8e419cb ra4dc9f7  
    736736
    737737        tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);
    738 
    739         printf("%d\n", tlvlen);
    740738
    741739        if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8)))
  • protocols/ssl_openssl.c

    r8e419cb ra4dc9f7  
    55  \********************************************************************/
    66
    7 /* SSL module - GnuTLS version                                          */
     7/* SSL module - OpenTLS version                                          */
    88
    99/*
     
    4141struct scd
    4242{
    43         ssl_input_function func;
     43        SslInputFunction func;
    4444        gpointer data;
    4545        int fd;
    4646        gboolean established;
    4747       
    48         int inpa;
    49         int lasterr;            /* Necessary for SSL_get_error */
    5048        SSL *ssl;
    5149        SSL_CTX *ssl_ctx;
     
    5654
    5755
    58 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     56void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
    5957{
    6058        struct scd *conn = g_new0( struct scd, 1 );
     
    9593}
    9694
    97 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );
    98 
    9995static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
    10096{
     
    10298       
    10399        if( source == -1 )
    104                 return ssl_handshake( data, -1, cond );
     100                goto ssl_connected_failure;
    105101       
    106         /* Make it non-blocking at least during the handshake... */
    107         sock_make_nonblocking( conn->fd );
    108102        SSL_set_fd( conn->ssl, conn->fd );
    109103       
    110         return ssl_handshake( data, source, cond );
    111 }       
    112 
    113 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )
    114 {
    115         struct scd *conn = data;
    116         int st;
    117        
    118         if( conn->inpa != -1 )
    119         {
    120                 gaim_input_remove( conn->inpa );
    121                 conn->inpa = -1;
    122         }
    123        
    124         if( ( st = SSL_connect( conn->ssl ) ) < 0 )
    125         {
    126                 conn->lasterr = SSL_get_error( conn->ssl, st );
    127                 if( conn->lasterr != SSL_ERROR_WANT_READ && conn->lasterr != SSL_ERROR_WANT_WRITE )
    128                         goto ssl_connected_failure;
    129                
    130                 conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ), ssl_handshake, data );
    131                 return;
    132         }
     104        if( SSL_connect( conn->ssl ) < 0 )
     105                goto ssl_connected_failure;
    133106       
    134107        conn->established = TRUE;
    135         sock_make_blocking( conn->fd );         /* For now... */
    136108        conn->func( conn->data, conn, cond );
    137109        return;
     
    155127int ssl_read( void *conn, char *buf, int len )
    156128{
    157         int st;
     129        if( !((struct scd*)conn)->established )
     130                return( 0 );
    158131       
    159         if( !((struct scd*)conn)->established )
    160         {
    161                 ssl_errno = SSL_NOHANDSHAKE;
    162                 return -1;
    163         }
    164        
    165         st = SSL_read( ((struct scd*)conn)->ssl, buf, len );
    166        
    167         ssl_errno = SSL_OK;
    168         if( st <= 0 )
    169         {
    170                 ((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st );
    171                 if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE )
    172                         ssl_errno = SSL_AGAIN;
    173         }
    174        
    175         return st;
     132        return( SSL_read( ((struct scd*)conn)->ssl, buf, len ) );
    176133}
    177134
    178135int ssl_write( void *conn, const char *buf, int len )
    179136{
    180         int st;
     137        if( !((struct scd*)conn)->established )
     138                return( 0 );
    181139       
    182         if( !((struct scd*)conn)->established )
    183         {
    184                 ssl_errno = SSL_NOHANDSHAKE;
    185                 return -1;
    186         }
    187        
    188         st = SSL_write( ((struct scd*)conn)->ssl, buf, len );
    189        
    190         ssl_errno = SSL_OK;
    191         if( st <= 0 )
    192         {
    193                 ((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st );
    194                 if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE )
    195                         ssl_errno = SSL_AGAIN;
    196         }
    197        
    198         return st;
     140        return( SSL_write( ((struct scd*)conn)->ssl, buf, len ) );
    199141}
    200142
     
    202144{
    203145        struct scd *conn = conn_;
    204        
    205         if( conn->inpa != -1 )
    206                 gaim_input_remove( conn->inpa );
    207146       
    208147        if( conn->established )
     
    220159        return( ((struct scd*)conn)->fd );
    221160}
    222 
    223 GaimInputCondition ssl_getdirection( void *conn )
    224 {
    225         return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );
    226 }
  • protocols/yahoo/Makefile

    r8e419cb ra4dc9f7  
    1010
    1111# [SH] Program variables
    12 objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_list.o yahoo_util.o
     12objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_util.o
    1313
    1414CFLAGS += -Wall -DSTDC_HEADERS -DHAVE_STRING_H -DHAVE_STRCHR -DHAVE_MEMCPY -DHAVE_GLIB
  • protocols/yahoo/yahoo.c

    r8e419cb ra4dc9f7  
    189189{
    190190        struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
    191 
     191       
    192192        gc->away = NULL;
    193 
    194         if (msg)
     193       
     194        if( msg )
    195195        {
    196196                yd->current_status = YAHOO_STATUS_CUSTOM;
    197197                gc->away = "";
    198198        }
    199         else if (state)
     199        if( state )
    200200        {
    201201                gc->away = "";
    202                 if( g_strcasecmp(state, "Available" ) == 0 )
     202                if( g_strcasecmp( state, "Available" ) == 0 )
    203203                {
    204204                        yd->current_status = YAHOO_STATUS_AVAILABLE;
     
    235235                }
    236236        }
    237         else if ( gc->is_idle )
     237        else if( gc->is_idle )
    238238                yd->current_status = YAHOO_STATUS_IDLE;
    239239        else
    240240                yd->current_status = YAHOO_STATUS_AVAILABLE;
    241241       
    242         yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL );
     242        if( yd->current_status == YAHOO_STATUS_INVISIBLE )
     243                yahoo_set_away( yd->y2_id, yd->current_status, NULL, gc->away != NULL );
     244        else
     245                yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL );
    243246}
    244247
  • protocols/yahoo/yahoo_list.h

    r8e419cb ra4dc9f7  
    2121 */
    2222
    23 /*
    24  * This is a replacement for the GList.  It only provides functions that
    25  * we use in Ayttm.  Thanks to Meredyyd from everybuddy dev for doing
    26  * most of it.
    27  */
    28 
    2923#ifndef __YLIST_H__
    3024#define __YLIST_H__
    3125
    32 #ifdef __cplusplus
    33 extern "C" {
     26/* GLib has linked list already, so I don't see why libyahoo2 has to copy this... */
     27
     28typedef GList YList;
     29
     30#define y_list_append g_list_append
     31#define y_list_concat g_list_concat
     32#define y_list_copy g_list_copy
     33#define y_list_empty g_list_empty
     34#define y_list_find g_list_find
     35#define y_list_find_custom g_list_find_custom
     36#define y_list_foreach g_list_foreach
     37#define y_list_free g_list_free
     38#define y_list_free_1 g_list_free_1
     39#define y_list_insert_sorted g_list_insert_sorted
     40#define y_list_length g_list_length
     41#define y_list_next g_list_next
     42#define y_list_nth g_list_nth
     43#define y_list_prepend g_list_prepend
     44#define y_list_remove g_list_remove
     45#define y_list_remove_link g_list_remove_link
     46#define y_list_singleton g_list_singleton
     47
    3448#endif
    35 
    36 typedef struct _YList {
    37         struct _YList *next;
    38         struct _YList *prev;
    39         void *data;
    40 } YList;
    41 
    42 typedef int (*YListCompFunc) (const void *, const void *);
    43 typedef void (*YListFunc) (void *, void *);
    44 
    45 YList *y_list_append(YList * list, void *data);
    46 YList *y_list_prepend(YList * list, void *data);
    47 YList *y_list_remove_link(YList * list, const YList * link);
    48 YList *y_list_remove(YList * list, void *data);
    49 
    50 YList *y_list_insert_sorted(YList * list, void * data, YListCompFunc comp);
    51 
    52 YList *y_list_copy(YList * list);
    53 
    54 YList *y_list_concat(YList * list, YList * add);
    55 
    56 YList *y_list_find(YList * list, const void *data);
    57 YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp);
    58 
    59 YList *y_list_nth(YList * list, int n);
    60 
    61 void y_list_foreach(YList * list, YListFunc fn, void *user_data);
    62 
    63 void y_list_free_1(YList * list);
    64 void y_list_free(YList * list);
    65 int  y_list_length(const YList * list);
    66 int  y_list_empty(const YList * list);
    67 int  y_list_singleton(const YList * list);
    68 
    69 #define y_list_next(list)       list->next
    70 
    71 #ifdef __cplusplus
    72 }
    73 #endif
    74 #endif
Note: See TracChangeset for help on using the changeset viewer.