Ejemplo n.º 1
0
void parse_xref(char *s, post *crosspost) {
  char *art = strchr(s, ':');
  
  *art = 0;
  crosspost->article = atoi(art + 1);
  crosspost->group_id = group_name_to_id(s);
}
Ejemplo n.º 2
0
/* add a buddy and send packet to QQ server
 * note that when purple load local cached buddy list into its blist
 * it also calls this funtion, so we have to
 * define qd->is_login=TRUE AFTER LOGIN */
void qq_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
{
	qq_data *qd;
	gchar * group_name;
	qq_buddy_opt_req *opt_req;

	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
	g_return_if_fail(buddy != NULL);

	qd = (qq_data *) gc->proto_data;
	if (!qd->is_login)
		return;		/* IMPORTANT ! */

	if (purple_buddy_get_protocol_data(buddy))
	{
		purple_notify_error(gc, _("QQ Buddy"), _("Add buddy"), _("Buddy exists"));
		return;
	}

	/* free it in qq_request_add_buddy_touch */
	opt_req = g_new0(qq_buddy_opt_req, 1);
	opt_req->gc = gc;
	opt_req->uid = purple_name_to_uid(purple_buddy_get_name(buddy));

	if (group)
	{
		group_name = purple_group_get_name(group);
		if (!group_name)
		{
			purple_notify_error(gc, _("QQ Buddy"), _("Add buddy"), _("Group not exists"));
			goto free;
		}
		opt_req->group_id = group_name_to_id(gc, group_name);
		if (opt_req->group_id == 0xFF)
		{
			purple_notify_error(gc, _("QQ Buddy"), _("Add buddy"), _("Chosen Group not associated with this account"));
			goto free;
		}
	} else opt_req->group_id = 0;
	

	if (opt_req->uid > 0) {
		qq_request_add_buddy_touch(gc, opt_req);
		return;
	}

	purple_notify_error(gc, _("QQ Buddy"), _("Add buddy"), _("Invalid QQ Number"));

free:
	if (buddy == NULL)
		return;
	qq_buddy_free(buddy);
}
Ejemplo n.º 3
0
int com_group(FILE *client, char **args) {
  int id;
  int buffer[3];

  if (*args == NULL)
    message(client, 501, "newsgroup");
  else if ((id = group_name_to_id(*args)) == 0)
    message(client, 411, "No such group");
  else {
    if (select_group(*args)) {
      lseek(active_file, id * 4 * 3, SEEK_SET);
      read_block(active_file, (char *)buffer, 12);
      fprintf(client, "211 %d %d %d %s\r\n", 
	      buffer[2], buffer[0], buffer[1], *args);
    } else {
      message(client, 401, "Error when selecting group");
    }
  }
  return 0;
}
Ejemplo n.º 4
0
int com_list_active(FILE *client, char **args) {
  int id, i;

  message(client, 215, "Newsgroups in form \"group high low flags\"");

  if (*args != NULL) {
    if ((id = group_name_to_id(*args)) != 0) {
      lseek(active_file, id * 4 * 3, SEEK_SET);
      output_active_entry(client, id);
    } 
  } else {
    lseek(active_file, 0, SEEK_SET);
    for (i = 0; i < max_group_id; i++) {
      output_active_entry(client, i);
    }
  }

  message(client, 0, ".");
  return 0;
}