summaryrefslogtreecommitdiffstats
path: root/mbbsd/voteboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/voteboard.c')
-rw-r--r--mbbsd/voteboard.c180
1 files changed, 57 insertions, 123 deletions
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index a0db074e..2af3537d 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -175,7 +175,7 @@ do_voteboardreply(fileheader_t * fhdr)
}
int
-do_voteboard()
+do_voteboard(int type)
{
fileheader_t votefile;
char topic[100];
@@ -196,24 +196,38 @@ do_voteboard()
clrtobot();
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���t�Τ����w��ϥΪ̳�\n");
+ prints("���N���X�s�p�ת̡A�N�Q�C�J�����w��ϥΪ̳�\n");
pressanykey();
move(0, 0);
clrtobot();
- prints("(1)�ӽзs�O (2)�o���ªO (3)�s�p�O�D (4)�}�K�O�D\n");
- if (!strcmp(currboard, VOTEBOARD))
- prints("(5)�s�p�p�ժ� (6)�}�K�p�ժ� ");
- if (!strcmp(currboard, VOTEBOARD) && HAS_PERM(PERM_SYSOP))
- prints("(7)��������");
- prints("(8)�ӽзs�s��");
+ prints("(1)���ʳs�p (2)�O�W���� \n");
+ 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");
do {
- getdata(3, 0, "�п�J�s�p���O�G", topic, 3, DOECHO);
+ getdata(3, 0, "�п�J�s�p���O [0:����]�G", topic, 3, DOECHO);
temp = atoi(topic);
- } while (temp <= 0 && temp >= 9);
-
+ } 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))
+ return FULLUPDATE;
+ snprintf(title, sizeof(title), "%s %s", "[���ʳs�p]", topic);
+ snprintf(genbuf, sizeof(genbuf),
+ "%s\n\n%s%s\n", "���ʳs�p", "���ʥD�D: ", topic);
+ strcat(genbuf, "\n���ʤ��e: \n");
+ break;
+ case 2:
+ if (!getdata(4, 0, "�п�J����D�D�G", topic, 30, DOECHO))
+ return FULLUPDATE;
+ snprintf(title, sizeof(title), "%s %s", "[�O�W����]", topic);
+ snprintf(genbuf, sizeof(genbuf),
+ "%s\n\n%s%s\n", "�O�W����", "����D�D: ", topic);
+ strcat(genbuf, "\n�����]: \n");
+ break;
+ case 3:
do {
if (!getdata(4, 0, "�п�J�ݪO�^��W�١G", topic, IDLEN + 1, DOECHO))
return FULLUPDATE;
@@ -239,71 +253,37 @@ do_voteboard()
getdata(7, 0, "�п�J�O�D�W��G", topic, IDLEN * 3 + 3, DOECHO);
strcat(genbuf, topic);
strcat(genbuf, "\n�ӽЭ�]: \n");
- outs("�п�J�ӽЭ�](�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 9; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 9)
- return FULLUPDATE;
break;
- case 2:
- do {
- if (!getdata(4, 0, "�п�J�ݪO�^��W�١G", topic, IDLEN + 1, DOECHO))
- return FULLUPDATE;
- else if (getbnum(topic) <= 0)
- outs("���W�٨ä��s�b");
- else
- break;
- } while (temp > 0);
+ case 4:
+ generalnamecomplete("�п�J�ݪO�^��W�١G",
+ topic, IDLEN+1,
+ SHM->Bnumber,
+ completeboard_compar,
+ completeboard_permission,
+ completeboard_getname);
snprintf(title, sizeof(title), "[�o���ªO] %s", topic);
snprintf(genbuf, sizeof(genbuf),
"%s\n\n%s%s\n", "�o���ªO", "�^��W��: ", topic);
strcat(genbuf, "\n�o����]: \n");
- outs("�п�J�o����](�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 8)
- return FULLUPDATE;
-
break;
- case 3:
- do {
- if (!getdata(4, 0, "�п�J�ݪO�^��W�١G", topic, IDLEN + 1, DOECHO))
- return FULLUPDATE;
- else if (getbnum(topic) <= 0)
- outs("���W�٨ä��s�b");
- else
- break;
- } while (temp > 0);
+ case 5:
+ generalnamecomplete("�п�J�ݪO�^��W�١G",
+ topic, IDLEN+1,
+ SHM->Bnumber,
+ completeboard_compar,
+ completeboard_permission,
+ completeboard_getname);
snprintf(title, sizeof(title), "[�s�p�O�D] %s", topic);
snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s%s", "�s�p�O�D", "�^��W��: ", topic, "�ӽ� ID : ", cuser.userid);
strcat(genbuf, "\n�ӽЬF��: \n");
- outs("�п�J�ӽЬF��(�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 8)
- return FULLUPDATE;
break;
- case 4:
- do {
- if (!getdata(4, 0, "�п�J�ݪO�^��W�١G", topic, IDLEN + 1, DOECHO))
- return FULLUPDATE;
- else if ((i = getbnum(topic)) <= 0)
- outs("���W�٨ä��s�b");
- else
- break;
- } while (temp > 0);
+ case 6:
+ generalnamecomplete("�п�J�ݪO�^��W�١G",
+ topic, IDLEN+1,
+ SHM->Bnumber,
+ completeboard_compar,
+ completeboard_permission,
+ completeboard_getname);
snprintf(title, sizeof(title), "[�}�K�O�D] %s", topic);
snprintf(genbuf, sizeof(genbuf),
"%s\n\n%s%s\n%s", "�}�K�O�D", "�^��W��: ",
@@ -318,17 +298,8 @@ do_voteboard()
} while (temp > 0);
strcat(genbuf, topic);
strcat(genbuf, "\n�}�K��]: \n");
- outs("�п�J�}�K��](�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 8)
- return FULLUPDATE;
break;
- case 5:
+ case 7:
if (!getdata(4, 0, "�п�J�p�դ��^��W�١G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "[�s�p�p�ժ�] %s", topic);
@@ -336,18 +307,8 @@ do_voteboard()
"%s\n\n%s%s\n%s%s", "�s�p�p�ժ�", "�p�զW��: ",
topic, "�ӽ� ID : ", cuser.userid);
strcat(genbuf, "\n�ӽЬF��: \n");
- outs("�п�J�ӽЬF��(�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 8)
- return FULLUPDATE;
break;
- case 6:
-
+ case 8:
if (!getdata(4, 0, "�п�J�p�դ��^��W�١G", topic, 30, DOECHO))
return FULLUPDATE;
snprintf(title, sizeof(title), "[�}�K�p�ժ�] %s", topic);
@@ -357,55 +318,27 @@ do_voteboard()
return FULLUPDATE;
strcat(genbuf, topic);
strcat(genbuf, "\n�}�K��]: \n");
- outs("�п�J�}�K��](�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 8)
- return FULLUPDATE;
- break;
- case 7:
- if (!HAS_PERM(PERM_SYSOP))
- return FULLUPDATE;
- if (!getdata(4, 0, "�п�J����D�D�G", topic, 30, DOECHO))
- return FULLUPDATE;
- snprintf(title, sizeof(title), "%s %s", "[��������]", topic);
- snprintf(genbuf, sizeof(genbuf),
- "%s\n\n%s%s\n", "��������", "����D�D: ", topic);
- strcat(genbuf, "\n�����]: \n");
- outs("�п�J�����](�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
- if (!getdata(i, 0, "�G", topic, 60, DOECHO))
- break;
- strcat(genbuf, topic);
- strcat(genbuf, "\n");
- }
- if (i == 8)
- return FULLUPDATE;
break;
- case 8:
+ case 9:
if (!getdata(4, 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",
"�ӽиs��", "�s�զW��: ", topic, "�ӽ� ID : ", cuser.userid);
strcat(genbuf, "\n�ӽЬF��: \n");
- outs("�п�J�ӽЬF��(�ܦh����)�A�n�M����g���M���|�֭��");
- for (i = 8; i < 13; i++) {
+ break;
+ default:
+ 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))
break;
strcat(genbuf, topic);
strcat(genbuf, "\n");
}
- if (i == 8)
+ if (i == 8)
return FULLUPDATE;
- break;
- default:
- return FULLUPDATE;
- }
strcat(genbuf, "�s�p�����ɶ�: ");
now += 14 * 24 * 60 * 60;
snprintf(topic, sizeof(topic), "(%ld)", now);
@@ -430,6 +363,7 @@ do_voteboard()
fclose(fp);
strlcpy(votefile.owner, cuser.userid, sizeof(votefile.owner));
strlcpy(votefile.title, title, sizeof(votefile.title));
+ votefile.filemode |= FILE_VOTE;
setbdir(genbuf, currboard);
if (append_record(genbuf, &votefile, sizeof(votefile)) != -1)
setbtotal(currbid);