Esempio n. 1
0
int main(int argc, char **argv)
{
    struct userec *user;
    unsigned char accessed[2];
    char path[PATHLEN];
    int ret;
    if (argc != 5) {
        printf("usage: %s FILENAME USERID TITLE BOARD\n", argv[0]);
        return 0;
    }
    if (!getcwd(path, PATHLEN))
        return -1;
    chdir(BBSHOME);
    resolve_boards();
    resolve_ucache();
    if (!getuser(argv[2], &user)) {
        printf("user %s not found!\n", argv[2]);
        return -2;
    }
    accessed[0] = 0; accessed[1] = 0;
    if (argv[1][0] != '/') {
        strcat(path, "/");
        strcat(path, argv[1]);
    } else {
        memcpy(path, argv[1], PATHLEN);
    }
    if (access(path, R_OK)) {
        printf("file %s not found!\n", argv[1]);
        return -3;
    }
    ret = post_file_alt(path, user, argv[3], argv[4], NULL, 0x04, accessed);
    printf("done, return value = %d\n", ret);
    return 0;
}
Esempio n. 2
0
int total_post_top10(unsigned int gid,char *board,char *title)
{
    struct userec deliveruser;
    unsigned int start,noref,noattach,ret;
    char ut_file[STRLEN];
    char post_title[ARTICLE_TITLE_LEN];
    unsigned char accessed[2] = "\0\0";

    if (init_all()) {
        printf("init data fail\n");
        return -1;
    }

    bzero(&deliveruser, sizeof(struct userec));
    strcpy(deliveruser.userid, "deliver");
    deliveruser.userlevel = -1;
    strcpy(deliveruser.username, "自动发信系统");
    setCurrentUser(&deliveruser);
    strcpy(getSession()->fromhost, "天堂");

    start = gid;
    noref = 0;
    noattach = 0; 
    //accessed[0] |= 0x08;  // m 
    
    ret=get_thread_forward_mail(board, gid, start, noref, noattach, title);
    if (ret > 0) {
        gettmpfilename(ut_file, "ut");
        snprintf(post_title, ARTICLE_TITLE_LEN, "[合集] [%s] %s", board,title);
        post_file_alt(ut_file, NULL, post_title, "ShiDa", NULL, 0x01|0x04, accessed);
        unlink(ut_file);
    }

    return 0;
}