回精華區
作者itoc, 信區: itoc
標題[功能] manage.c 板主自訂發文綱領
時間03/08/17
作者: itoc (:MM:) 看板: itoc
標題: Re: [問題]板主自訂發文綱領
時間: Fri Apr 18 14:51:23 2003                          Updated: 2005/05/26

※ 引述《Dinsam.bbs@whshs.cs.nccu.edu.tw (前世.. o.O)》之銘言:
> 我參考進板畫面 寫了一個板主自訂發文綱領

: global.h

#define FN_NOTE         "note"          /* 進板畫面 */
+ #define FN_POSTLAW    "postlaw"       /* 發文綱領 */

: post.c:do_post()

+ brd_fpath(fpath, currboard, FN_POSTLAW);
+ if (more(fpath, (char *) -1) < 0)
    film_out(FILM_POST, 0);

  prints("發表文章於【 %s 】看板", currboard);

: manage.c:post_postlaw_edit() 新增於 post_memo_edit() 後面

/* ----------------------------------------------------- */
/* 板主功能 : 修改發文綱領                               */
/* ----------------------------------------------------- */


static int
post_postlaw_edit(xo)       /* 板主自定文章發表綱領 */
  XO *xo;
{
  int mode;
  char fpath[64];

  mode = vans("文章發表綱領 (D)刪除 (E)修改 (Q)取消?[E] ");

  if (mode != 'q')
  {
    brd_fpath(fpath, currboard, FN_POSTLAW);

    if (mode == 'd')
    {
      unlink(fpath);
      return XO_FOOT;
    }

    if (vedit(fpath, 0))      /* Thor.981020: 注意被talk的問題 */
      vmsg(msg_cancel);
    return XO_HEAD;
  }
  return XO_FOOT;
}

: manage.c:post_manage()

    "WMemo   編輯進板畫面",
+   "PostLaw 編輯發文綱領",

  ...
  ...

- char *menu = "◎ 板主選單 (B)主題 (W)進板 (M)副板"
+ char *menu = "◎ 板主選單 (B)主題 (W)進板 (P)綱領 (M)副板"

  ...
  ...

  case 'w':
    return post_memo_edit(xo);

+ case 'p':
+   return post_postlaw_edit(xo);

--
    ╭─ Origin ─╗ O processor.tfcis.org  ~ κλμ ─┤
    ├   Author   ╡ itoc.Dorm-GD2.NCTU.edu.tw                
精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻