OSDN Git Service
(root)
/
fukui-no-namari
/
fukui-no-namari.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1f50259
)
Make bbs type little massive.
author
Aiwota Programmer
<aiwotaprog@tetteke.tk>
Fri, 8 Sep 2006 03:49:17 +0000
(12:49 +0900)
committer
Aiwota Programmer
<aiwotaprog@tetteke.tk>
Fri, 8 Sep 2006 03:49:17 +0000
(12:49 +0900)
src/FukuiNoNamari/BbsType/bbs_type_2ch.py
patch
|
blob
|
history
src/FukuiNoNamari/BbsType/bbs_type_base.py
patch
|
blob
|
history
src/FukuiNoNamari/board_window.py
patch
|
blob
|
history
src/FukuiNoNamari/submit_window.py
patch
|
blob
|
history
src/FukuiNoNamari/thread_window.py
patch
|
blob
|
history
diff --git
a/src/FukuiNoNamari/BbsType/bbs_type_2ch.py
b/src/FukuiNoNamari/BbsType/bbs_type_2ch.py
index
b4c6a22
..
d9916a0
100644
(file)
--- a/
src/FukuiNoNamari/BbsType/bbs_type_2ch.py
+++ b/
src/FukuiNoNamari/BbsType/bbs_type_2ch.py
@@
-16,11
+16,13
@@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import re
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import re
-import co
py
+import co
decs
from bbs_type_exception import BbsTypeError
from bbs_type_base import BaseType
from bbs_type_exception import BbsTypeError
from bbs_type_base import BaseType
+# default name for morningcoffee
+moco_name = u'\u540d\u7121\u3057\u52df\u96c6\u4e2d\u3002\u3002\u3002'
_base_reg_expr = re.compile("http://(?P<host>[^./]+\.2ch\.net)/(?P<board>[^/]+)/$")
_cgi_reg_expr = re.compile("http://(?P<host>[^./]+\.2ch\.net)/test/read.cgi/(?P<board>[^/]+)/(?P<thread>[^/]+)/.*")
_base_reg_expr = re.compile("http://(?P<host>[^./]+\.2ch\.net)/(?P<board>[^/]+)/$")
_cgi_reg_expr = re.compile("http://(?P<host>[^./]+\.2ch\.net)/test/read.cgi/(?P<board>[^/]+)/(?P<thread>[^/]+)/.*")
@@
-31,6
+33,19
@@
class Type2ch(BaseType):
_base_reg = _base_reg_expr
_cgi_reg = _cgi_reg_expr
_base_reg = _base_reg_expr
_cgi_reg = _cgi_reg_expr
+ def is_same_board(self, another):
+ return self.bbs_type == another.bbs_type \
+ and self.board == another.board
+
+ def set_extra_post(self, post_dict):
+ post_dict["hana"] = "mogera"
+
+ if self.board == "morningcoffee":
+ if "FROM" not in post_dict or not post_dict["FROM"]:
+ post_dict["FROM"] = moco_name.encode("cp932", "replace")
+
+ return post_dict
+
def get_board_dir_path(self):
"""Returns board dir path from logs dir downward, not full path"""
def get_board_dir_path(self):
"""Returns board dir path from logs dir downward, not full path"""
diff --git
a/src/FukuiNoNamari/BbsType/bbs_type_base.py
b/src/FukuiNoNamari/BbsType/bbs_type_base.py
index
e0c5c6f
..
36fe32f
100644
(file)
--- a/
src/FukuiNoNamari/BbsType/bbs_type_base.py
+++ b/
src/FukuiNoNamari/BbsType/bbs_type_base.py
@@
-59,6
+59,11
@@
class BaseType:
def is_thread(self):
return self.thread
def is_thread(self):
return self.thread
+ def is_same_board(self, another):
+ return self.bbs_type == another.bbs_type \
+ and self.host == another.host \
+ and self.board == another.board
+
def clone_with_thread(self, thread):
if not thread:
raise ValueError, "parameter must not be empty"
def clone_with_thread(self, thread):
if not thread:
raise ValueError, "parameter must not be empty"
@@
-84,6
+89,9
@@
class BaseType:
return "http://" + self.host + "/test/read.cgi/" + \
self.board + "/" + self.thread + "/"
return "http://" + self.host + "/test/read.cgi/" + \
self.board + "/" + self.thread + "/"
+ def set_extra_post(self, post_dict):
+ return post_dict
+
def get_board_dir_path(self):
"""Returns board dir path from logs dir downward, not full path"""
def get_board_dir_path(self):
"""Returns board dir path from logs dir downward, not full path"""
diff --git
a/src/FukuiNoNamari/board_window.py
b/src/FukuiNoNamari/board_window.py
index
f8154e5
..
c6ca793
100644
(file)
--- a/
src/FukuiNoNamari/board_window.py
+++ b/
src/FukuiNoNamari/board_window.py
@@
-60,17
+60,13
@@
class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
self.bbs_type = bbs_type_judge_uri.get_type(uri)
board_data.BoardData.__init__(self, self.bbs_type)
self.bbs_type = bbs_type_judge_uri.get_type(uri)
board_data.BoardData.__init__(self, self.bbs_type)
- self.bbs = self.bbs_type.bbs_type
- self.host = self.bbs_type.host
- self.board = self.bbs_type.board
- self.uri = self.bbs_type.uri
glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
self.widget_tree = gtk.glade.XML(glade_path)
self.window = self.widget_tree.get_widget("board_window")
glade_path = os.path.join(GLADE_DIR, GLADE_FILENAME)
self.widget_tree = gtk.glade.XML(glade_path)
self.window = self.widget_tree.get_widget("board_window")
- self.window.set_title(self.uri)
+ self.window.set_title(self.
bbs_type.
uri)
self.treeview = self.widget_tree.get_widget("treeview")
self.treeview.set_model(ThreadListModel())
self.treeview = self.widget_tree.get_widget("treeview")
self.treeview.set_model(ThreadListModel())
@@
-321,8
+317,8
@@
class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
# nothing to do if thread_uri does not belong to this board.
bbs_type = bbs_type_judge_uri.get_type(thread_uri)
# nothing to do if thread_uri does not belong to this board.
bbs_type = bbs_type_judge_uri.get_type(thread_uri)
- if
bbs_type.bbs_type != self.bbs
\
-
or bbs_type.board != self.board or not bbs_type.is_thread(
):
+ if
not bbs_type.is_thread()
\
+
or not bbs_type.is_same_board(self.bbs_type
):
return
thread = bbs_type.thread
return
thread = bbs_type.thread
diff --git
a/src/FukuiNoNamari/submit_window.py
b/src/FukuiNoNamari/submit_window.py
index
e46a4c5
..
f64426f
100644
(file)
--- a/
src/FukuiNoNamari/submit_window.py
+++ b/
src/FukuiNoNamari/submit_window.py
@@
-113,7
+113,6
@@
class WinWrap:
self.post_dict["bbs"] = self.bbs_type.board
self.post_dict["key"] = self.bbs_type.thread
self.post_dict["time"] = str(int(time.time()))
self.post_dict["bbs"] = self.bbs_type.board
self.post_dict["key"] = self.bbs_type.thread
self.post_dict["time"] = str(int(time.time()))
- self.post_dict["hana"] = "mogera"
self.post_dict["submit"] = u"\u66f8\u304d\u8fbc\u3080".encode(
"cp932", "replace")
self.post_dict["submit"] = u"\u66f8\u304d\u8fbc\u3080".encode(
"cp932", "replace")
@@
-131,10
+130,6
@@
class WinWrap:
def on_submit_activate(self, widget):
name = self.entry_name.get_text()
def on_submit_activate(self, widget):
name = self.entry_name.get_text()
- if self.bbs_type.bbs_type == "2ch" \
- and self.bbs_type.board == "morningcoffee" \
- and not name:
- name = u'\u540d\u7121\u3057\u52df\u96c6\u4e2d\u3002\u3002\u3002'
mail = self.entry_mail.get_text()
msg = self.textbuffer.get_text(
self.textbuffer.get_start_iter(), self.textbuffer.get_end_iter())
mail = self.entry_mail.get_text()
msg = self.textbuffer.get_text(
self.textbuffer.get_start_iter(), self.textbuffer.get_end_iter())
@@
-143,6
+138,8
@@
class WinWrap:
self.post_dict["mail"] = mail.encode("cp932", "replace")
self.post_dict["MESSAGE"] = msg.encode("cp932", "replace")
self.post_dict["mail"] = mail.encode("cp932", "replace")
self.post_dict["MESSAGE"] = msg.encode("cp932", "replace")
+ self.post_dict = self.bbs_type.set_extra_post(self.post_dict)
+
self.do_submit()
def do_submit(self):
self.do_submit()
def do_submit(self):
diff --git
a/src/FukuiNoNamari/thread_window.py
b/src/FukuiNoNamari/thread_window.py
index
b32f7bc
..
a5e2797
100644
(file)
--- a/
src/FukuiNoNamari/thread_window.py
+++ b/
src/FukuiNoNamari/thread_window.py
@@
-86,11
+86,6
@@
class WinWrap(winwrapbase.WinWrapBase):
if not self.bbs_type.is_thread():
raise bbs_type_exception.BbsTypeError, \
"the uri does not represent thread: " + uri
if not self.bbs_type.is_thread():
raise bbs_type_exception.BbsTypeError, \
"the uri does not represent thread: " + uri
- self.bbs = self.bbs_type.bbs_type
- self.board = self.bbs_type.board
- self.thread = self.bbs_type.thread
- self.host = self.bbs_type.host
- self.uri = self.bbs_type.uri
self.size = 0
self.num = 0
self.title = ""
self.size = 0
self.num = 0
self.title = ""