/[rdesktop]/sourceforge.net/trunk/rdesktop/cliprdr.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/cliprdr.c

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

revision 1025 by forsberg, Mon Nov 7 13:15:19 2005 UTC revision 1365 by jsorg71, Thu Jan 4 05:39:39 2007 UTC
# Line 2  Line 2 
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     Protocol services - Clipboard functions     Protocol services - Clipboard functions
4     Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003     Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003
5     Copyright (C) Matthew Chapman 2003     Copyright (C) Matthew Chapman 2003-2007
6    
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 33  Line 33 
33    
34  static VCHANNEL *cliprdr_channel;  static VCHANNEL *cliprdr_channel;
35    
36    static uint8 *last_formats = NULL;
37    static uint32 last_formats_length = 0;
38    
39  static void  static void
40  cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length)  cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length)
41  {  {
# Line 60  cliprdr_send_simple_native_format_announ Line 63  cliprdr_send_simple_native_format_announ
63  {  {
64          uint8 buffer[36];          uint8 buffer[36];
65    
66            DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n"));
67    
68          buf_out_uint32(buffer, format);          buf_out_uint32(buffer, format);
69          memset(buffer + 4, 0, sizeof(buffer) - 4);      /* description */          memset(buffer + 4, 0, sizeof(buffer) - 4);      /* description */
70          cliprdr_send_native_format_announce(buffer, sizeof(buffer));          cliprdr_send_native_format_announce(buffer, sizeof(buffer));
# Line 72  cliprdr_send_simple_native_format_announ Line 77  cliprdr_send_simple_native_format_announ
77  void  void
78  cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length)  cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length)
79  {  {
80          cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data, formats_data_length);          DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n"));
81    
82            cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data,
83                                formats_data_length);
84    
85            if (formats_data != last_formats)
86            {
87                    if (last_formats)
88                            xfree(last_formats);
89    
90                    last_formats = xmalloc(formats_data_length);
91                    memcpy(last_formats, formats_data, formats_data_length);
92                    last_formats_length = formats_data_length;
93            }
94  }  }
95    
96  void  void
# Line 80  cliprdr_send_data_request(uint32 format) Line 98  cliprdr_send_data_request(uint32 format)
98  {  {
99          uint8 buffer[4];          uint8 buffer[4];
100    
101            DEBUG_CLIPBOARD(("cliprdr_send_data_request\n"));
102          buf_out_uint32(buffer, format);          buf_out_uint32(buffer, format);
103          cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer));          cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer));
104  }  }
# Line 87  cliprdr_send_data_request(uint32 format) Line 106  cliprdr_send_data_request(uint32 format)
106  void  void
107  cliprdr_send_data(uint8 * data, uint32 length)  cliprdr_send_data(uint8 * data, uint32 length)
108  {  {
109            DEBUG_CLIPBOARD(("cliprdr_send_data\n"));
110          cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length);          cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length);
111  }  }
112    
# Line 106  cliprdr_process(STREAM s) Line 126  cliprdr_process(STREAM s)
126    
127          if (status == CLIPRDR_ERROR)          if (status == CLIPRDR_ERROR)
128          {          {
129                  if (type == CLIPRDR_FORMAT_ACK)                  switch (type)
130                  {                  {
131                          /* FIXME: We seem to get this when we send an announce while the server is                          case CLIPRDR_FORMAT_ACK:
132                             still processing a paste. Try sending another announce. */                                  /* FIXME: We seem to get this when we send an announce while the server is
133                          cliprdr_send_simple_native_format_announce(CF_TEXT);                                     still processing a paste. Try sending another announce. */
134                          return;                                  cliprdr_send_native_format_announce(last_formats,
135                                                                        last_formats_length);
136                                    break;
137                            case CLIPRDR_DATA_RESPONSE:
138                                    ui_clip_request_failed();
139                                    break;
140                            default:
141                                    DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type));
142                  }                  }
143    
                 DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type));  
144                  return;                  return;
145          }          }
146    
# Line 143  cliprdr_process(STREAM s) Line 169  cliprdr_process(STREAM s)
169          }          }
170  }  }
171    
172    void
173    cliprdr_set_mode(const char *optarg)
174    {
175            ui_clip_set_mode(optarg);
176    }
177    
178  BOOL  BOOL
179  cliprdr_init(void)  cliprdr_init(void)
180  {  {

Legend:
Removed from v.1025  
changed lines
  Added in v.1365

  ViewVC Help
Powered by ViewVC 1.1.26