/[weechat]/weechat/src/irc/irc-channel.c
ViewVC logotype

Diff of /weechat/src/irc/irc-channel.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by flashcode, Sat Feb 5 17:39:49 2005 UTC revision 1.16 by flashcode, Sun Feb 27 02:40:12 2005 UTC
# Line 25  Line 25 
25  #endif  #endif
26    
27  #include <stdlib.h>  #include <stdlib.h>
28    #include <unistd.h>
29  #include <string.h>  #include <string.h>
30    
31  #include "../common/weechat.h"  #include "../common/weechat.h"
# Line 53  channel_new (t_irc_server *server, int c Line 54  channel_new (t_irc_server *server, int c
54    
55      /* initialize new channel */      /* initialize new channel */
56      new_channel->type = channel_type;      new_channel->type = channel_type;
57        new_channel->dcc_chat = NULL;
58      new_channel->name = strdup (channel_name);      new_channel->name = strdup (channel_name);
59      new_channel->topic = NULL;      new_channel->topic = NULL;
60      memset (new_channel->modes, ' ', sizeof (new_channel->modes));      memset (new_channel->modes, ' ', sizeof (new_channel->modes));
# Line 101  channel_free (t_irc_server *server, t_ir Line 103  channel_free (t_irc_server *server, t_ir
103      if (channel->next_channel)      if (channel->next_channel)
104          (channel->next_channel)->prev_channel = channel->prev_channel;          (channel->next_channel)->prev_channel = channel->prev_channel;
105    
106        /* close DCC CHAT */
107        if ((t_irc_dcc *)(channel->dcc_chat) &&
108            (!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
109        {
110            dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
111            dcc_redraw (1);
112        }
113        
114      /* free data */      /* free data */
115      if (channel->name)      if (channel->name)
116          free (channel->name);          free (channel->name);
# Line 204  channel_set_away (t_irc_channel *channel Line 214  channel_set_away (t_irc_channel *channel
214              nick_set_away (channel, ptr_nick, is_away);              nick_set_away (channel, ptr_nick, is_away);
215      }      }
216  }  }
217    
218    /*
219     * channel_create_dcc: create DCC CHAT channel
220     */
221    
222    int
223    channel_create_dcc (t_irc_dcc *ptr_dcc)
224    {
225        t_irc_channel *ptr_channel;
226        
227        ptr_channel = channel_search (ptr_dcc->server, ptr_dcc->nick);
228        if (!ptr_channel)
229            ptr_channel = channel_new (ptr_dcc->server, CHAT_PRIVATE,
230                                       ptr_dcc->nick, 0);
231        if (!ptr_channel)
232            return 0;
233        
234        if (ptr_channel->dcc_chat &&
235            (!DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
236            return 0;
237        
238        ptr_channel->dcc_chat = ptr_dcc;
239        ptr_dcc->channel = ptr_channel;
240        gui_redraw_buffer (ptr_channel->buffer);
241        return 1;
242    }
243    
244    /*
245     * channel_remove_dcc: remove a DCC CHAT
246     */
247    
248    void
249    channel_remove_dcc (t_irc_dcc *ptr_dcc)
250    {
251        t_irc_channel *ptr_channel;
252        
253        for (ptr_channel = ptr_dcc->server->channels; ptr_channel;
254            ptr_channel = ptr_channel->next_channel)
255        {
256            if ((t_irc_dcc *)(ptr_channel->dcc_chat) == ptr_dcc)
257            {
258                ptr_channel->dcc_chat = NULL;
259                gui_redraw_buffer (ptr_channel->buffer);
260            }
261        }
262    }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26