Пример #1
0
static void nntpdriver_uninitialize(mailsession * session)
{
  struct nntp_session_state_data * data;

  data = get_data(session);

  clist_foreach(data->nntp_subscribed_list, (clist_func) free, NULL);
  clist_free(data->nntp_subscribed_list);

  if (data->nntp_group_info != NULL)
    newsnntp_group_free(data->nntp_group_info);

  if (data->nntp_group_name != NULL)
    free(data->nntp_group_name);

  if (data->nntp_userid != NULL)
    free(data->nntp_userid);

  if (data->nntp_password != NULL)
    free(data->nntp_password);

  newsnntp_free(data->nntp_session);
  free(data);

  session->sess_data = NULL;
}
Пример #2
0
static void delete_nntp(Folder *folder, newsnntp *nntp)
{
	chashdatum key;

	key.data = &folder;
	key.len = sizeof(folder);
	chash_delete(session_hash, &key, NULL);
	
	key.data = &nntp;
	key.len = sizeof(nntp);
	if (nntp && nntp->nntp_stream) {
		/* we don't want libetpan to logout */
		mailstream_close(nntp->nntp_stream);
		nntp->nntp_stream = NULL;
	}
	debug_print("removing newsnntp %p\n", nntp);
	newsnntp_free(nntp);	
}
Пример #3
0
static int nntpdriver_initialize(mailsession * session)
{
  struct nntp_session_state_data * data;
  newsnntp * nntp;

  nntp = newsnntp_new(0, NULL);
  if (nntp == NULL)
    goto err;

  data = malloc(sizeof(* data));
  if (data == NULL)
    goto free;

  data->nntp_session = nntp;

  data->nntp_userid = NULL;
  data->nntp_password = NULL;

  data->nntp_group_info = NULL;
  data->nntp_group_name = NULL;
  
  data->nntp_subscribed_list = clist_new();
  if (data->nntp_subscribed_list == NULL)
    goto free_data;

  data->nntp_max_articles = 0;

  data->nntp_mode_reader = FALSE;

  session->sess_data = data;

  return MAIL_NO_ERROR;

 free_data:
  free(data);
 free:
  newsnntp_free(nntp);
 err:
  return MAIL_ERROR_MEMORY;
}