#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from CTerm import *

#print termwidth
#print termheight

# 站点类型
(ST_NORMAL,
ST_FIREBIRD,
ST_MAPLE,
ST_SMTH,
ST_YTHT
)=range(5)

# 屏幕状态
(SST_UNKNOWN,
SST_MENU,
SST_LIST,
SST_ARTICLE,
SST_END,
SST_CHATROOM,
SST_TALK,
SST_WRITE,
SST_INPUT,
SST_ENTER,
SST_MESSAGE,
SST_DIGEST_UNKNOWN,
SST_ANY,
SST_HOT,
SST_USER,
)=range(15)
 
# 子状态
(SST_LIST_ARTICLE,
SST_LIST_BOARD,
SST_LIST_DIGEST,
SST_LIST_USER,
SST_LIST_UNKWON,
)=range(100,105)

(SST_END_ARTILE,
SST_END_MAIL,
SST_END_DIGEST,
SST_ARTICLE_END
)=range(200,204)

SST_IN_ARTILE=205

SST_SUB_NONE=300

# 优先表
statuspriority=[
SST_MESSAGE,
SST_HOT,
SST_ENTER,
SST_WRITE,
SST_END,
SST_ARTICLE,
SST_INPUT,
SST_LIST,
SST_CHATROOM,
SST_MENU,
SST_TALK,
SST_UNKNOWN,
SST_DIGEST_UNKNOWN,
SST_ANY
]

# 关键字，以状态常数的key的dict
# 对于相对行数，只保存负值，为相对于termheight的偏移，如termheight=24，则-1表示23行(末行)
# FireBird(SMTH, YTHT)
FBKeywords={
SST_HOT:(0,['本日十大热门','近日推荐文章']),
SST_ENTER:[
	(0,['日  一  二  三  四  五  六']), #主要目的是排除列表状态
	(-1,['◆Enter◆','任何键', "任意键", "键继续", "上次连线时间", "签名档", '(0)结束', '(Q)离开',"寄回信箱", '十大话题', '超级文章选择']),
	(0,[(r'^你就要离开',)]),
],
SST_WRITE:(-1,["编辑文章", "Ctrl-Q 求救",  "Ctrl-Q求救", "[插入]", "[改写]", "[Ins]", "[Rep]"]),
SST_END:{
	SST_END_ARTILE:(-1,["阅读文章", "连续读信","搜索关键字","主题阅读"]),
	SST_END_DIGEST:(-1,["阅读精华区资料"]),
	SST_END_MAIL:(-1,["(R)回信"])
},

SST_ARTICLE:{
	SST_ARTICLE_END:(-1,["已经看到末尾了",'100%',]), #翰海星云："已经看到末尾了",
	SST_SUB_NONE:(-1,["下面还有喔",]),
},

SST_LIST:{
	SST_LIST_ARTICLE:[(0,["版主:", "板主:", "版务:", "诚征板主中", 
		'诚征版主中', '诚徵板主中', '诚征版务中','邮件选单','信件选单','[令狐冲搜索]']),],
	SST_LIST_BOARD:(0,["讨论区列表", "个人定制区","板板列表"]),
	SST_LIST_USER:(0,["[使用者列表]", "[好朋友列表]"]),
	SST_LIST_DIGEST:(1,["F 寄回自己的信箱", "F 寄回信箱"]),
	SST_LIST_UNKWON:(0, ["全站文章"]),
},

SST_CHATROOM:(0,['房间']), # r'房间.*话题', 

SST_MENU:[(0,["选单", "菜单", "分类讨论区", "个人工具箱","处理信件区","blog区", 
	"处理信件区", "谈天说地区", "特别服务区", "系统资讯", 'BBS在线游戏']), #第2个以后为类小百合的FB站所有 华南木棉:"主菜单"，幽幽黄桷兰把选单二字去掉了
	(11,["[4] 离开本BBS站"]), #smthbbs
],

SST_TALK:(11, ["畅谈中"]), #====.*和.*正在畅谈中===

SST_INPUT:[(-1,["标题:"]),
			(1,["送音信给","回讯息给"]),
]
}	# end of FireBird

# Maple
MapleKeywords={

SST_ENTER:(-1,['任何键', "任意键", "上次连线时间", "签名档", "寄回信箱"]), #same
SST_WRITE:(-1,["编辑文章", "插入", "取代"]),

SST_END:{
	SST_END_ARTILE:(-1,["文章选读"]),
	SST_END_DIGEST:(-1,["阅读精华"]),
	SST_END_MAIL:(-1,["(R)回信"]), # same
},

SST_ARTICLE:(-1,["浏览 P.",' 文章 P.']), # 无名小站:  文章 P.1(83%)

SST_LIST:{
	SST_LIST_ARTICLE:[(0,['【版主', '【板主'])], # SST_END_ARTILE: (-1,['文章选读'])
	SST_LIST_USER:[(0,["【好友名单】", "【网友列表】"]),
		(2,["编号    好友ID"]), # 自定好友列表
	],
	SST_LIST_DIGEST:(0,["【精华文章】"]),
	SST_LIST_BOARD:[(0,["看板列表", "个人定制区"]),
		(2,["编号   看  板","编号  群组名称"]), #应是群组列表
	],
},

SST_CHATROOM:(0,['谈天室：']), # r'谈天室：.*话题：', 
SST_MENU:(0,["【主功能表】", "【电子邮件】", "【个人设定】", "【个人工具】", "【休闲聊天】", "【分类看板】","【聊天说话】"]), 
SST_TALK:(-1, ["交谈模式"]), #11: 谈天说地.*◆.*
SST_INPUT:(-1,["标题:"]) # same but more...
}

# 自定，特殊类型
SpecialTypeKeyWords={
}
