summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-11 22:06:09 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-11 22:06:09 +0800
commit78a0d5c60be67ff1ae668d2de3e2aad7881f586e (patch)
treef85388077ae770755abdaef26041fa51b0b9fe2e /mbbsd
parentbc1ce935662b1cbc34defc7c97becf14c875f23d (diff)
downloadpttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.tar
pttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.tar.gz
pttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.tar.bz2
pttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.tar.lz
pttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.tar.xz
pttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.tar.zst
pttbbs-78a0d5c60be67ff1ae668d2de3e2aad7881f586e.zip
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1315 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/voteboard.c72
1 files changed, 43 insertions, 29 deletions
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index 2af3537d..097c1d70 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -16,6 +16,7 @@ do_voteboardreply(fileheader_t * fhdr)
fileheader_t votefile;
int len;
int i, j;
+ int yes=0, no=0,*yn=NULL;
int fd;
time_t endtime;
int hastime = 0;
@@ -54,16 +55,27 @@ do_voteboardreply(fileheader_t * fhdr)
return;
}
}
+ if(yn)
+ {
+ if(!strncmp("----------", genbuf, 10))
+ yn=&no;
+ else
+ *yn++;
+ }
+ else if (!strncmp("----------", genbuf, 10))
+ yn=&yes;
+
if (!strncmp(genbuf + 4, cuser.userid, len)) {
move(5, 10);
prints("�z�w�g�s�p�L���g�F");
- opnion[0] = 'n';
getdata(7, 0, "�n�ק�z���e���s�p�ܡH(Y/N) [N]", opnion, 3, LCECHO);
+ *yn--; /* ����L����s�p�����@������ */
if (opnion[0] != 'y') {
fclose(fp);
return;
}
strlcpy(reason, genbuf + 19, sizeof(reason));
+ break;
}
}
fclose(fp);
@@ -112,7 +124,10 @@ do_voteboardreply(fileheader_t * fhdr)
return;
}
} while (opnion[0] != 'y' && opnion[0] != 'n');
-
+ if(opnion[0]=='y')
+ yes++;
+ else
+ no++;
if (!getdata(20, 0, "�аݱz�P�o��ij�D�����Y�γs�p�z�Ѭ���G",
reason, sizeof(reason), DOECHO)) {
flock(fd, LOCK_UN);
@@ -138,9 +153,11 @@ do_voteboardreply(fileheader_t * fhdr)
j++;
} while (genbuf[j - 1] != '\n');
genbuf[j] = '\0';
- if (!strncmp("----------", genbuf, 10))
+ if (!strncmp("����H��:",genbuf,9))
+ fprintf(fp, "����H��:%-9d�Ϲ�H��:-9d", yes, no);
+ else if (!strncmp("----------", genbuf, 10))
break;
- if (strncmp(genbuf + 4, cuser.userid, len))
+ else if (strncmp(genbuf + 4, cuser.userid, len))
fprintf(fp, "%3d.%s", i, genbuf + 4);
else
i--;
@@ -183,7 +200,7 @@ do_voteboard(int type)
char genbuf[1024];
char fpath[80];
FILE *fp;
- int temp, i;
+ int temp;
clear();
if (!(currmode & MODE_POST)) {
@@ -197,22 +214,21 @@ do_voteboard(int type)
prints("�z���b�ϥ� PTT ���s�p�t��\n");
prints("���s�p�t�αN�߰ݱz�@�ǰ��D�A�Фp�ߦ^���~��}�l�s�p\n");
prints("���N���X�s�p�ת̡A�N�Q�C�J�����w��ϥΪ̳�\n");
- pressanykey();
- move(0, 0);
+ move(4, 0);
clrtobot();
- prints("(1)���ʳs�p (2)�O�W���� \n");
+ prints("(1)���ʳs�p (2)�O�W����");
if(type==0)
- prints("(3)�ӽзs�O (4)�o���ªO (5)�s�p�O�D (6)�}�K�O�D (7)�s�p�p�ժ� (8)�}�K�p�ժ� (9)�ӽзs�s��\n");
+ prints("(3)�ӽзs�O (4)�o���ªO (5)�s�p�O�D \n(6)�}�K�O�D (7)�s�p�p�ժ� (8)�}�K�p�ժ� (9)�ӽзs�s��\n");
do {
- getdata(3, 0, "�п�J�s�p���O [0:����]�G", topic, 3, DOECHO);
+ getdata(6, 0, "�п�J�s�p���O [0:����]�G", topic, 3, DOECHO);
temp = atoi(topic);
} while (temp < 0 || temp > 9 || (type && temp>2));
switch (temp) {
case 0:
return FULLUPDATE;
case 1:
- if (!getdata(4, 0, "�п�J���ʥD�D�G", topic, 30, DOECHO))
+ if (!getdata(7, 0, "�п�J���ʥD�D�G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "%s %s", "[���ʳs�p]", topic);
snprintf(genbuf, sizeof(genbuf),
@@ -220,7 +236,7 @@ do_voteboard(int type)
strcat(genbuf, "\n���ʤ��e: \n");
break;
case 2:
- if (!getdata(4, 0, "�п�J����D�D�G", topic, 30, DOECHO))
+ if (!getdata(7, 0, "�п�J����D�D�G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "%s %s", "[�O�W����]", topic);
snprintf(genbuf, sizeof(genbuf),
@@ -229,7 +245,7 @@ do_voteboard(int type)
break;
case 3:
do {
- if (!getdata(4, 0, "�п�J�ݪO�^��W�١G", topic, IDLEN + 1, DOECHO))
+ if (!getdata(7, 0, "�п�J�ݪO�^��W�١G", topic, IDLEN + 1, DOECHO))
return FULLUPDATE;
else if (invalid_brdname(topic))
outs("���O���T���ݪO�W��");
@@ -242,15 +258,15 @@ do_voteboard(int type)
snprintf(genbuf, sizeof(genbuf),
"%s\n\n%s%s\n%s", "�ӽзs�O", "�^��W��: ", topic, "����W��: ");
- if (!getdata(5, 0, "�п�J�ݪO����W�١G", topic, 20, DOECHO))
+ if (!getdata(8, 0, "�п�J�ݪO����W�١G", topic, 20, DOECHO))
return FULLUPDATE;
strcat(genbuf, topic);
strcat(genbuf, "\n�ݪO���O: ");
- if (!getdata(6, 0, "�п�J�ݪO���O�G", topic, 20, DOECHO))
+ if (!getdata(9, 0, "�п�J�ݪO���O�G", topic, 20, DOECHO))
return FULLUPDATE;
strcat(genbuf, topic);
strcat(genbuf, "\n�O�D�W��: ");
- getdata(7, 0, "�п�J�O�D�W��G", topic, IDLEN * 3 + 3, DOECHO);
+ getdata(10, 0, "�п�J�O�D�W��G", topic, IDLEN * 3 + 3, DOECHO);
strcat(genbuf, topic);
strcat(genbuf, "\n�ӽЭ�]: \n");
break;
@@ -288,19 +304,16 @@ do_voteboard(int type)
snprintf(genbuf, sizeof(genbuf),
"%s\n\n%s%s\n%s", "�}�K�O�D", "�^��W��: ",
topic, "�O�D ID : ");
+ temp=getbnum(topic);
do {
- if (!getdata(6, 0, "�п�J�O�DID�G", topic, IDLEN + 1, DOECHO))
+ if (!getdata(7, 0, "�п�J�O�DID�G", topic, IDLEN + 1, DOECHO))
return FULLUPDATE;
- else if (!userid_is_BM(topic, bcache[i - 1].BM))
- outs("���O�ӪO���O�D");
- else
- break;
- } while (temp > 0);
+ }while (!userid_is_BM(topic, bcache[temp - 1].BM));
strcat(genbuf, topic);
strcat(genbuf, "\n�}�K��]: \n");
break;
case 7:
- if (!getdata(4, 0, "�п�J�p�դ��^��W�١G", topic, 30, DOECHO))
+ if (!getdata(7, 0, "�п�J�p�դ��^��W�١G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "[�s�p�p�ժ�] %s", topic);
snprintf(genbuf, sizeof(genbuf),
@@ -309,18 +322,18 @@ do_voteboard(int type)
strcat(genbuf, "\n�ӽЬF��: \n");
break;
case 8:
- if (!getdata(4, 0, "�п�J�p�դ��^��W�١G", topic, 30, DOECHO))
+ if (!getdata(7, 0, "�п�J�p�դ��^��W�١G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "[�}�K�p�ժ�] %s", topic);
snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s",
"�}�K�p�ժ�", "�p�զW��: ", topic, "�p�ժ� ID : ");
- if (!getdata(6, 0, "�п�J�p�ժ�ID�G", topic, IDLEN + 1, DOECHO))
+ if (!getdata(8, 0, "�п�J�p�ժ�ID�G", topic, IDLEN + 1, DOECHO))
return FULLUPDATE;
strcat(genbuf, topic);
strcat(genbuf, "\n�}�K��]: \n");
break;
case 9:
- if (!getdata(4, 0, "�п�J�s�դ��^��W�١G", topic, 30, DOECHO))
+ if (!getdata(7, 0, "�п�J�s�դ��^��W�١G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "[�ӽзs�s��] %s", topic);
snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s%s",
@@ -331,13 +344,13 @@ do_voteboard(int type)
return FULLUPDATE;
}
outs("�п�J²���άF��(�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
+ for (temp = 11; temp < 16; temp++) {
+ if (!getdata(temp, 0, "�G", topic, 60, DOECHO))
break;
strcat(genbuf, topic);
strcat(genbuf, "\n");
}
- if (i == 8)
+ if (temp == 11)
return FULLUPDATE;
strcat(genbuf, "�s�p�����ɶ�: ");
now += 14 * 24 * 60 * 60;
@@ -345,6 +358,7 @@ do_voteboard(int type)
strcat(genbuf, topic);
strcat(genbuf, ctime(&now));
now -= 14 * 24 * 60 * 60;
+ strcat(genbuf, "����H��:0 �Ϲ�H��:0\n");
strcat(genbuf, "----------���----------\n");
strcat(genbuf, "----------�Ϲ�----------\n");
outs("�}�l�s�p��");