Revision 1919 trunk/server_qt/nntpgrab_qt.cpp
| nntpgrab_qt.cpp (revision 1919) | ||
|---|---|---|
| 44 | 44 | 
                   | 
              
| 45 | 45 | 
                  bool QNNTPGrab::init(char **errmsg, char **warnings)  | 
              
| 46 | 46 | 
                  {
                 | 
              
| 47 | 
                  #ifdef WIN32  | 
              |
| 48 | 
                  static bool winsock_initialized = false;  | 
              |
| 49 | 
                  WORD wVersionRequested;  | 
              |
| 50 | 
                  WSADATA wsaData;  | 
              |
| 51 | 
                  int ret;  | 
              |
| 52 | 
                   | 
              |
| 53 | 
                  /* Initialize Winsock */  | 
              |
| 54 | 
                      if (!winsock_initialized) {
                 | 
              |
| 55 | 
                  winsock_initialized = true;  | 
              |
| 56 | 
                   | 
              |
| 57 | 
                  wVersionRequested = MAKEWORD( 2, 2 );  | 
              |
| 58 | 
                   | 
              |
| 59 | 
                  ret = WSAStartup( wVersionRequested, &wsaData );  | 
              |
| 60 | 
                          if ( ret != 0 ) {
                 | 
              |
| 61 | 
                  /* Tell the user that we could not find a usable */  | 
              |
| 62 | 
                  /* WinSock DLL. */  | 
              |
| 63 | 
                  /* FIXME: Get rid of the GLib dependency */  | 
              |
| 64 | 
                  #if 0  | 
              |
| 65 | 
                              if (errmsg) {
                 | 
              |
| 66 | 
                                  *errmsg = g_strdup_printf(_("Winsock could not be initialised"));
                 | 
              |
| 67 | 
                  }  | 
              |
| 68 | 
                  #endif  | 
              |
| 69 | 
                  return false;  | 
              |
| 70 | 
                  }  | 
              |
| 71 | 
                   | 
              |
| 72 | 
                  /* Confirm that the WinSock DLL supports 2.2.*/  | 
              |
| 73 | 
                  /* Note that if the DLL supports versions greater */  | 
              |
| 74 | 
                  /* than 2.2 in addition to 2.2, it will still return */  | 
              |
| 75 | 
                  /* 2.2 in wVersion since that is the version we */  | 
              |
| 76 | 
                  /* requested. */  | 
              |
| 77 | 
                   | 
              |
| 78 | 
                  if ( LOBYTE( wsaData.wVersion ) != 2 ||  | 
              |
| 79 | 
                               HIBYTE( wsaData.wVersion ) != 2 ) {
                 | 
              |
| 80 | 
                  /* Tell the user that we could not find a usable */  | 
              |
| 81 | 
                  /* WinSock DLL. */  | 
              |
| 82 | 
                  WSACleanup( );  | 
              |
| 83 | 
                   | 
              |
| 84 | 
                  /* FIXME: Get rid of the GLib dependency */  | 
              |
| 85 | 
                  #if 0  | 
              |
| 86 | 
                              if (errmsg) {
                 | 
              |
| 87 | 
                                  *errmsg = g_strdup_printf(_("Winsock 2.2 or higher is required for this program"));
                 | 
              |
| 88 | 
                  }  | 
              |
| 89 | 
                  #endif  | 
              |
| 90 | 
                   | 
              |
| 91 | 
                  return false;  | 
              |
| 92 | 
                  }  | 
              |
| 93 | 
                  }  | 
              |
| 94 | 
                  #endif  | 
              |
| 95 | 
                   | 
              |
| 96 | 47 | 
                  nntpgrab_utils_perform_base_initialization();  | 
              
| 97 | 48 | 
                   | 
              
| 98 | 49 | 
                  core = nntpgrab_core_new();  | 
              
Also available in: Unified diff
NNTPGrab

