Changeset 609

Show
Ignore:
Timestamp:
07/23/05 16:19:31 (3 years ago)
Author:
jajcus
Message:

- support for HTTP requests removed -- the only request implemented was password change and it is not supported anymore (as GG uses graphical tokens now)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/requests.c

    r497 r609  
    9898 
    9999 
    100 int request_io_handler(GIOChannel *source,GIOCondition condition,gpointer data){ 
    101 Request *r; 
    102 User *u; 
    103 GIOCondition cond; 
    104 int res=0; 
    105  
    106         r=(Request *)data; 
    107         g_assert(r!=NULL); 
    108  
    109         u=user_get_by_jid(r->from); 
    110         user_load_locale(u); 
    111  
    112         if (r->gghttp){ 
    113                 if (r->gghttp->callback) 
    114                         res=r->gghttp->callback(r->gghttp); 
    115                 else 
    116                         res=gg_http_watch_fd(r->gghttp); 
    117         } 
    118  
    119         switch(r->type){ 
    120                 case RT_PASSWD: 
    121                         if (res || r->gghttp->state==GG_STATE_ERROR) change_password_error(r); 
    122                         else if (!res && r->gghttp->state==GG_STATE_DONE) change_password_done(r); 
    123                         else break; 
    124                         r->io_watch=0; 
    125                         remove_request(r); 
    126                         return FALSE; 
    127  
    128                 default: 
    129                         g_warning(N_("Unknow gg_http session type: %i"),r->gghttp->type); 
    130                         gg_http_watch_fd(r->gghttp); 
    131                         break; 
    132         } 
    133  
    134         cond=G_IO_ERR|G_IO_HUP|G_IO_NVAL; 
    135         if (r->gghttp->check&GG_CHECK_READ) cond|=G_IO_IN; 
    136         if (r->gghttp->check&GG_CHECK_WRITE) cond|=G_IO_OUT; 
    137         r->io_watch=g_io_add_watch(r->ioch,cond,request_io_handler,r); 
    138  
    139         return FALSE; 
    140 } 
    141  
    142100Request * add_request(RequestType type,const char *from,const char *to, 
    143101                        const char *id,xmlnode query, void *data, 
     
    145103Request *r; 
    146104Session *s; 
    147 GIOCondition cond; 
    148 struct gg_http *gghttp; 
    149105 
    150106        r=g_new0(Request,1); 
     
    158114        r->stream=stream; 
    159115 
    160         if(type==RT_VCARD || type==RT_SEARCH || type==RT_CHANGE)
     116        if (type==RT_VCARD || type==RT_SEARCH || type==RT_CHANGE)
    161117                s=session_get_by_jid(from, stream,0); 
    162118                if (s==NULL) return NULL; 
     
    166122                gg_pubdir50(s->ggs, (gg_pubdir50_t)data); 
    167123                g_hash_table_insert(lookups, &r->hash, r); 
    168         } 
    169         else{ 
    170                 gghttp=(struct gg_http*)data; 
    171  
    172                 r->gghttp=gghttp; 
    173  
    174                 r->ioch=g_io_channel_unix_new(gghttp->fd); 
    175                         cond=G_IO_ERR|G_IO_HUP|G_IO_NVAL; 
    176                 if (r->gghttp->check&GG_CHECK_READ) cond|=G_IO_IN; 
    177                 if (r->gghttp->check&GG_CHECK_WRITE) cond|=G_IO_OUT; 
    178                 r->io_watch=g_io_add_watch(r->ioch,cond,request_io_handler,r); 
    179124        } 
    180125        requests=g_list_append(requests,r); 
     
    186131        if (!r) return -1; 
    187132        requests=g_list_remove(requests,r); 
    188         if (r->io_watch) g_source_remove(r->io_watch); 
    189         if (r->type!=RT_VCARD && r->type!=RT_SEARCH){ 
    190                 g_io_channel_close(r->ioch); 
    191         } 
    192133        if (r->from) g_free(r->from); 
    193134        if (r->to) g_free(r->to);